mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-28 20:27:03 +00:00
test/cluster/dtest: add ScyllaCluster.compact() method
Add compact() method to ScyllaCluster, delegating to ScyllaNode.compact() on each running node. Accepts optional keyspace and tables parameters to allow scoping compaction to specific keyspaces/tables. Also fix ScyllaNode.compact() to use list[str] for tables parameter and extend() instead of +=, so that passing a single table name as a string does not iterate over its characters.
This commit is contained in:
@@ -227,6 +227,11 @@ class ScyllaCluster:
|
||||
def flush(self) -> None:
|
||||
self.nodetool("flush")
|
||||
|
||||
def compact(self, keyspace: str = "", tables: list[str] | None = None) -> None:
|
||||
for node in self.nodelist():
|
||||
if node.is_running():
|
||||
node.compact(keyspace=keyspace, tables=tables)
|
||||
|
||||
@staticmethod
|
||||
def debug(message: str) -> None:
|
||||
logger.debug(message)
|
||||
|
||||
@@ -647,11 +647,12 @@ class ScyllaNode:
|
||||
cmd.append(table)
|
||||
self.nodetool(" ".join(cmd), **kwargs)
|
||||
|
||||
def compact(self, keyspace: str = "", tables: str | None = ()) -> None:
|
||||
def compact(self, keyspace: str = "", tables: list[str] | None = None) -> None:
|
||||
compact_cmd = ["compact"]
|
||||
if keyspace:
|
||||
compact_cmd.append(keyspace)
|
||||
compact_cmd += tables
|
||||
if tables:
|
||||
compact_cmd.extend(tables)
|
||||
self.nodetool(" ".join(compact_cmd))
|
||||
|
||||
def drain(self, block_on_log: bool = False) -> None:
|
||||
|
||||
Reference in New Issue
Block a user