How deep-bi/starrocks-backup-and-restore works
StarRocks Backup & Restore is a CLI tool for full and incremental backups, restore-chain selection, and backup retention management. The user configures a StarRocks connection and inventory groups, initializes the ops metadata schema, then invokes backup, restore, or prune commands. For backups, the CLI coordinates partition planning, concurrency control, and StarRocks job execution; restore resolves the requested backup chain and performs a temporary-table restore with atomic rename. The graph reflects README capabilities and shown imports/calls; some module internals were not sampled, so unverified relationships are omitted.
Main entry points: cli.py Command interface · db.py Database client · restore.py Restore planner and executor · executor.py Backup executor
Components 20
CLI and setup
- Command interface
src/starrocks_br/cli.py - Configuration
src/starrocks_br/config.py - Database client
src/starrocks_br/db.py - Repository check
src/starrocks_br/repository.py - Ops schema
src/starrocks_br/schema.py - Backup retention
src/starrocks_br/prune.py - Cluster health
src/starrocks_br/health.py
Backup workflow
- Partition planner
src/starrocks_br/planner.py - Backup executor
src/starrocks_br/executor.py - Backup labels
src/starrocks_br/labels.py
Restore workflow
- Restore planner and executor
src/starrocks_br/restore.py
Metadata and operations
- Job concurrency
src/starrocks_br/concurrency.py - Operation history
src/starrocks_br/history.py - Ops metadata
Shared internals
- Error reporting
src/starrocks_br/error_handler.py - Domain exceptions
src/starrocks_br/exceptions.py - Timezone handling
src/starrocks_br/timezone.py - Logging
src/starrocks_br/logger.py
Other components
- Operator
- StarRocks cluster
Connections 32
- Operator → Command interface: runs commands
README.md - Command interface → Configuration: loads settings
src/starrocks_br/cli.py - Command interface → Database client: opens connection
src/starrocks_br/cli.py - Command interface → Repository check: validates repository
src/starrocks_br/cli.py - Command interface → Ops schema: initializes schema
src/starrocks_br/cli.py - Command interface → Partition planner: plans backup
src/starrocks_br/cli.py - Command interface → Backup executor: runs backup
src/starrocks_br/cli.py - Command interface → Restore planner and executor: starts restore
src/starrocks_br/cli.py - Command interface → Backup retention: runs retention
src/starrocks_br/cli.py - Command interface → Cluster health: checks health
src/starrocks_br/cli.py - Command interface → Job concurrency: coordinates jobs
src/starrocks_br/cli.py - Command interface → Error reporting: formats failures
src/starrocks_br/cli.py - Repository check → Database client: queries repository
src/starrocks_br/repository.py - Ops schema → Database client: creates schema
README.md - Database client → StarRocks cluster: executes SQL
- Partition planner → Database client: reads partitions
src/starrocks_br/planner.py - Partition planner → Timezone handling: uses time parsing
src/starrocks_br/planner.py - Backup executor → Database client: submits backup
src/starrocks_br/executor.py - Backup executor → Job concurrency: uses job slots
src/starrocks_br/executor.py - Backup executor → Operation history: logs outcomes
src/starrocks_br/executor.py - Restore planner and executor → Database client: queries and restores
src/starrocks_br/restore.py - Restore planner and executor → Job concurrency: uses job slots
src/starrocks_br/restore.py - Restore planner and executor → Operation history: logs outcomes
src/starrocks_br/restore.py - Restore planner and executor → Timezone handling: uses time parsing
src/starrocks_br/restore.py - Job concurrency → Ops metadata: tracks active jobs
src/starrocks_br/concurrency.py - Operation history → Ops metadata: records operations
src/starrocks_br/history.py - Ops schema → Ops metadata: creates metadata store
README.md - Command interface → Backup labels: generates labels
src/starrocks_br/cli.py - Command interface → Domain exceptions: handles domain errors
src/starrocks_br/cli.py - Backup executor → Logging: reports progress
src/starrocks_br/executor.py - Restore planner and executor → Logging: reports progress
src/starrocks_br/restore.py - Error reporting → Configuration: reads ops settings
src/starrocks_br/error_handler.py