From d46b8a827acf76b25ab538b52ec0f71bd6adbd0e Mon Sep 17 00:00:00 2001 From: Dmitry Konstantinov Date: Thu, 18 Jun 2026 11:12:44 +0100 Subject: [PATCH] Report cancelled read command execution to coordinator as a RequestFailure.TIMEOUT patch by Dmitry Konstantinov; reviewed by Sam Tunnicliffe for CASSANDRA-21468 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/service/StorageProxy.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4dbb5c2691..36dd204c0f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 6.0-alpha2 + * Report cancelled read command execution to coordinator as a RequestFailure.TIMEOUT (CASSANDRA-21468) * Fix TCM log catchup from peer with snapshots and gaps in the log sequence (CASSANDRA-21455) * Speed up nodetool doc generation by producing all command help in a single jvm (CASSANDRA-21444) * Always send TCM commit failures as Messaging failures (CASSANDRA-21457) diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 4368f6d4fc..9e61567cb4 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -2739,6 +2739,7 @@ public class StorageProxy implements StorageProxyMBean protected void runMayThrow() { + boolean cancelled = false; try { MessageParams.reset(); @@ -2765,6 +2766,7 @@ public class StorageProxy implements StorageProxyMBean { logger.debug("Query cancelled (timeout)", e); response = null; + cancelled = true; Preconditions.checkState(!command.isCompleted(), "Local read marked as completed despite being aborted by timeout to table %s", command.metadata()); } @@ -2776,7 +2778,7 @@ public class StorageProxy implements StorageProxyMBean { // We track latency based on request processing time MessagingService.instance().metrics.recordSelfDroppedMessage(verb, MonotonicClock.Global.preciseTime.now() - requestTime.startedAtNanos(), NANOSECONDS); - handler.onFailure(FBUtilities.getBroadcastAddressAndPort(), RequestFailure.UNKNOWN); + handler.onFailure(FBUtilities.getBroadcastAddressAndPort(), cancelled ? RequestFailure.TIMEOUT : RequestFailure.UNKNOWN); } if (!readRejected)