Skip to content

migration code cleanup#3407

Merged
cody-littley merged 43 commits intomainfrom
cjl/migration-cleanup
May 11, 2026
Merged

migration code cleanup#3407
cody-littley merged 43 commits intomainfrom
cjl/migration-cleanup

Conversation

@cody-littley
Copy link
Copy Markdown
Contributor

@cody-littley cody-littley commented May 7, 2026

Describe your changes and provide context

This PR contains various minor cleanup work that I've accumulated in my migration feature branch. I'm opening a PR for this so that the actual migration business logic can be reviewed without noise from a bunch of minor changes.

The largest change in this PR is the removal of multi-threaded fanout within the router code. This introduced some race conditions, and was very much a premature optimization anyways. This also allowed for the ctx arguments to be removed from the router API.

Testing performed to validate your change

unit tests

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 8, 2026, 3:17 PM

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.16%. Comparing base (ab54587) to head (7694335).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
sei-db/state_db/sc/migration/router_builder.go 0.00% 2 Missing ⚠️
sei-db/state_db/sc/migration/migration_manager.go 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3407      +/-   ##
==========================================
+ Coverage   59.03%   59.16%   +0.13%     
==========================================
  Files        2105     2106       +1     
  Lines      173300   173989     +689     
==========================================
+ Hits       102312   102945     +633     
- Misses      62104    62121      +17     
- Partials     8884     8923      +39     
Flag Coverage Δ
sei-chain-pr 74.76% <88.46%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/common/keys/store_keys.go 100.00% <ø> (ø)
sei-db/state_db/sc/migration/migration_types.go 80.00% <ø> (ø)
sei-db/state_db/sc/migration/module_router.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/migration/router_kvstore.go 95.23% <100.00%> (ø)
sei-db/state_db/sc/migration/thread_safe_router.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/migration/migration_manager.go 95.48% <94.11%> (-0.77%) ⬇️
sei-db/state_db/sc/migration/router_builder.go 0.00% <0.00%> (ø)

... and 7 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.

newDone = true
}
// Write to the old DB first, then the new DB. If the old-DB write
// fails we do not touch the new DB; this gives the caller a clean
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

comment is cut off

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed comment

// contract that an old-DB write failure must prevent the new-DB write
// from being attempted. This is the partner correctness invariant to
// the "old DB first, then new DB" ordering: if the old-DB write blew
// up, we want a clean recovery point with the new DB still untouched
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what happens when the old db succeeds and new db fails

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The composite store layer is responsible for atomic updates between memIAVL and flatKV. When it starts up, it compares the version of each, and rolls one or the other back if they are not the same.

@cody-littley cody-littley added this pull request to the merge queue May 11, 2026
Merged via the queue into main with commit 2093c90 May 11, 2026
38 checks passed
@cody-littley cody-littley deleted the cjl/migration-cleanup branch May 11, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants