maedhroz commented on code in PR #3274:
URL: https://github.com/apache/cassandra/pull/3274#discussion_r1592925628
##########
src/java/org/apache/cassandra/transport/PreV5Handlers.java:
##########
@@ -219,15 +243,30 @@ private void discardAndThrow(Message.Request request,
long requestSize, Overload
requestSize, channelPayloadBytesInFlight,
endpointPayloadTracker,
GLOBAL_REQUEST_LIMITER, request);
- OverloadedException exception = overload == Overload.REQUESTS
- ? new OverloadedException(String.format("Request breached
global limit of %d requests/second. Server is " +
- "currently in an
overloaded state and cannot accept more requests.",
-
GLOBAL_REQUEST_LIMITER.getRate()))
- : new OverloadedException(String.format("Request breached
limit on bytes in flight. (%s)) " +
- "Server is
currently in an overloaded state and cannot accept more requests.",
- endpointPayloadTracker));
-
+ OverloadedException exception;
+ switch (overload)
+ {
+ case REQUESTS:
+ exception = new OverloadedException(String.format("Request
breached global limit of %d requests/second. Server is " +
+
"currently in an overloaded state and cannot accept more requests.",
+
GLOBAL_REQUEST_LIMITER.getRate()));
+ break;
+ case BYTES_IN_FLIGHT:
+ exception = new OverloadedException(String.format("Request
breached limit on bytes in flight. (%s)) " +
+ "Server
is currently in an overloaded state and cannot accept more requests.",
+
+
endpointPayloadTracker));
+ break;
+ case QUEUE_TIME:
+ exception = new OverloadedException(String.format("Request
has spent over %s time of the maximum timeout %dms in the queue",
+
DatabaseDescriptor.getNativeTransportQueueMaxItemAgeThreshold(),
+
DatabaseDescriptor.getNativeTransportTimeout(TimeUnit.MILLISECONDS)));
+ break;
+ default:
+ throw new IllegalArgumentException(String.format("Can't
create an exception from %s", overload));
+ }
Review Comment:
I wonder if we could combine this w/ `buildOverloadedException()` in
`CQLMessageHandler`? (Pass the limier as an argument, etc.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]