You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by dc...@apache.org on 2021/11/15 17:32:46 UTC

[cassandra] branch trunk updated: Fix test NetstatsBootstrapWithEntireSSTablesCompressionStreamingTest#testWithStreamingEntireSSTablesWithoutCompressionWithoutThrottling

This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ad4d2b3  Fix test NetstatsBootstrapWithEntireSSTablesCompressionStreamingTest#testWithStreamingEntireSSTablesWithoutCompressionWithoutThrottling
ad4d2b3 is described below

commit ad4d2b3a266535734ef1bdebb4a3545fb3306769
Author: David Capwell <dc...@apache.org>
AuthorDate: Mon Nov 15 08:51:43 2021 -0800

    Fix test NetstatsBootstrapWithEntireSSTablesCompressionStreamingTest#testWithStreamingEntireSSTablesWithoutCompressionWithoutThrottling
    
    patch by David Capwell; reviewed by David Capwell, Stefan Miklosovic for CASSANDRA-17143
---
 .../distributed/test/AbstractNetstatsStreaming.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/distributed/org/apache/cassandra/distributed/test/AbstractNetstatsStreaming.java b/test/distributed/org/apache/cassandra/distributed/test/AbstractNetstatsStreaming.java
index 2e828e0..93d26f1 100644
--- a/test/distributed/org/apache/cassandra/distributed/test/AbstractNetstatsStreaming.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/AbstractNetstatsStreaming.java
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
 import com.datastax.driver.core.Session;
 import org.apache.cassandra.distributed.Cluster;
 import org.apache.cassandra.distributed.api.IInvokableInstance;
+import org.apache.cassandra.distributed.api.LogResult;
 import org.apache.cassandra.distributed.api.NodeToolResult;
 import org.apache.cassandra.utils.Pair;
 
@@ -509,6 +510,7 @@ public abstract class AbstractNetstatsStreaming extends TestBaseImpl
 
             boolean sawAnyStreamingOutput = false;
 
+            long mark = 0;
             while (true)
             {
                 try
@@ -523,6 +525,20 @@ public abstract class AbstractNetstatsStreaming extends TestBaseImpl
                         {
                             sawAnyStreamingOutput = true;
                         }
+                        else
+                        {
+                            // there is a race condition that streaming starts/stops between calls to netstats
+                            // to detect this, check to see if the node has completed a stream
+                            // expected log: [Stream (.*)?] All sessions completed
+                            LogResult<List<String>> logs = node.logs().grep(mark, "\\[Stream .*\\] All sessions completed");
+                            mark = logs.getMark();
+                            if (!logs.getResult().isEmpty())
+                            {
+                                // race condition detected...
+                                logger.info("Test race condition detected where streaming started/stopped between calls to netstats");
+                                sawAnyStreamingOutput = true;
+                            }
+                        }
                     }
 
                     if (sawAnyStreamingOutput && (!result.getStdout().contains("Receiving") && !result.getStdout().contains("Sending")))

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