Add optimized RPC ledger backends#561
Open
aditya1702 wants to merge 5 commits intoparallel-copy-insertsfrom
Open
Add optimized RPC ledger backends#561aditya1702 wants to merge 5 commits intoparallel-copy-insertsfrom
aditya1702 wants to merge 5 commits intoparallel-copy-insertsfrom
Conversation
Introduce an optimized RPC-based LedgerBackend for internal/ingest that targets wallet-backend's single-consumer access pattern. Adds optimizedRPCBackend with reduced synchronization, accumulated buffering, and tip tracking (avoids per-fetch GetHealth calls), plus comprehensive unit tests covering buffer hits/misses, retries, eviction, ranges, context cancellation and closing. Wire the new backend into newRPCLedgerBackend to use rpc.NewClient and newOptimizedRPCBackend, and update logging accordingly.
Detect RPC JSON-RPC "out of range" errors when fetching ledgers and treat them as beyond-latest conditions instead of returning a generic error. Adds isRPCOutOfRangeError (string-match on the server message) and uses it in getBufferedLedger to return a beyondLatestError, avoiding an extra GetHealth RPC round-trip on successful fetches. Also adds a unit test that simulates the RPC out-of-range response and verifies the backend retries and does not call GetHealth. Minor imports (strings, fmt) updated for these changes.
1ebaffc to
340b684
Compare
f1fe9cd to
dc0e663
Compare
Replace use of SDK BufferedStorageBackend with a new optimizedStorageBackend tailored for single-consumer ledger ingestion. The new backend (newOptimizedStorageBackend) moves decompression/XDR decode into worker goroutines, streams S3 reads through the decoder to avoid intermediate allocations, and removes unnecessary mutexes on the backend struct. Integration updates in ledger_backend.go call the new constructor and improve the startup log. A comprehensive test suite (storage_backend_test.go) was added to cover defaults, validation, sequential reads, cache hits, cross-file boundaries, re-preparation, close behavior, and worker retry semantics.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.