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

jlewandowski pushed a commit to branch ds-trunk-5.0--2024-07-24
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git

commit 453027efeef7adfc9f5eadc8497b2e8f917f0501
Author: Aleksandr Sorokoumov <[email protected]>
AuthorDate: Thu Aug 5 15:57:31 2021 +0200

    STAR-836 Fix 
TestCompaction_with_UnifiedCompactionStrategy.bloomfilter_size_test (#41)
    
    Co-authored-by: Branimir Lambov <[email protected]>
    (cherry picked from commit 7777fa9c7a478bb3795bc1c0e5602cbae2921faf)
    (cherry picked from commit d06d4c68ca15076cd06fafaff9c9762d9bd532d1)
    (cherry picked from commit 12f5fffcbb78b4ee51289c1c7e3a121475256628)
    (cherry picked from commit a29f899fc4fa8d389fc26628f0749ee096b2a932)
    (cherry picked from commit cfc58a3aed8a93f9a7f0a8660bb73bb3d38e9560)
    (cherry picked from commit 2a2726a4962c0627f1277a5dbe04ee6e194db4ab)
---
 compaction_test.py                                 | 14 +++++++--
 ...dCompactionStrategy.bloomfilter_size_test (#41) | 36 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/compaction_test.py b/compaction_test.py
index 3833ae32..d79f1326 100644
--- a/compaction_test.py
+++ b/compaction_test.py
@@ -118,6 +118,8 @@ class TestCompaction(Tester):
         else:
             if strategy == "DateTieredCompactionStrategy":
                 strategy_string = 
"strategy=DateTieredCompactionStrategy,base_time_seconds=86400"  # we want a 
single sstable, so make sure we don't have a tiny first window
+            elif self.strategy == "UnifiedCompactionStrategy":
+                strategy_string = 
"strategy=UnifiedCompactionStrategy,max_sstables_to_compact=4"  # disable 
layout-preserving compaction which can leave more than one sstable
             else:
                 strategy_string = "strategy={}".format(strategy)
             min_bf_size = 100000
@@ -125,18 +127,21 @@ class TestCompaction(Tester):
         cluster = self.cluster
         cluster.populate(1).start()
         [node1] = cluster.nodelist()
+        logger.debug("Compaction: " + strategy_string)
 
         for x in range(0, 5):
             node1.stress(['write', 'n=100K', "no-warmup", "cl=ONE", "-rate",
                           "threads=300", "-schema", "replication(factor=1)",
                           
"compaction({},enabled=false)".format(strategy_string)])
             node1.flush()
+        logger.debug(node1.nodetool('tablestats keyspace1.standard1').stdout)
 
         node1.nodetool('enableautocompaction')
         node1.wait_for_compactions()
 
         table_name = 'standard1'
-        output = node1.nodetool('tablestats').stdout
+        output = node1.nodetool('tablestats keyspace1.standard1').stdout
+        logger.debug(output)
         output = output[output.find(table_name):]
         output = output[output.find("Bloom filter space used"):]
         bfSize = int(output[output.find(":") + 1:output.find("\n")].strip())
@@ -157,7 +162,12 @@ class TestCompaction(Tester):
 
         logger.debug("bloom filter size is: {}".format(bfSize))
         logger.debug("size factor = {}".format(size_factor))
-        assert bfSize >= size_factor * min_bf_size
+        # In the case where the number of sstables is greater than the number 
of directories, it's possible this to be
+        # both with unique keys (where the bf size will remain close to the 
unadjusted limit) or with repetitions
+        # of keys (where the bf size will be a multiple of the expected). 
Permit both by only using the size factor on
+        # the maximum size. Note that the test is designed to end up with 
size_factor == 1 and most runs do so, thus
+        # this is not a loosening of the test in the common case, only ensures 
that we don't end up with flakes.
+        assert bfSize >= min_bf_size
         assert bfSize <= size_factor * max_bf_size
 
     @pytest.mark.parametrize("strategy", strategies)
diff --git a/update-history/STAR-1892/11-2a2726a4 STAR-836 Fix 
TestCompaction_with_UnifiedCompactionStrategy.bloomfilter_size_test (#41) 
b/update-history/STAR-1892/11-2a2726a4 STAR-836 Fix 
TestCompaction_with_UnifiedCompactionStrategy.bloomfilter_size_test (#41)
new file mode 100644
index 00000000..c1e49627
--- /dev/null
+++ b/update-history/STAR-1892/11-2a2726a4 STAR-836 Fix 
TestCompaction_with_UnifiedCompactionStrategy.bloomfilter_size_test (#41)       
@@ -0,0 +1,36 @@
+--- a/compaction_test.py
++++ b/compaction_test.py
+@@ -134,18 +134,14 @@
+                           "threads=300", "-schema", "replication(factor=1)",
+                           
"compaction({},enabled=false)".format(strategy_string)])
+             node1.flush()
+-        logger.debug(node1.nodetool('cfstats keyspace1.standard1').stdout)
++        logger.debug(node1.nodetool('tablestats keyspace1.standard1').stdout)
+ 
+         node1.nodetool('enableautocompaction')
+         node1.wait_for_compactions()
+ 
+         table_name = 'standard1'
+-<<<<<<<
+-        output = node1.nodetool('cfstats keyspace1.standard1').stdout
++        output = node1.nodetool('tablestats keyspace1.standard1').stdout
+         logger.debug(output)
+-=======
+-        output = node1.nodetool('tablestats').stdout
+->>>>>>>
+         output = output[output.find(table_name):]
+         output = output[output.find("Bloom filter space used"):]
+         bfSize = int(output[output.find(":") + 1:output.find("\n")].strip())
+diff --git a/compaction_test.py b/compaction_test.py
+index fa924974..d79f1326 100644
+--- a/compaction_test.py
++++ b/compaction_test.py
+@@ -134,7 +134,7 @@ class TestCompaction(Tester):
+                           "threads=300", "-schema", "replication(factor=1)",
+                           
"compaction({},enabled=false)".format(strategy_string)])
+             node1.flush()
+-        logger.debug(node1.nodetool('cfstats keyspace1.standard1').stdout)
++        logger.debug(node1.nodetool('tablestats keyspace1.standard1').stdout)
+ 
+         node1.nodetool('enableautocompaction')
+         node1.wait_for_compactions()


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

Reply via email to