You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/03/17 20:24:03 UTC

[GitHub] [cassandra] yifan-c commented on a change in pull request #470: CASSANDRA-15630 fix testSerializeError

yifan-c commented on a change in pull request #470: CASSANDRA-15630 fix testSerializeError
URL: https://github.com/apache/cassandra/pull/470#discussion_r393947441
 
 

 ##########
 File path: test/unit/org/apache/cassandra/net/ConnectionUtils.java
 ##########
 @@ -240,6 +247,27 @@ private void doCheck(FailCheck testAndFailCheck)
         }
     }
 
+    private static void longCheck(Runnable assertion, long timeout, TimeUnit timeUnit)
+    {
+        long start = System.currentTimeMillis();
+        for (;;)
+        {
+            try
+            {
+                assertion.run();
+                return;
+            }
+            catch (AssertionError e)
+            {
+                long elapsedMs = System.currentTimeMillis() - start;
+                if (elapsedMs > timeUnit.toMillis(timeout))
+                    throw e;
+                else
+                    Uninterruptibles.sleepUninterruptibly(5, TimeUnit.MILLISECONDS);
 
 Review comment:
   Thanks for the suggestion. I took a close look at the `Retry` utility. 
   I think 1) scheduling the check in the other thread does not benefit in this case. Because it needs to block for the check result anyway. 
   2) the check operation is not resources intensive (read multiple values and compare). Exponential backoff does not help. In fact, the test can check frequently in order to exit quick. 
   
   There is no api in `Retry` allows adding a different backup off time yet. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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