scylladb / scylla-ccm

Cassandra Cluster Manager, modified for Scylla
Apache License 2.0
20 stars 64 forks source link

scylla_node: add ScyllaNode.dump_sstables() #484

Closed tchaikov closed 12 months ago

tchaikov commented 12 months ago

ScyllaNode.dump_sstables() is a wrapper around ScyllaNode.run_scylla_sstable(). it provides a more user friendly interface than the latter. it is introduced so that tests can use it with less pain when migrating from node.run_sstable2json() to node.run_scylla_sstable().

tchaikov commented 12 months ago

with the proposed change, we can have something like

diff --git a/compaction_test.py b/compaction_test.py
index 4b4059dd..53100bca 100644
--- a/compaction_test.py
+++ b/compaction_test.py
@@ -180,19 +180,10 @@ class TestCompaction(Tester):
         node.flush()
         node.compact()

-        sstable_dumps = node.run_scylla_sstable('dump-data', ['--merge'],
-                                                keyspace=self.KEYSPACE_NAME)
-        numfound = 0
-        jsoninfo = []
-        for stdout, _ in sstable_dumps.values():
-            partitions = json.loads(stdout)['sstables']['anonymous']
-            jsoninfo += partitions
-            for partition in partitions:
-                if 'tombstone' in partition:
-                    numfound += 1
-
+        partitions = node.dump_sstables(keyspace=self.KEYSPACE_NAME)
+        numfound = sum('tombstone' in partition for partition in partitions)
         logger.debug(f'Number of tombstones found on node {node.name}: {numfound}')
-        return numfound, jsoninfo
+        return numfound, partitions

     def _test_compaction_delete_tombstone_gc(self, tombstone_gc_mode='repair', node_num: int = 2,
                                              r_factor: int = None, delete_keys: bool = True, partition_num: int = 100):

after https://github.com/scylladb/scylla-dtest/pull/3351 lands

tchaikov commented 12 months ago

v2

tchaikov commented 12 months ago

v3: