aweisberg commented on code in PR #3379:
URL: https://github.com/apache/cassandra/pull/3379#discussion_r1645186798


##########
src/java/org/apache/cassandra/service/accord/exceptions/ReadExhaustedException.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.service.accord.exceptions;
+
+import java.util.Map;
+
+import org.apache.cassandra.db.ConsistencyLevel;
+import org.apache.cassandra.exceptions.ReadFailureException;
+import org.apache.cassandra.exceptions.RequestFailureReason;
+import org.apache.cassandra.locator.InetAddressAndPort;
+
+public class ReadExhaustedException extends ReadFailureException

Review Comment:
   We can only hit exhausted for reads and specifically barriers?



##########
src/java/org/apache/cassandra/service/accord/AccordService.java:
##########
@@ -430,57 +442,83 @@ public long repair(@Nonnull Seekables keysOrRanges, long 
epoch, long queryStartN
         return barrier(keysOrRanges, epoch, queryStartNanos, timeoutNanos, 
barrierType, isForWrite, repairSyncPoint(allNodes));
     }
 
-    private static ReadTimeoutException newBarrierTimeout(TxnId txnId, boolean 
global)
+    @VisibleForTesting
+    static ReadTimeoutException newBarrierTimeout(TxnId txnId, boolean global)
     {
         return new ReadTimeoutException(global ? ConsistencyLevel.ANY : 
ConsistencyLevel.QUORUM, 0, 0, false, txnId.toString());
     }
 
-    private static ReadTimeoutException newBarrierPreempted(TxnId txnId, 
boolean global)
+    @VisibleForTesting
+    static ReadTimeoutException newBarrierPreempted(TxnId txnId, boolean 
global)
     {
         return new ReadPreemptedException(global ? ConsistencyLevel.ANY : 
ConsistencyLevel.QUORUM, 0, 0, false, txnId.toString());
     }
 
-    private long doWithRetries(LongSupplier action, int retryAttempts, long 
initialBackoffMillis, long maxBackoffMillis) throws InterruptedException
+    @VisibleForTesting
+    static ReadExhaustedException newBarrierExhausted(TxnId txnId, boolean 
global)
+    {
+        //TODO (usability): not being able to show the txn is a bad UX, this 
becomes harder to trace back in logs
+        return new ReadExhaustedException(global ? ConsistencyLevel.ANY : 
ConsistencyLevel.QUORUM, 0, 0, false, ImmutableMap.of());
+    }
+
+    @VisibleForTesting
+    static boolean isTimeout(Throwable t)
+    {
+        return t instanceof Timeout || t instanceof ReadTimeoutException || t 
instanceof Preempted || t instanceof ReadPreemptedException;

Review Comment:
   I literally just encountered the Preempted == timeout issue in my testing 
today.



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