Skip to content

fullhistory: build empty cold indexes for zero-key coverages (closes #826)#858

Merged
tamirms merged 1 commit into
feature/full-historyfrom
fix/fullhistory-826-empty-txhash-index
Jul 13, 2026
Merged

fullhistory: build empty cold indexes for zero-key coverages (closes #826)#858
tamirms merged 1 commit into
feature/full-historyfrom
fix/fullhistory-826-empty-txhash-index

Conversation

@tamirms

@tamirms tamirms commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #826. A window of only zero-transaction chunks stalled the full-history daemon: the txhash cold index build returned ErrEmptyBuildSet, so the coverage stayed freezing and the daemon re-planned the same window on every restart. streamhash now accepts zero-key builds (stellar/streamhash#12), so both cold stores build a real empty index for a zero-key coverage instead of special-casing it.

What changed

txhash (the stall). BuildColdIndex drops both ErrEmptyBuildSet returns and builds a valid empty index for a zero-key coverage (no inputs, or inputs that hold no entries). It skips the k-way merge when there is nothing to feed. buildTxhashIndex then commits normally, so an all-empty window freezes instead of re-planning every restart. Removed the TODO(#826) at resolveWindow.

events (fixing both stores consistently). The events store already tolerated empty chunks via a zero-length index.hash sentinel, so it was not stalling, but this migrates it off the sentinel so both stores handle empty identically. WriteColdIndex builds a real streamhash empty index over zero terms and writes a zero-record index.pack through the ordinary path; writeEmptyColdIndex is deleted, openMPHF always opens the file, and isEmpty() is NumKeys() == 0.

Testing

New TestBuildTxhashIndex_AllEmptyWindowFreezes proves the backfill flow (an all-empty window freezes rather than stalling), and the six tests that encoded ErrEmptyBuildSet or the zero-length sentinel were reworked to the real-empty-index behavior, including asserting the empty txhash index carries correct [minLedger, maxLedger] coverage metadata. All green: txhash, eventstore, backfill, lifecycle, and the full TestE2E_DaemonLifecycle. Build, vet, and gofmt clean. The change deletes more than it adds, since the sentinel and ErrEmptyBuildSet machinery is gone.

Two dependencies before this can merge

  1. streamhash feat: support zero-key (empty) indexes streamhash#12 must merge first. go.mod points streamhash at that PR's commit so this builds and tests now. Re-pin it to a merged commit on streamhash main before landing.
  2. The events half overlaps fullhistory: hardening + contract notes from the pre-existing-code review (closes #840) #847. It reworks openMPHF, isEmpty, and the cold-reader empty cross-check, which fullhistory: hardening + contract notes from the pre-existing-code review (closes #840) #847 also touches. Whichever lands second needs a rebase, so sequence the two deliberately.

🤖 Generated with Claude Code

@socket-security

socket-security Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​stellar/​streamhash@​v0.0.0-20260622155330-9e08e05c5fa6 ⏵ v0.0.0-20260713164615-c72a4e6f578d98 +1100100100100

View full report

@tamirms
tamirms force-pushed the fix/fullhistory-826-empty-txhash-index branch from d362b06 to b42b8d8 Compare July 13, 2026 14:12
Comment thread go.mod Outdated
github.com/spf13/pflag v1.0.5
github.com/stellar/go-stellar-sdk v0.6.1-0.20260618191317-308407eca8c6
github.com/stellar/streamhash v0.0.0-20260622155330-9e08e05c5fa6
github.com/stellar/streamhash v0.0.0-20260713140807-9f6eeb7acecf

@chowbao chowbao Jul 13, 2026

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.

TODO: bump when stellar/streamhash#12 (review) is merged (one possible change in the PR which would change the commit hash)

…826)

streamhash now accepts zero-key builds (stellar/streamhash#12), so the cold
stores no longer special-case an empty coverage.

txhash (the #826 stall): BuildColdIndex drops both ErrEmptyBuildSet returns and
builds a valid empty index for a zero-key coverage (no inputs, or inputs with no
entries — a window of only zero-transaction chunks). buildTxhashIndex then
commits normally, so an all-empty window freezes instead of re-planning every
restart. Removes the #826 TODO at resolveWindow.

events: drop the zero-length index.hash sentinel. WriteColdIndex builds a real
streamhash empty index over zero terms (deleting writeEmptyColdIndex); openMPHF
always opens it; isEmpty is NumKeys()==0. Both stores now handle empty
identically.

go.mod points streamhash at the unmerged PR #12 commit for development; re-pin to
a merged commit/tag before landing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tamirms
tamirms force-pushed the fix/fullhistory-826-empty-txhash-index branch from b42b8d8 to 7d344c5 Compare July 13, 2026 16:57
@tamirms

tamirms commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex[agent] review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@tamirms

tamirms commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@tamirms
tamirms merged commit 4fb8356 into feature/full-history Jul 13, 2026
9 of 16 checks passed
@tamirms
tamirms deleted the fix/fullhistory-826-empty-txhash-index branch July 13, 2026 17:13
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