Skip to content

Add 'info' command for per-table backup size breakdown#1390

Open
minguyen9988 wants to merge 2 commits into
Altinity:masterfrom
minguyen9988:feature/info-command
Open

Add 'info' command for per-table backup size breakdown#1390
minguyen9988 wants to merge 2 commits into
Altinity:masterfrom
minguyen9988:feature/info-command

Conversation

@minguyen9988
Copy link
Copy Markdown
Contributor

@minguyen9988 minguyen9988 commented May 19, 2026

fix #1388

Summary

Add a new info CLI command that shows per-table size breakdown for local and remote backups.

Usage

clickhouse-backup info [-t, --tables=<db>.<table>] [-f, --format=<text|json|yaml|csv|tsv>] [all|local|remote] <backup_name>

Features

  • Shows per-table size, part count, and disk breakdown for any backup
  • Supports both local and remote backups (or both with all)
  • Multiple output formats: text (tabwriter), JSON, YAML, CSV, TSV
  • Table pattern filtering with glob wildcards (same syntax as other commands)
  • Totals row showing aggregate size and part count

Files changed

  • cmd/clickhouse-backup/main.go — Register the info command in the CLI (inserted before the download command)
  • pkg/backup/info.go — New file (401 lines) implementing Info(), infoLocal(), infoRemote(), filterTablesByPattern(), and printInfo()

Example output

Backup: my_backup (local)

TABLE              SIZE       PARTS   DISKS
-----              ----       -----   -----
mydb.events        1.2 GiB    42      default
mydb.logs          256 MiB    12      default
-----              ----       -----   -----
TOTAL (2 tables)   1.5 GiB    54

Adds a new info CLI command that shows per-table size breakdown for local and remote backups. Supports multiple output formats and table pattern filtering.

New files:
- pkg/backup/info.go: Implementation of the info command
- cmd/clickhouse-backup/main.go: Register info command in CLI
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26102200027

Warning

No base build found for commit 1a5b06b on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 62.097%

Details

  • Patch coverage: 298 uncovered changes across 2 files (0 of 298 lines covered, 0.0%).

Uncovered Changes

File Changed Covered %
pkg/backup/info.go 288 0 0.0%
cmd/clickhouse-backup/main.go 10 0 0.0%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 19927
Covered Lines: 12374
Line Coverage: 62.1%
Coverage Strength: 29691.39 hits per line

💛 - Coveralls

@minguyen9988
Copy link
Copy Markdown
Contributor Author

#1388

Copy link
Copy Markdown
Collaborator

@Slach Slach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have "tables" command which cover 80% of your implemented functions
look
clickhouse-backup tables --help

please modify exists code instead of implement duplicated functions

@Slach Slach added this to the 2.8.0 milestone May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: per-table backup size breakdown command

3 participants