• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger / fabric-x-committer / 36715313134
91%
main: 91%

Build:
Build:
LAST BUILD BRANCH: clone-delete
DEFAULT BRANCH: main
Ran 30 Sep 2026 12:37PM UTC
Jobs 4
Files 143
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Sep 2026 12:31PM UTC coverage: 90.662%. First build
36715313134

Pull #826

github

cendhu
[cmd, statedb] Add committer delete-clone to drop a snapshot database clone

#### Type of change

- New feature
- Dependency update
- Documentation update

#### Description

- Adds `committer delete-clone --config <vc-config> --tx-id <snapshot-tx-id>`, which,
  like `init-db`, reads the VC config and works on the state database directly, so it
  can run while the committer is running. It drops the database named by the
  `_snapshot` record's `clone_database` field and clears that field, keeping the
  record so the snapshot's status and hash stay queryable.
- Deletion is refused unless the snapshot is `CHECKPOINTED` or `ABORTED`
  (`statedb.ErrSnapshotCloneInUse`), because only then will the clone never be hashed
  again. An empty or unknown `--tx-id` fails; a record whose `clone_database` is
  already empty succeeds for any status, so running the command again is a no-op.
- The logic lives in `statedb.DeleteSnapshotClone`. `adminExec` moves from
  `service/vc` to `statedb.AdminExec`, so snapshot creation and deletion share the
  maintenance-database connection.
- Adds `ClearCloneDatabase` to `statedb.SnapshotUpdate`. The clear keeps the locked
  row's error text and requires the locked row to still have the status the command
  checked, so a concurrent writer is neither overwritten nor bypassed.
- Adds `statedb.SnapshotStateManager.Read(tx_id)` and the `statedb.ErrSnapshotNotFound`
  sentinel, sharing `ReadLatest`'s read-and-decode step.
- Bumps fabric-x-common to `38584e4` for the `ABORTED` snapshot status.

#### Additional details (Optional)

The drop and the record update cannot be one atomic transaction, because PostgreSQL
does not allow `DROP DATABASE` inside a transaction. They are ordered drop-then-clear:
a stop between them leaves the record naming a missing database, and running the
command again finishes (`DROP DATABASE IF EXISTS` is a no-op, then the clear runs). The
reverse order could leave an orphan database that no record names.

The si... (continued)
Pull Request #826: [cmd, statedb] Add committer delete-clone to drop a snapshot database clone

103 of 118 new or added lines in 4 files covered. (87.29%)

9835 of 10848 relevant lines covered (90.66%)

11350.49 hits per line

Uncovered Changes

Lines Coverage ∆ File
12
79.31
utils/statedb/snapshot_clone.go
2
93.1
cmd/committer/delete_clone_cmd.go
1
77.05
utils/statedb/snapshot_state.go
Jobs
ID Job ID Ran Files Coverage
1 unit-test - 36715313134.1 30 Sep 2026 12:59PM UTC 95
86.17
GitHub Action Run
2 core-db-test - 36715313134.2 30 Sep 2026 12:41PM UTC 109
48.7
GitHub Action Run
3 db-test - 36715313134.3 30 Sep 2026 12:37PM UTC 143
78.54
GitHub Action Run
4 core-db-test - 36715313134.4 30 Sep 2026 12:41PM UTC 109
48.7
GitHub Action Run
Source Files on build 36715313134
  • Tree
  • List 143
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #826
  • PR Base - main (#36705432257)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc