Skip to content

feat: turn snapshot prune async#2809

Open
blindchaser wants to merge 3 commits intorelease/v6.3from
yiren/v631-prune-fix
Open

feat: turn snapshot prune async#2809
blindchaser wants to merge 3 commits intorelease/v6.3from
yiren/v631-prune-fix

Conversation

@blindchaser
Copy link
Contributor

Describe your changes and provide context

Testing performed to validate your change

@blindchaser blindchaser changed the title feat: make prune async feat: turn snapshot prune async Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 5, 2026, 5:34 PM

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 660b2c9d25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.15%. Comparing base (c68f987) to head (10c7ff4).

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release/v6.3    #2809      +/-   ##
================================================
+ Coverage         45.17%   46.15%   +0.98%     
================================================
  Files               853     1144     +291     
  Lines             70076    98227   +28151     
================================================
+ Hits              31654    45336   +13682     
- Misses            35760    49001   +13241     
- Partials           2662     3890    +1228     
Flag Coverage Δ
sei-chain 42.56% <ø> (+0.04%) ⬆️
sei-db 69.13% <ø> (+24.27%) ⬆️
sei-ibc-go 55.96% <ø> (ø)
sei-tendermint 47.54% <ø> (?)
sei-wasmd 41.57% <ø> (+0.01%) ⬆️
sei-wasmvm 39.88% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 405 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

snapshotWriterPool *pond.WorkerPool

// closed indicates the DB is shutting down
closed uint32
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this to pruningInProgress?

}
defer db.pruningInProgress.Store(false)

startTime := time.Now()

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
Copy link
Collaborator

@masih masih left a comment

Choose a reason for hiding this comment

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

As is this is fine to test the theories discussed in the sync.But for a deeper fix i would like to understand the edge cases this change rises.

db.pruneSnapshotLock.Lock()
defer db.pruneSnapshotLock.Unlock()
// CAS: only one prune can run at a time
if !db.pruningInProgress.CompareAndSwap(false, true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if a prune takes just long enough to overlap with the next prune?
In that case the new prune cycle will be skipped and we end up with 2 cycles of unpruned state in the next prune

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, looking into the code. we will need to optimize some pruning logic and where/when pruning happens. creating a ticket for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Each prune should prune all snapshots that need to be pruned, not just delete one snapshot. We also should make the pruning logic to be triggered after each commit, instead of only after snapshot creation

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.

4 participants