bbotella commented on code in PR #4081:
URL: https://github.com/apache/cassandra/pull/4081#discussion_r2039779899


##########
test/distributed/org/apache/cassandra/distributed/test/cql3/StatefulASTBase.java:
##########
@@ -496,11 +499,43 @@ protected ByteBuffer[][] executeQuery(IInstance instance, 
int fetchSize, Consist
                                  .findAny()
                                  .get();
                 ss.setHost(host);
-                ResultSet result = session.execute(ss);
+                // Only SELECT is known safe to retry, as Mutations might not 
be idempotent!
+                boolean allowRetries = stmt.kind() == Statement.Kind.SELECT;
+                ResultSet result = !allowRetries ? session.execute(ss)
+                                                 : executeWithRetries(ss, 3);
                 return getRowsAsByteBuffer(result);
             }
         }
 
+        private ResultSet executeWithRetries(SimpleStatement ss, int maxTries)
+        {
+            Backoff backoff = null;
+            Throwable lastError = null;
+            for (int i = 0; i < maxTries; i++)
+            {
+                try
+                {
+                    return session.execute(ss);
+                }
+                catch (Throwable t)

Review Comment:
   Not a huge deal as not too extra time is being added for actual errors. It 
is just a matter of trying to be as specific as possible on the catch if we are 
adding this for the sole purpose of dealing with some ephemeral read errors.
   
   Not a blocker for the PR, I already gave my +1 on the ticket when posting 
this question.



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to