-
Notifications
You must be signed in to change notification settings - Fork 28
Optimize embedded db memory and disk #281
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe change set replaces several poller and committer flags/configs, adds Pebble-based storage and buffering components, removes block-failure data structures and persistence from multiple backends, adjusts orchestrator control flow (validator creation, committer stop condition), reworks poller concurrency (queued/processing states with wait channels), introduces new ClickHouse ingest tables/materialized views, and updates dependencies. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Orchestrator
participant Committer
participant Validator
participant Poller
participant Staging as Storage (Pebble)
participant RPC
Orchestrator->>Committer: NewCommitter(rpc, storage, poller)
Note over Committer: Constructs Validator internally
Committer->>Validator: NewValidator(rpc, storage, worker)
Orchestrator->>Committer: Start(ctx)
loop Commit Loop
Committer->>Poller: Request blocks (range)
alt Available in staging
Poller-->>Committer: Blocks
else Processing in-flight
Poller-->>Committer: waitForRange then fetch
else No new blocks
Poller-->>Committer: nil
end
Committer->>Validator: EnsureValidBlocks(ctx, blocks)
alt Some invalid
Validator->>RPC: Re-fetch invalid block numbers
RPC-->>Validator: Raw blocks
Validator-->>Committer: Validated blocks (combined)
else All valid
Validator-->>Committer: Blocks
end
Committer->>Staging: Commit/publish logic
Committer->>Staging: cleanupProcessedStagingBlocks(ctx)
alt Reached toBlock
Committer-->>Orchestrator: stop
end
end
sequenceDiagram
autonumber
participant Client as Poll Requester
participant Poller
participant Queue as queuedRanges
participant Proc as processingRanges
participant Staging as Storage (Pebble)
Client->>Poller: Request(chain, start..end)
alt Range fully staged
Poller->>Staging: Fetch range
Staging-->>Poller: Data
Poller-->>Client: Data
else Range being processed
Poller->>Proc: waitForRange(key)
Proc-->>Poller: notify on completion
Poller->>Staging: Fetch range (if present)
Poller-->>Client: Data or nil
else Range not queued/processing
Poller->>Queue: markQueued(key)
Poller->>Poller: enqueue work
Note over Poller: On worker start:<br/>unmarkQueued → markProcessing<br/>on finish: notify waiters
Poller-->>Client: ErrBlocksProcessing (caller retries)
end
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (19)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary by CodeRabbit