Skip to content

feat(toolkit): exclude historical balance DBs from lite snapshot#6690

Open
halibobo1205 wants to merge 5 commits intotronprotocol:developfrom
halibobo1205:feat/toolkit_db_lite_opt
Open

feat(toolkit): exclude historical balance DBs from lite snapshot#6690
halibobo1205 wants to merge 5 commits intotronprotocol:developfrom
halibobo1205:feat/toolkit_db_lite_opt

Conversation

@halibobo1205
Copy link
Copy Markdown
Collaborator

What Changed

Exclude balance-trace and account-trace from lite snapshots. Since historical balance lookup is off by default, most nodes see no difference in snapshot size; only nodes with the feature enabled benefit from smaller snapshots.

Impact

✅ Smaller lite snapshots when historical balance lookup is enabled
✅ No impact for default-configured nodes

close #6597

What Changed
Exclude balance-trace and account-trace from lite snapshots. Since historical balance lookup is off by default, most nodes see no difference in snapshot size; only nodes with the feature enabled benefit from smaller snapshots.
Impact
✅ Smaller lite snapshots when historical balance lookup is enabled
✅ No impact for default-configured nodes

close tronprotocol#6597
Comment thread plugins/src/main/java/common/org/tron/plugins/DbLite.java
Comment thread plugins/src/main/java/common/org/tron/plugins/DbLite.java Outdated
Comment thread plugins/src/test/java/org/tron/plugins/DbLiteTest.java
Comment thread plugins/src/test/java/org/tron/plugins/DbLiteTest.java
Comment thread plugins/src/main/java/common/org/tron/plugins/DbLite.java
@waynercheung
Copy link
Copy Markdown
Collaborator

[NIT] A few minor cleanup items:

  • Please move the unrelated .gitignore hunk out of this PR so the review stays scoped.
  • The // delete account trace comment in DbLite.java reads as if it belongs to long blockNum = ...; please move/reword it so it describes the stream below more clearly.
  • The nested ternary in DbLiteTest.java is hard to parse; please extract it into a local variable before calling generateSomeTransactions(...).

Comment thread .gitignore Outdated
Comment thread plugins/src/main/java/common/org/tron/plugins/DbLite.java
halibobo1205 and others added 3 commits April 21, 2026 19:56
Document why TRANS/TRANSACTION_HISTORY/ACCOUNT_TRACE DBs cannot be
positioned by block number, and why full replay is safe.
- Drop unrelated .gitignore entry; scope this PR to toolkit changes.
- Move `// delete account trace` comment onto the stream it describes.
- Extract nested ternary in DbLiteTest into a named local.
- Rename testToolsWithTrimHistory -> V1/V2 so reports distinguish them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Assert snapshot excludes balance-trace/account-trace and history
  includes them; this locks in the new archiveDbs layout so a future
  regression fails CI instead of silently shipping historical DBs.
- Flip DbLiteWithHistoryRocksDbV2Test to advanceSnapshot=true so the
  ACCOUNT_TRACE_DB_NAME branch in mergeBak2Database() is exercised for
  checkpoint v2 as well (previously only v1 covered it).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread plugins/src/main/java/common/org/tron/plugins/DbLite.java
Comment thread plugins/src/test/java/org/tron/plugins/DbLiteTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Exclude historical balance DBs from lite snapshot

4 participants