This is an automated email from the ASF dual-hosted git repository. jonmeredith pushed a commit to branch cassandra-3.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-3.0 by this push: new ba0555e965 Fix flaky test - org.apache.cassandra.distributed.test.MessageForwardingTest.mutationsForwardedToAllReplicasTest ba0555e965 is described below commit ba0555e965699d64099870c0288b31d1a15b2698 Author: Jon Meredith <https://jonmered...@apache.org> AuthorDate: Sun Jun 5 15:13:24 2022 -0600 Fix flaky test - org.apache.cassandra.distributed.test.MessageForwardingTest.mutationsForwardedToAllReplicasTest patch by Jon Meredith; reviewed by David Capwell for CASSANDRA-17583 --- .../distributed/test/MessageForwardingTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/distributed/org/apache/cassandra/distributed/test/MessageForwardingTest.java b/test/distributed/org/apache/cassandra/distributed/test/MessageForwardingTest.java index 61ccb5fcf3..cc54711d8d 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/MessageForwardingTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/MessageForwardingTest.java @@ -24,19 +24,26 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.stream.IntStream; import java.util.stream.Stream; import org.junit.Assert; import org.junit.Test; +import org.apache.cassandra.concurrent.Stage; +import org.apache.cassandra.concurrent.StageManager; import org.apache.cassandra.distributed.Cluster; import org.apache.cassandra.distributed.api.ConsistencyLevel; import org.apache.cassandra.distributed.impl.IsolatedExecutor; import org.apache.cassandra.distributed.impl.TracingUtil; import org.apache.cassandra.utils.UUIDGen; +import static org.apache.cassandra.concurrent.StageManager.NO_OP_TASK; + public class MessageForwardingTest extends TestBaseImpl { @Test @@ -66,6 +73,21 @@ public class MessageForwardingTest extends TestBaseImpl //noinspection ResultOfMethodCallIgnored inserts.map(IsolatedExecutor::waitOn).count(); + // Tracing is async with respect to queries, just because the query has completed it does not mean + // all tracing updates have completed. The tracing executor serializes work, so run a task through + // and everthing submitted before must have completed. + cluster.forEach(instance -> instance.runOnInstance(() -> { + Future<?> result = StageManager.getStage(Stage.TRACING).submit(NO_OP_TASK); + try + { + result.get(30, TimeUnit.SECONDS); + } + catch (ExecutionException | InterruptedException | TimeoutException ex) + { + throw new RuntimeException(ex); + } + })); + cluster.forEach(instance -> commitCounts.put(instance.broadcastAddress().getAddress(), 0)); List<TracingUtil.TraceEntry> traces = TracingUtil.getTrace(cluster, sessionId, ConsistencyLevel.ALL); traces.forEach(traceEntry -> { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org