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

marcuse 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 901786ec27 Avoid race inserting new data in compaction_history during 
truncation in SystemKeyspaceMigrator41Test.testMigrateCompactionHistory
901786ec27 is described below

commit 901786ec27f726305ba665056a868b37d9cb3e38
Author: Marcus Eriksson <marc...@apache.org>
AuthorDate: Mon Dec 11 16:47:19 2023 +0100

    Avoid race inserting new data in compaction_history during truncation in 
SystemKeyspaceMigrator41Test.testMigrateCompactionHistory
    
    Patch by marcuse; reviewed by Sam Tunnicliffe for CASSANDRA-19098
---
 .../org/apache/cassandra/db/SystemKeyspaceMigrator41Test.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/test/unit/org/apache/cassandra/db/SystemKeyspaceMigrator41Test.java 
b/test/unit/org/apache/cassandra/db/SystemKeyspaceMigrator41Test.java
index 2a1561b8a1..f9a09608a4 100644
--- a/test/unit/org/apache/cassandra/db/SystemKeyspaceMigrator41Test.java
+++ b/test/unit/org/apache/cassandra/db/SystemKeyspaceMigrator41Test.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.db;
 
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
 import java.util.UUID;
@@ -32,6 +33,7 @@ import org.junit.Test;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.cql3.CQLTester;
 import org.apache.cassandra.cql3.UntypedResultSet;
+import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.marshal.BytesType;
 import org.apache.cassandra.db.marshal.Int32Type;
 import org.apache.cassandra.db.marshal.LongType;
@@ -311,10 +313,15 @@ public class SystemKeyspaceMigrator41Test extends 
CQLTester
             assertEquals(ImmutableMap.of(), 
row.getMap("compaction_properties", UTF8Type.instance, UTF8Type.instance));
         }
         assertEquals(1, rowCount);
+        Keyspace.all().forEach(ks -> {
+            ks.getColumnFamilyStores().forEach(cfs -> {
+                cfs.disableAutoCompaction();
+                
CompactionManager.instance.waitForCessation(Collections.singleton(cfs), 
(sstable) -> true);
+            });
+        });
 
         //Test nulls/missing don't prevent the row from propagating
         execute(String.format("TRUNCATE %s", table));
-        
         execute(String.format("INSERT INTO %s (id) VALUES (?)", table), 
compactionId);
         SystemKeyspaceMigrator41.migrateCompactionHistory();
 


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

Reply via email to