Skip to content

[r3.4] [3/3] cmd/utils: add --only-history flag to rm-state command (cherry-pick #20899)#21118

Merged
awskii merged 2 commits into
cherry-pick-20202-to-release-3.4from
cherry-pick-20899-to-release-3.4
May 11, 2026
Merged

[r3.4] [3/3] cmd/utils: add --only-history flag to rm-state command (cherry-pick #20899)#21118
awskii merged 2 commits into
cherry-pick-20202-to-release-3.4from
cherry-pick-20899-to-release-3.4

Conversation

@awskii

@awskii awskii commented May 11, 2026

Copy link
Copy Markdown
Member

Cherry-pick of #20899 to release/3.4.

Stacked on #21117 (cherry-pick of #20525). Merge order: 1/3 (#21116) → 2/3 (#21117) → this. Change base to release/3.4 after 2/3 lands.

awskii and others added 2 commits May 11, 2026 16:57
## Summary
- Show KEEP/REMOVE markers and file sizes on commitment files **before**
prompting (was shown after)
- Print `Datadir:` and `Step range:` header for context
- Pre-compute and display total file count and estimated deletion size
in prompt (`remove 38 files (~15.2GB)?`)
- Drop misleading `Total:` line that only summed commitment files

### Before
```
Snapshot dir: /erigon-data/hoodi-tmp/snapshots/domain

  v2.0-commitment.0-32.kv  Unwindable
  v2.0-commitment.32-48.kv  Unwindable
  v2.0-commitment.48-56.kv  Unwindable
  v2.0-commitment.56-60.kv  Unwindable

remove latest snapshot files (stepFrom>=56) and files ending at stepTo=60?
1) RemoveFile
4) Exit
 (pick number): 4
```

### After
```
Datadir: /erigon-data/hoodi-tmp
Step range: latest (stepFrom>=56)

  KEEP   v2.0-commitment.0-32.kv  (11.8GB)  Unwindable
  KEEP   v2.0-commitment.32-48.kv  (8.1GB)  Unwindable
  KEEP   v2.0-commitment.48-56.kv  (4.2GB)  Unwindable
  REMOVE v2.0-commitment.56-60.kv  (3.0GB)  Unwindable

remove 44 files (~9.7GB)?
1) RemoveFile
4) Exit
 (pick number):
```

(cherry picked from commit ef56c9b)
Adds `--only-history` (alias `--history`) to `erigon seg rm-state`.

When set, restricts deletion to history files (`SnapHistory` +
`SnapIdx`) only — leaving domain data (`.kv` files in `SnapDomain`,
accessor files) untouched.

Useful when combined with `--step from-to` to prune old history without
touching domain snapshots.

(cherry picked from commit e4ed80c)
Base automatically changed from cherry-pick-20525-to-release-3.4 to cherry-pick-20202-to-release-3.4 May 11, 2026 22:12
@awskii awskii merged commit dd00617 into cherry-pick-20202-to-release-3.4 May 11, 2026
6 checks passed
@awskii awskii deleted the cherry-pick-20899-to-release-3.4 branch May 11, 2026 22:12
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.

2 participants