You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2025/09/25 13:35:31 UTC

(cassandra) branch cep-45-mutation-tracking updated: Fix CoordinatorLogOffsetsLifecycleTest

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

aleksey pushed a commit to branch cep-45-mutation-tracking
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cep-45-mutation-tracking by this push:
     new 942fa5a3f3 Fix CoordinatorLogOffsetsLifecycleTest
942fa5a3f3 is described below

commit 942fa5a3f3a7deb031a77813e35ea150bd3781cf
Author: Aleksey Yeschenko <al...@apache.org>
AuthorDate: Thu Sep 25 14:34:44 2025 +0100

    Fix CoordinatorLogOffsetsLifecycleTest
---
 .../replication/MutationTrackingService.java        |  6 ++++++
 .../db/CoordinatorLogOffsetsLifecycleTest.java      | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/java/org/apache/cassandra/replication/MutationTrackingService.java b/src/java/org/apache/cassandra/replication/MutationTrackingService.java
index f780a35bfa..6dc1bcc963 100644
--- a/src/java/org/apache/cassandra/replication/MutationTrackingService.java
+++ b/src/java/org/apache/cassandra/replication/MutationTrackingService.java
@@ -555,6 +555,12 @@ public class MutationTrackingService
         }
     }
 
+    @VisibleForTesting
+    public void persistLogStateForTesting()
+    {
+        offsetsPersister.run();
+    }
+
     @VisibleForTesting
     public void broadcastOffsetsForTesting()
     {
diff --git a/test/unit/org/apache/cassandra/db/CoordinatorLogOffsetsLifecycleTest.java b/test/unit/org/apache/cassandra/db/CoordinatorLogOffsetsLifecycleTest.java
index 98472ad1e3..20d098fcb1 100644
--- a/test/unit/org/apache/cassandra/db/CoordinatorLogOffsetsLifecycleTest.java
+++ b/test/unit/org/apache/cassandra/db/CoordinatorLogOffsetsLifecycleTest.java
@@ -141,14 +141,17 @@ public class CoordinatorLogOffsetsLifecycleTest
     {
         String ks = nextKeyspaceName();
         String tbl = "tbl";
-        TableMetadata tableMetadata = TableMetadata.builder(ks, tbl)
-                                                   .addPartitionKeyColumn("k", Int32Type.instance)
-                                                   .addRegularColumn("v", Int32Type.instance)
-                                                   .build();
-
-        TableParams tableParams = tableMetadata.params;
-        tableParams = tableParams.unbuild().memtable(MemtableParams.get(memtableConfig)).build();
-        tableMetadata = tableMetadata.withSwapped(tableParams);
+        TableParams tableParams =
+            TableParams.builder()
+                       .memtable(MemtableParams.get(memtableConfig))
+                       .build();
+
+        TableMetadata tableMetadata =
+            TableMetadata.builder(ks, tbl)
+                         .addPartitionKeyColumn("k", Int32Type.instance)
+                         .addRegularColumn("v", Int32Type.instance)
+                         .params(tableParams)
+                         .build();
 
         SchemaLoader.createKeyspace(ks, KeyspaceParams.simple(1, ReplicationType.tracked), tableMetadata);
 
@@ -183,6 +186,7 @@ public class CoordinatorLogOffsetsLifecycleTest
 
         // flush 1
         {
+            MutationTrackingService.instance.persistLogStateForTesting();
             cfs.forceBlockingFlush(ColumnFamilyStore.FlushReason.UNIT_TESTS);
 
             View view = cfs.getTracker().getView();
@@ -216,6 +220,7 @@ public class CoordinatorLogOffsetsLifecycleTest
 
         // flush 2
         {
+            MutationTrackingService.instance.persistLogStateForTesting();
             cfs.forceBlockingFlush(ColumnFamilyStore.FlushReason.UNIT_TESTS);
 
             View view = cfs.getTracker().getView();


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