Skip to content

[CompactSealedState] T1: add SearchRootHashBackward to common WAL utilities - #8670

Draft
zhangchiqing wants to merge 1 commit into
masterfrom
leo/8665-t1-backwards-wal-scan
Draft

[CompactSealedState] T1: add SearchRootHashBackward to common WAL utilities#8670
zhangchiqing wants to merge 1 commit into
masterfrom
leo/8665-t1-backwards-wal-scan

Conversation

@zhangchiqing

@zhangchiqing zhangchiqing commented Aug 26, 2026

Copy link
Copy Markdown
Member

Part of #8665.

Extracts WAL root-hash search logic from find-trie-root into cmd/util/cmd/common/wal.go as exported SearchRootHashForward and SearchRootHashBackward functions. The backward variant iterates segments last-to-first (per-segment records still read forward), which is efficient when the target hash is near the end of the WAL.

Updates find-trie-root to use SearchRootHashBackward via the shared package. Adds unit tests covering single-segment, multi-segment, last-occurrence, bounded-range, and not-found cases.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Extracts WAL root-hash search logic from find-trie-root into
cmd/util/cmd/common/wal.go as exported SearchRootHashForward and
SearchRootHashBackward functions. The backward variant iterates
segments last-to-first (per-segment records still read forward),
which is efficient when the target hash is near the end of the WAL.

Updates find-trie-root to use SearchRootHashBackward via the shared
package. Adds unit tests covering single-segment, multi-segment,
last-occurrence, bounded-range, and not-found cases.

Part of #8665.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov-commenter

codecov-commenter commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.25000% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/util/cmd/common/wal.go 72.15% 11 Missing and 11 partials ⚠️
cmd/util/cmd/find-trie-root/cmd.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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