Fix test NetstatsBootstrapWithEntireSSTablesCompressionStreamingTest#testWithStreamingEntireSSTablesWithoutCompressionWithoutThrottling

patch by David Capwell; reviewed by David Capwell, Stefan Miklosovic for CASSANDRA-17143
This commit is contained in:
David Capwell 2021-11-15 08:51:43 -08:00
parent b84ec51b4c
commit ad4d2b3a26
1 changed files with 16 additions and 0 deletions

View File

@ -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")))