[Feature] Add an offline tool to backfill historical SectionBloom data
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #6973 di @317787106 — integrata
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 38/100
Direzione di ricerca
Start with PR #6390 and the existing SectionBloomStore logic, then trace how Toolkit commands access transactionRetStore, properties, and the section-bloom database. Confirm the command's range, concurrency, validation, idempotency, progress, summary, and failure behavior against the issue's requirements, with tests covering the listed cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add an offline Toolkit command to rebuild historical SectionBloom data in the section-bloom database from existing records in transactionRetStore. This allows node operators to restore historical log filtering without resyncing the node or replaying the blockchain.
Problem
Motivation
SectionBloom data allows eth_getLogs to quickly identify blocks that may contain logs matching a contract address or topic using Bloom filters.
Current State
In v4.8.0 and earlier, SectionBloom data was not generated for blocks processed while node.jsonrpc.httpFullNodeEnable was disabled. In v4.8.1 and later, this setting no longer controls SectionBloom generation, and the data is always written for newly processed blocks.
Enabling the option later, or upgrading to a version that always writes SectionBloom data, does not repair missing historical data. As a result, eth_getLogs queries that filter historical ranges by address or topics may fail to find all matching logs.
Limitations or Risks
There is currently no offline tool for rebuilding this data from the local database. Operators may therefore need to resync the node or replay historical blocks, even when the required transaction results are already available in transactionRetStore.
Proposed Solution
Proposed Design
Add the following command to Toolkit:
java -jar Toolkit.jar db backfill-bloom
The command should read historical transaction results from transactionRetStore, calculate block Bloom filters using the same logic as SectionBloomStore, and create or update the corresponding records in the section-bloom database.
Expected usage:
java -jar Toolkit.jar db backfill-bloom \
[-d <databaseDirectory>] \
[-s <startBlock>] \
[-e <endBlock>] \
[-c <maxConcurrency>]
| Option | Description | Default |
|---|---|---|
-d |
Database directory. | output-directory/database |
-s, --start-block |
First block to process, inclusive. | Earliest non-zero block available in transactionRetStore. |
-e, --end-block |
Last block to process, inclusive. | Latest solidified block recorded in the properties database. |
-c, --max-concurrency |
Maximum processing concurrency. | 8 |
Values outside the available block range should be adjusted to the actual database boundaries.
The command should process data by Section, with each Section containing 2,048 blocks. Actual concurrency should not exceed the number of Sections being processed.
The operation should be idempotent so that the same block range can be safely processed again after an interruption. Existing SectionBloom bits should be preserved when records are updated.
Progress and Summary
For long-running backfills, the command should display terminal progress and periodically write progress information to toolkit.log.
The final summary should include:
- Number of scanned blocks.
- Number of successfully processed blocks.
- Number of blocks containing logs.
- Number of errors.
- Number of Bloom writes.
- Elapsed time.
- Processing rate.
- Concurrency used.
Validation and Testing
The implementation should validate the database directory, required databases, block range, and concurrency value.
Unit tests should cover:
- Parameter validation.
- Automatic range detection and adjustment.
- Missing or invalid databases.
- Processing failures.
- Progress and summary output.
- Help output.
- Safe reprocessing of the same block range.
Key Changes
- Toolkit: Add the
db backfill-bloomoffline maintenance command. - Database access: Read historical transaction results from
transactionRetStoreand the latest solidified block fromproperties; create or update derived Bloom records insection-bloom. - Configuration and APIs: Existing node configuration and JSON-RPC APIs remain unchanged.
Operational Requirements and Risks
The FullNode and any other process accessing the database must be stopped before running the command because the database requires exclusive access. Multiple backfill processes must not operate on the same database concurrently.
The target blocks must have been processed while storage.transHistory.switch was enabled. Otherwise, transactionRetStore will not contain the historical transaction results required to rebuild SectionBloom data.
The backfill may generate significant disk I/O and CPU load when processing large block ranges. Operators should adjust concurrency according to their storage hardware and monitor disk latency and CPU usage during execution.
Impact
After the missing SectionBloom data is rebuilt, eth_getLogs can correctly filter the affected historical blocks by contract address and topics.
This feature introduces only an offline maintenance command. It does not add a new network interface or change the normal block-processing flow. The tool can only be run when the FullNode is stopped.
Compatibility
- Breaking change: No.
- Default behavior change: No.
- Migration required: No.
Nodes without missing historical SectionBloom data do not need to run this command. Existing configurations and JSON-RPC APIs remain unchanged.
References
Use PR #6390: feat(toolkit): implement backfill SectionBloom function @h3110w0r1d-y as a reference. The implementation may be reworked or redesigned from there.
Additional Notes
- Do you have ideas regarding implementation? Yes.
- Are you willing to implement this feature? Yes.
- Lingua principale
- Java
- Stelle
- 4.2k
- Fork
- 1.8k
- Merge medio
- 3g 21h
- PR unite (30g)
- 13
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tronprotocol/java-tron
-
type:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
tronprotocol/java-tron#7013 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] Validate ECKey inputs and improve key handlingForse già presa @Federico2014 l’ha presa 17 giorni fa. Apertatype:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 40/100
tronprotocol/java-tron#6994 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
type:feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
tronprotocol/java-tron#6989 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Robustness fixes for multiple issuesForse già presa @xxo1shine l’ha presa 19 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
tronprotocol/java-tron#6969 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature] decouple json-rpc filter processing from ManagerForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertatype:feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 48/100
tronprotocol/java-tron#6963 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tronprotocol/java-tron
Issue simili
-
`GET /v1/event/token/{uuid}` can report a BOM upload as done before policy evaluation and metrics have finishedForse già presa @Zargath l’ha presa oggi. Apertadefect in triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DependencyTrack/dependency-track#7646 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
floci-io/floci#5425 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
objectionary/eo-graphs#80 ·
-
WebMvcStreamableServerTransportProvider: idle-session eviction stops permanently after a NullPointerException when a session is deleted mid-sweepForse già presa @lejuho l’ha presa oggi. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
spring-projects/spring-ai#7133 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
objectionary/jucs#141 ·
I maintainer di solito rispondono entro 1 giorno