Skip to content

Commit 990c7c6

Browse files
chicobentoadutra
authored andcommitted
JAVA-2938: OverloadedException message is misleading
1 parent 6c51faa commit 990c7c6

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

changelog/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<!-- Note: contrary to 3.x, insert new entries *first* in their section -->
44

5+
### 4.11.2 (in progress)
6+
7+
- [bug] JAVA-2938: OverloadedException message is misleading
8+
59
### 4.11.1
610

711
- [bug] JAVA-2910: Add a configuration option to support strong values for prepared statements cache

core/src/main/java/com/datastax/oss/driver/api/core/servererrors/OverloadedException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@
2727
/**
2828
* Thrown when the coordinator reported itself as being overloaded.
2929
*
30-
* <p>This exception is processed by {@link RetryPolicy#onErrorResponse(Request,
30+
* <p>This exception is processed by {@link RetryPolicy#onErrorResponseVerdict(Request,
3131
* CoordinatorException, int)}, which will decide if it is rethrown directly to the client or if the
3232
* request should be retried. If all other tried nodes also fail, this exception will appear in the
3333
* {@link AllNodesFailedException} thrown to the client.
3434
*/
3535
public class OverloadedException extends QueryExecutionException {
3636

3737
public OverloadedException(@NonNull Node coordinator) {
38-
super(coordinator, String.format("%s is bootstrapping", coordinator), null, false);
38+
super(coordinator, String.format("%s is overloaded", coordinator), null, false);
39+
}
40+
41+
public OverloadedException(@NonNull Node coordinator, @NonNull String message) {
42+
super(coordinator, String.format("%s is overloaded: %s", coordinator, message), null, false);
3943
}
4044

4145
private OverloadedException(

core/src/main/java/com/datastax/oss/driver/internal/core/cql/Conversions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public static CoordinatorException toThrowable(
462462
unavailable.required,
463463
unavailable.alive);
464464
case ProtocolConstants.ErrorCode.OVERLOADED:
465-
return new OverloadedException(node);
465+
return new OverloadedException(node, errorMessage.message);
466466
case ProtocolConstants.ErrorCode.IS_BOOTSTRAPPING:
467467
return new BootstrappingException(node);
468468
case ProtocolConstants.ErrorCode.TRUNCATE_ERROR:

0 commit comments

Comments
 (0)