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

ifesdjeen pushed a commit to branch cep-15-accord
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cep-15-accord by this push:
     new a97de782a5 Improve stability of tests with many epochs
a97de782a5 is described below

commit a97de782a540031b4307f5e11ca8ac7cb00178df
Author: Alex Petrov <[email protected]>
AuthorDate: Fri Feb 21 13:46:56 2025 +0100

    Improve stability of tests with many epochs
    
    Patch by Alex Petrov; reviewed by Benedict Elliott Smith for CASSANDRA-20358
---
 .../accord/AccordMigrationWriteRaceTestBase.java     | 20 +-------------------
 .../distributed/test/accord/AccordTestBase.java      | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordMigrationWriteRaceTestBase.java
 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordMigrationWriteRaceTestBase.java
index 9b736ec67b..3c243a2266 100644
--- 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordMigrationWriteRaceTestBase.java
+++ 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordMigrationWriteRaceTestBase.java
@@ -260,7 +260,6 @@ public abstract class AccordMigrationWriteRaceTestBase 
extends AccordTestBase
     @After
     public void tearDown() throws Exception
     {
-        super.tearDown();
         messageSink.reset();
         forEach(() -> {
             BatchlogManager.instance.resumeReplay();
@@ -268,29 +267,12 @@ public abstract class AccordMigrationWriteRaceTestBase 
extends AccordTestBase
             HintsService.instance.resumeDispatch();
         });
         SHARED_CLUSTER.forEach(ClusterUtils::clearAndUnpause);
-        super.tearDown();
         // Reset migration state
         forEach(() -> {
             ConsensusRequestRouter.resetInstance();
             ConsensusKeyMigrationState.reset();
         });
-        truncateSystemTables();
-        ClusterUtils.waitForCMSToQuiesce(SHARED_CLUSTER, 1);
-        SHARED_CLUSTER.forEach(() -> Util.spinUntilTrue(() -> 
ClusterMetadata.current().epoch.getEpoch() ==
-                                                              ((AccordService) 
AccordService.instance()).configurationService().currentEpoch() &&
-                                                              
AccordService.instance().topology().current().epoch() ==
-                                                              ((AccordService) 
AccordService.instance()).configurationService().currentEpoch(),
-                                                        60));
-        SHARED_CLUSTER.forEach(() -> {
-            try
-            {
-                
AccordService.instance().epochReady(ClusterMetadata.current().epoch).get(30, 
TimeUnit.SECONDS);
-            }
-            catch (Throwable e)
-            {
-                throw new RuntimeException(e);
-            }
-        });
+        super.tearDown();
     }
 
     private ListenableFuture<Void> 
alterTableTransactionalModeAsync(TransactionalMode mode)
diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordTestBase.java
 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordTestBase.java
index f67bc07c05..c80fdb60b8 100644
--- 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordTestBase.java
+++ 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordTestBase.java
@@ -57,6 +57,7 @@ import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
 import net.bytebuddy.implementation.MethodDelegation;
 import net.bytebuddy.implementation.bind.annotation.SuperCall;
 import net.bytebuddy.implementation.bind.annotation.This;
+import org.apache.cassandra.Util;
 import org.apache.cassandra.batchlog.BatchlogManager;
 import org.apache.cassandra.cql3.CQLStatement;
 import org.apache.cassandra.cql3.QueryProcessor;
@@ -93,6 +94,7 @@ import org.apache.cassandra.net.Verb;
 import org.apache.cassandra.schema.Schema;
 import org.apache.cassandra.schema.TableMetadata;
 import org.apache.cassandra.service.ClientState;
+import org.apache.cassandra.service.accord.AccordService;
 import org.apache.cassandra.service.accord.api.AccordRoutingKey;
 import org.apache.cassandra.service.accord.exceptions.ReadPreemptedException;
 import org.apache.cassandra.service.accord.exceptions.WritePreemptedException;
@@ -149,7 +151,7 @@ public abstract class AccordTestBase extends TestBaseImpl
         if (SHARED_CLUSTER != null)
             SHARED_CLUSTER.close();
     }
-    
+
     @Before
     public void setup()
     {
@@ -164,6 +166,15 @@ public abstract class AccordTestBase extends TestBaseImpl
     {
         for (IInvokableInstance instance : SHARED_CLUSTER)
             instance.runOnInstance(() -> 
DefaultProgressLogs.unsafePauseForTesting(false));
+
+        truncateSystemTables();
+
+        ClusterUtils.waitForCMSToQuiesce(SHARED_CLUSTER, 1);
+        SHARED_CLUSTER.forEach(() -> Util.spinUntilTrue(() -> 
ClusterMetadata.current().epoch.getEpoch() ==
+                                                              ((AccordService) 
AccordService.instance()).configurationService().currentEpoch() &&
+                                                              
AccordService.instance().topology().current().epoch() ==
+                                                              ((AccordService) 
AccordService.instance()).configurationService().currentEpoch(),
+                                                        60));
     }
 
     protected static void assertRowSerial(Cluster cluster, String query, int 
k, int c, int v, int s)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to