-
Notifications
You must be signed in to change notification settings - Fork 217
[Storehouse] 010 Util convert v6 -> v7 checkpoint #8583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5cdc459
add convert_stream
zhangchiqing f8e86c4
remove temp files
zhangchiqing d29170c
remove verify leaf hash flag
zhangchiqing 31a24bf
fix lint
zhangchiqing 7ae5e71
address review comments: version-aware latest-checkpoint path, partia…
zhangchiqing b1fcc04
fix tidy by applying go fix loop rewrites
Copilot 52843e0
address review: pin stale-temp globs and remove exact output paths on…
zhangchiqing 4f72654
address review: bound V6 leaf payload length by part file size
zhangchiqing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package wal | ||
|
|
||
| import ( | ||
| "os" | ||
| "path" | ||
| "testing" | ||
|
|
||
| "github.com/rs/zerolog" | ||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/onflow/flow-go/utils/unittest" | ||
| ) | ||
|
|
||
| // TestRemoveStaleTempFiles verifies that removeStaleTempFiles deletes only the | ||
| // "writing-<outputFile>*" temp files for the given output, while leaving final | ||
| // part files, the header, and temp files belonging to other outputs untouched. | ||
| func TestRemoveStaleTempFiles(t *testing.T) { | ||
| unittest.RunWithTempDir(t, func(dir string) { | ||
| outputFile := "root.checkpoint.v7" | ||
|
|
||
| // Stale temp files for outputFile: subtries, top-trie, and header. | ||
| // These mirror the names produced by createClosableWriter | ||
| // ("writing-<fileName>-<random>"). | ||
| staleTempFiles := []string{ | ||
| "writing-root.checkpoint.v7.000-1234567890", | ||
| "writing-root.checkpoint.v7.000-9876543210", // a second orphan for the same part | ||
| "writing-root.checkpoint.v7.016-1720029787", // top-trie part | ||
| "writing-root.checkpoint.v7-246069680", // header | ||
| } | ||
|
|
||
| // Files that must NOT be removed: final part files, the header, a temp file | ||
| // for a different output (e.g. a V6 checkpoint with a different name), and a | ||
| // temp file for a different V7 output whose name starts with outputFile. | ||
| keepFiles := []string{ | ||
| "root.checkpoint.v7", // final header | ||
| "root.checkpoint.v7.000", // final subtrie part | ||
| "root.checkpoint.v7.016", // final top-trie part | ||
| "writing-root.checkpoint.v6.000-111222333", // temp for a different output | ||
| "root.checkpoint.v6", // unrelated final file | ||
| // temp for a different V7 output that shares outputFile's prefix | ||
| "writing-root.checkpoint.v7.00000100.v7-5150", | ||
| } | ||
|
|
||
| for _, name := range append(append([]string{}, staleTempFiles...), keepFiles...) { | ||
| require.NoError(t, os.WriteFile(path.Join(dir, name), []byte("x"), 0644)) | ||
| } | ||
|
|
||
| require.NoError(t, removeStaleTempFiles(dir, outputFile, zerolog.Nop())) | ||
|
|
||
| for _, name := range staleTempFiles { | ||
| require.NoFileExists(t, path.Join(dir, name), "stale temp file should have been removed: %s", name) | ||
| } | ||
| for _, name := range keepFiles { | ||
| require.FileExists(t, path.Join(dir, name), "file should have been kept: %s", name) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| // TestRemoveStaleTempFiles_NoMatches verifies that removeStaleTempFiles is a | ||
| // no-op (no error) when there are no matching temp files. | ||
| func TestRemoveStaleTempFiles_NoMatches(t *testing.T) { | ||
| unittest.RunWithTempDir(t, func(dir string) { | ||
| require.NoError(t, os.WriteFile(path.Join(dir, "root.checkpoint.v7.000"), []byte("x"), 0644)) | ||
|
|
||
| require.NoError(t, removeStaleTempFiles(dir, "root.checkpoint.v7", zerolog.Nop())) | ||
|
|
||
| require.FileExists(t, path.Join(dir, "root.checkpoint.v7.000")) | ||
| }) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Enable streaming for payloadless bootstrap.
Passing
falseselects the full-forest conversion path. This leaves the first payloadless bootstrap exposed to the documented mainnet-scale memory spike and possible OOM failure. Passtruehere so this production bootstrap uses the new bounded-memory conversion path.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents