JAVA-1682: Provide a way to record latencies for cancelled speculativ… · ws-java/java-driver@13ac176 · GitHub
Skip to content

Commit 13ac176

Browse files
committed
JAVA-1682: Provide a way to record latencies for cancelled speculative executions
Those latencies are emitted with a CancelledSpeculativeExecutionException, which allows LatencyTracker implementations to choose whether to include them or not. For example, a tracker that wants to detect "slowness" of a node might want to record them (otherwise a node that always hits the speculative execution threshold would appear to have no measurement), whereas a tracker that monitors latencies of successful executions should ignore them.
1 parent 58af03b commit 13ac176

4 files changed

Lines changed: 41 additions & 1 deletion

File tree

changelog/README.md

Lines changed: 1 addition & 0 deletions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2012-2017 DataStax Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.datastax.driver.core;
17+
18+
/**
19+
* Special exception that gets emitted to {@link LatencyTracker}s with the latencies of cancelled speculative
20+
* executions. This allows those trackers to choose whether to ignore those latencies or not.
21+
*/
22+
class CancelledSpeculativeExecutionException extends Exception {
23+
24+
static CancelledSpeculativeExecutionException INSTANCE = new CancelledSpeculativeExecutionException();
25+
26+
private CancelledSpeculativeExecutionException() {
27+
super();
28+
}
29+
}

driver-core/src/main/java/com/datastax/driver/core/PercentileTracker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ protected boolean include(Host host, Statement statement, Exception exception) {
255255
OverloadedException.class,
256256
BootstrappingException.class,
257257
UnpreparedException.class,
258-
QueryValidationException.class // query validation also happens at early stages in the coordinator
258+
QueryValidationException.class, // query validation also happens at early stages in the coordinator
259+
CancelledSpeculativeExecutionException.class
259260
);
260261

261262
/**

driver-core/src/main/java/com/datastax/driver/core/RequestHandler.java

Lines changed: 9 additions & 0 deletions

0 commit comments

Comments
 (0)