Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,49 @@ NOTE: large db may GC overhead limit exceeded.
- `--db`: db name.
- `-h | --help`: provide the help info

## DB Backfill-Bloom

DB backfill bloom rebuilds SectionBloom data for historical blocks so that `eth_getLogs` can filter by address and topics. This is useful when `isJsonRpcFilterEnabled` was disabled during historical block processing and was enabled later.

### Prerequisites and behavior

- Stop the node and any other process using the database before running the command.
- The database directory must contain the `properties` and `transactionRetStore` databases. `transactionRetStore` must contain at least one non-zero block.
- Ensure `storage.transHistory.switch` was enabled while the historical blocks were processed.
- The start and end block numbers are inclusive.
- The command creates or updates the `section-bloom` database in the specified database directory.
- The operation is idempotent. If it is interrupted, safely rerun the same block range. Existing SectionBloom bits are preserved and set again. Do not run multiple backfill processes concurrently.

### Available parameters

- `-d | --database-directory`: Parent directory containing the source databases and the destination `section-bloom` database. Default: `output-directory/database`.
- `-s | --start-block`: Inclusive start block. Optional; defaults to the earliest non-zero block in `transactionRetStore`. A lower value is automatically raised to the earliest available block.
- `-e | --end-block`: Inclusive end block. Optional; defaults to the latest solidified block in `properties`. A higher value is automatically reduced to the latest solidified block.
- `-c | --max-concurrency`: Maximum number of processing threads, from 1 to 128. Default: 8. Use 4–8 for SATA SSD, 8–16 for NVMe SSD, or 1–2 for HDD. The actual concurrency does not exceed the number of sections being processed.
- `-h | --help`: Display the help message.

### Examples

```shell script
# Full command
java -jar Toolkit.jar db backfill-bloom [-d <databaseDirectory>] [-s <startBlock>] [-e <endBlock>] [-c <maxConcurrency>] [-h]

# Backfill the complete available range in the default database directory
java -jar Toolkit.jar db backfill-bloom

# Backfill blocks 1,000,000 through 2,000,000, inclusive
java -jar Toolkit.jar db backfill-bloom -s 1000000 -e 2000000

# Use a custom database directory and eight processing threads
java -jar Toolkit.jar db backfill-bloom -d /path/to/database -c 8
```

### Progress and performance

The terminal progress bar displays completed blocks, elapsed time, and estimated remaining time. `toolkit.log` records progress every 10,000 scanned blocks and includes the percentage, elapsed time, average rate, and estimated remaining time. The final summary reports scanned and successful blocks, blocks containing logs, errors, Bloom writes, duration, rates, and the concurrency used.

Performance depends on the number of logs, storage engine, disk, CPU, and database compaction. Increase `--max-concurrency` gradually while monitoring disk latency and CPU usage.

## Keystore

Keystore provides commands for managing account keystore files (Web3 Secret Storage format).
Expand Down
3 changes: 2 additions & 1 deletion plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dependencies {
implementation 'io.github.tronprotocol:leveldb:1.18.2'
}
implementation project(":protocol")
implementation project(":chainbase")
}

check.dependsOn 'lint'
Expand Down Expand Up @@ -149,7 +150,7 @@ def binaryRelease(taskName, jarName, mainClass) {
// (and so partial / parallel builds cannot run binaryRelease before the
// dependency jars exist).
dependsOn (project(':protocol').jar, project(':platform').jar,
project(':crypto').jar, project(':common').jar) // explicit_dependency
project(':crypto').jar, project(':common').jar, project(':chainbase').jar) // explicit_dependency
from {
configurations.runtimeClasspath.collect { // https://docs.gradle.org/current/userguide/upgrading_version_6.html#changes_6.3
it.isDirectory() ? it : zipTree(it)
Expand Down
1 change: 1 addition & 0 deletions plugins/src/main/java/common/org/tron/plugins/Db.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
DbConvert.class,
DbLite.class,
DbCopy.class,
DbBackfillBloom.class,
DbRoot.class
},
commandListHeading = "%nCommands:%n%nThe most commonly used db commands are:%n"
Expand Down
Loading
Loading