-
Notifications
You must be signed in to change notification settings - Fork 61
Streaming daemon: Phase 2 — hot store, lifecycle + live ingestion (closes #816, #808) #820
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
Open
chowbao
wants to merge
55
commits into
feature/full-history
Choose a base branch
from
streaming-phase2-lifecycle
base: feature/full-history
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,385
−2,627
Open
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
fa93cb1
streaming(fullhistory): Phase 2 layer 1 — hot store + lifecycle (#816)
chowbao 7e687c1
fullhistory: rename ingest.go -> hotloop.go to disambiguate from inge…
chowbao 96d0e44
fullhistory: drop gratuitous comment churn in untouched sections
chowbao b61181a
fullhistory: drop redundant pkg-name prefix from PR-added error messages
chowbao a0b068c
streaming(fullhistory): Phase 2 layer 2 — live ingestion + daemon wir…
chowbao 4d19700
fullhistory/ingest: fix stale comments describing the deleted HotServ…
chowbao cfca87a
fullhistory/observability: drop cold_tier_bytes + per-ledger LedgerCo…
chowbao f8c8cec
fullhistory: /simplify pass on the layer-2 test code
chowbao 5b497b3
fullhistory: align prose to the design's vocabulary (backfill, last-c…
chowbao c2471fc
fullhistory: rename functions to the design doc's names
chowbao f1d602a
fullhistory: run captive core for live ingestion via ledgerbackend (#…
chowbao 4a4e037
fullhistory: source captive-core config from the captive_core_config …
chowbao a07c973
Align hot ingestion with always-on hot tier
chowbao 5cabb45
Recover hot progress from WAL on startup
chowbao 27aae30
fullhistory: seed events contiguity in boundary test for always-on ho…
chowbao 5112430
fullhistory: align hot txhash tier + index catalog key to design #787
chowbao 9ea3b4c
fullhistory: fix golangci-lint failures
chowbao a5bf892
fullhistory: drop redundant "streaming:" prefix from PR-introduced fa…
chowbao 0c993a8
fullhistory: make hot DB a required HotService dependency
chowbao cb99138
fullhistory: /simplify cleanups (reuse + dead-param + boundary dedup)
chowbao 4c16406
stores: drop standalone hot-store open paths; wrap-only over shared p…
chowbao 4481062
txhash: collapse vestigial Tuning()/tuning() split into one func
chowbao 270bf50
Remove live catalog test seam
chowbao ce675b7
e2e_test: drop unused cyclop nolint directive
chowbao 5a96d9c
fullhistory: drop orphaned self-committing hot writes + eventPayloads…
chowbao a298fec
fullhistory: clear lint fallout + finish the ReadOnly WAL comment sweep
chowbao e701785
fullhistory: address PR #820 review — concrete fixes
chowbao a694d8c
fullhistory/eventstore: delete NextEventID (test-only duplicate of Ev…
chowbao 86285e3
fullhistory: hot-DB failure policy — no auto-create, loss is restarta…
chowbao 893cc80
hotchunk: move hotLedgerStream in, add DB.Source() (#22 prep)
chowbao e0be578
fullhistory: delete HotProbe seam — backfill/watermark open hot DBs b…
chowbao 4ad32fb
fullhistory: ingestion-loop rework — raw stream in, atomic cell out (…
chowbao e13fb21
fullhistory/stores: delete unreachable hot-write-path guards + events…
chowbao 26f81df
fullhistory/lifecycle: delete the two dead plan-range clamps (#25)
chowbao cf6fe62
fullhistory: lifecycle returns error, joined with ingestion via errgr…
chowbao c6d018c
fullhistory/ingest: emit per-ingester ColdIngest off the Close path (…
chowbao 4ff5e5b
fullhistory,events: halve hot per-ledger extraction to one walk (#18 …
chowbao f360ad4
fullhistory: unify the frozen-index coverage predicate (#37)
chowbao 049db0e
fullhistory: make geometry.Layout the only cold-path derivation (#36)
chowbao f981593
fullhistory/ingest: batch-scope hot metric attribution (#18 part 2)
chowbao ec7697e
fullhistory: errgroup.WithContext + ingestion owns its first chunk (#…
chowbao 6df6ad8
fullhistory/ingest: hot per-ledger phase timings (#18 amendment)
chowbao 73f95dc
fullhistory: round-3 review polish — dead code, metric name, stale docs
chowbao c2d5cc9
fullhistory/catalog: test DiscardHotChunk crash-resume + absent-key n…
chowbao 44d4faa
fullhistory: trim over-narrated comments (#3516018538)
chowbao 6ebcc02
fullhistory: guard the errgroup no-hang invariant in run()
chowbao e6de0f9
fullhistory: fix golangci-lint findings on the review-round changes
chowbao 10a7caf
fullhistory: fix 3 follow-on golangci findings (unparam + unused noli…
chowbao d2b1c12
fullhistory: lifecycle tick cleanups + gauge correctness (round-4 rev…
chowbao 3cb0e7d
fullhistory/ingest,stores: delete dead seams (round-4 review)
chowbao 11ed6fa
fullhistory: missing test pins + stale doc/comment fixes (round-4 rev…
chowbao 44d66ae
fullhistory/ingest,hotchunk: unify hot metrics into one phase-keyed f…
chowbao 79704d4
fullhistory: delete SeqValidatedCursor, enforce in-order at the sourc…
chowbao 3dcd691
fullhistory: partial-duration on failed hot phase + restore lifecycle…
chowbao e7eb46d
fullhistory: open resume hot DB before serving reads (#3517545236, pa…
chowbao 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
85 changes: 85 additions & 0 deletions
85
cmd/stellar-rpc/internal/fullhistory/backfill/hotsource_test.go
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,85 @@ | ||
| package backfill | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/fullhistory/catalog" | ||
| "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/fullhistory/pkg/chunk" | ||
| "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/fullhistory/pkg/rocksdb" | ||
| "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/fullhistory/pkg/stores/hotchunk" | ||
| "github.com/stellar/stellar-rpc/cmd/stellar-rpc/internal/fullhistory/pkg/stores/ledger" | ||
| ) | ||
|
|
||
| // seedReadyHotChunk brackets a "ready" hot DB for c (transient -> create -> ready) | ||
| // and commits ONE ledgers-CF entry at seq `top` so MaxCommittedSeq reads back | ||
| // `top`. It writes just the ledgers CF (the only CF the completeness gate reads) | ||
| // and closes the store — hygiene, not a lock requirement: a read-only open takes | ||
| // no RocksDB LOCK and would succeed against a writer-held DB too. The daemon opens | ||
| // this exact on-disk DB by its Layout path. | ||
| func seedReadyHotChunk(t *testing.T, cat *catalog.Catalog, c chunk.ID, top uint32) { | ||
| t.Helper() | ||
| require.NoError(t, cat.PutHotTransient(c)) | ||
| store, err := rocksdb.New(rocksdb.Config{ | ||
| Path: cat.Layout().HotChunkPath(c), | ||
| ColumnFamilies: hotchunk.ColumnFamilies(), | ||
| Logger: silentLogger(), | ||
| }) | ||
| require.NoError(t, err) | ||
| h := ledger.NewWithStore(store) | ||
| require.NoError(t, store.Batch(func(b *rocksdb.BatchWriter) error { | ||
| return h.AddLedgerToBatch(b, ledger.Entry{Seq: top, Bytes: []byte("ledger")}) | ||
| })) | ||
| require.NoError(t, store.Close()) | ||
| require.NoError(t, cat.FlipHotReady(c)) | ||
| } | ||
|
|
||
| // TestBackfillSource_HotComplete: a "ready" hot DB whose committed frontier | ||
| // reaches the chunk's last ledger IS the source — backfillSource returns it with | ||
| // NO backend configured, so success alone proves the hot branch was taken. | ||
| func TestBackfillSource_HotComplete(t *testing.T) { | ||
| cat, _ := testCatalog(t) | ||
| cfg := testProcessConfig(t, cat) // no Backend | ||
|
|
||
| c := chunk.ID(0) | ||
| seedReadyHotChunk(t, cat, c, c.LastLedger()) // complete: maxSeq == last ledger | ||
|
|
||
| src, closeSrc, err := backfillSource(context.Background(), c, catalog.AllArtifacts(), cfg) | ||
| require.NoError(t, err, "complete hot tier is used; no bulk backend needed") | ||
| require.NotNil(t, src) | ||
| require.NoError(t, closeSrc()) | ||
| } | ||
|
|
||
| // TestBackfillSource_HotIncompleteFallsThrough: a "ready" but incomplete hot DB is | ||
| // staleness — backfillSource falls past it. With no pack and no backend, that | ||
| // fall-through surfaces as the "no bulk backend" error (not a hot-tier error). | ||
| func TestBackfillSource_HotIncompleteFallsThrough(t *testing.T) { | ||
| cat, _ := testCatalog(t) | ||
| cfg := testProcessConfig(t, cat) // no Backend, no frozen pack | ||
|
|
||
| c := chunk.ID(0) | ||
| seedReadyHotChunk(t, cat, c, c.FirstLedger()) // incomplete: maxSeq < last ledger | ||
|
|
||
| _, _, err := backfillSource(context.Background(), c, catalog.AllArtifacts(), cfg) | ||
| require.Error(t, err) | ||
| require.Contains(t, err.Error(), "no bulk backend", | ||
| "an incomplete hot tier falls through; it is not itself an error") | ||
| } | ||
|
|
||
| // TestBackfillSource_HotReadyButDirMissing: a "ready" key whose hot DB won't open | ||
| // (dir gone) is an ordinary restartable error — the read-only open never | ||
| // auto-heals it into a fresh empty DB. | ||
| func TestBackfillSource_HotReadyButDirMissing(t *testing.T) { | ||
| cat, _ := testCatalog(t) | ||
| cfg := testProcessConfig(t, cat) | ||
|
|
||
| c := chunk.ID(0) | ||
| require.NoError(t, cat.PutHotTransient(c)) | ||
| require.NoError(t, cat.FlipHotReady(c)) // ready key, NO dir on disk | ||
|
|
||
| _, _, err := backfillSource(context.Background(), c, catalog.AllArtifacts(), cfg) | ||
| require.Error(t, err) | ||
| require.Contains(t, err.Error(), "won't open") | ||
| } |
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
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.
Design-doc traceability for #787: resolving the source before marking
freezingkeeps theprocessChunkone-write protocol safe: source/coverage errors do not leave freezing debris, and the subsequent mark -> write -> fsync barrier -> frozen flip below is the protocol from the design. Seefull-history-streaming-workflow.mdlines 195-206 and theprocessChunkprimitive at lines 271-302.