Problem
The system-schema filter in the active-shards command has a bug that prevents proper exclusion of system tables under the gc schema.
Current Code (Line ~319-330 in cratedb_toolkit/admin/xmover/cli.py)
if exclude_system:
snapshots = [
s
for s in snapshots
if not (
s.schema_name.startswith("gc.") # ❌ This won't match "gc" schema
or s.schema_name == "information_schema"
or s.schema_name == "sys"
or s.table_name.endswith("_events")
or s.table_name.endswith("_log")
)
]
Issue
s.schema_name.startswith("gc.") looks for schemas starting with "gc." (with dot), but the actual schema name is "gc" (without dot). This means:
"gc".startswith("gc.") returns False
- System tables under the
gc schema won't be excluded as intended
Evidence
From test file tests/admin/test_active_shard_monitor.py:
self.create_test_snapshot("gc", "scheduled_jobs_log", 0, "data-hot-8", True, 15876, 100.0)
The help text also suggests this intent:
@click.option("--exclude-system", is_flag=True, help="Exclude system tables (gc.*, information_schema.*)")
Suggested Fix
if exclude_system:
system_schemas = {"gc", "information_schema", "sys"}
snapshots = [
s for s in snapshots
if s.schema_name not in system_schemas
and not (s.table_name.endswith("_events") or s.table_name.endswith("_log"))
]
Or if there are indeed sub-schemas under gc:
if exclude_system:
snapshots = [
s for s in snapshots
if not (
(s.schema_name == "gc" or s.schema_name.startswith("gc."))
or s.schema_name == "information_schema"
or s.schema_name == "sys"
or s.table_name.endswith("_events")
or s.table_name.endswith("_log")
)
]
Backlinks
Please review and confirm the expected behavior for system schema filtering.
Problem
The system-schema filter in the
active-shardscommand has a bug that prevents proper exclusion of system tables under thegcschema.Current Code (Line ~319-330 in cratedb_toolkit/admin/xmover/cli.py)
Issue
s.schema_name.startswith("gc.")looks for schemas starting with "gc." (with dot), but the actual schema name is"gc"(without dot). This means:"gc".startswith("gc.")returnsFalsegcschema won't be excluded as intendedEvidence
From test file
tests/admin/test_active_shard_monitor.py:The help text also suggests this intent:
@click.option("--exclude-system", is_flag=True, help="Exclude system tables (gc.*, information_schema.*)")Suggested Fix
Or if there are indeed sub-schemas under gc:
Backlinks
Please review and confirm the expected behavior for system schema filtering.