jmckenzie-dev commented on code in PR #4727:
URL: https://github.com/apache/cassandra/pull/4727#discussion_r3074289982


##########
src/java/org/apache/cassandra/db/ReadCommandVerbHandler.java:
##########
@@ -87,17 +88,28 @@ public void doVerb(Message<ReadCommand> message)
         {
             response = command.createResponse(iterator, 
controller.getRepairedDataInfo());
         }
+        catch (AssertionError t)
+        {
+            throw new AssertionError(String.format("Caught an error while 
trying to process the command: %s", command.toCQLString()), t);
+        }
+        catch (QueryCancelledException e)
+        {
+            logger.debug("Query cancelled (timeout)", e);
+            response = null;
+            assert !command.isCompleted() : "Read marked as completed despite 
being aborted by timeout to table " + command.metadata();
+        }
 
-        if (!command.complete())
+        if (command.complete())
+        {
+            Tracing.trace("Enqueuing response to {}", message.from());

Review Comment:
   Now that I see this laid out it makes me wonder if we're constructing this 
string on every pass regardless of whether Tracing is enabled or not... If 
that's the case that'd be pretty wasteful. Could you double check that, and if 
there's a String construction that happens here even if tracing disabled, guard 
within a boolean check?



##########
src/java/org/apache/cassandra/service/StorageProxy.java:
##########
@@ -1986,6 +1987,12 @@ protected void runMayThrow()
                 {
                     response = command.createResponse(iterator, 
controller.getRepairedDataInfo());
                 }
+                catch (QueryCancelledException e)
+                {
+                    logger.debug("Query cancelled (timeout)", e);
+                    response = null;
+                    assert !command.isCompleted() : "Local read marked as 
completed despite being aborted by timeout to table " + command.metadata();

Review Comment:
   Same feedback here re: Preconditions vs. assert check



-- 
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]

Reply via email to