Align architecture/database.md with current java-tron storage layer and Toolkit behavior#330
Open
abn2357 wants to merge 3 commits into
Open
Align architecture/database.md with current java-tron storage layer and Toolkit behavior#330abn2357 wants to merge 3 commits into
abn2357 wants to merge 3 commits into
Conversation
- Note that `db convert` is x86_64-only; on arm64 the subcommand prints an "unsupported architecture" message and exits without converting anything. - Rewrite section 2 to describe the two arguments as positional, not named flags: in DbConvert.java they are picocli `@Parameters` with `index = "0"` and `index = "1"`, so `--src_db_path=...` / `--dst_db_path=...` would not be recognized. Use `<src>` / `<dst>` placeholders and show the positional command shape explicitly. - Drop the trailing link to tronprotocol/documentation's Rocksdb_vs_Leveldb.md — the target lives in the legacy docs repo and is no longer maintained.
Same convention used elsewhere in the docs: drop the bare `>备注:` form (no space, wrong label, wraps to next line) and use the bolded single-line `> **注意**:...` form, matching the arm64 note added earlier in this file.
…bSettings The previous storage block listed three keys with no explanation. Readers had no way to know which writes db.sync gates, what flipping transHistory.switch costs them, or whether dbSettings does anything under LevelDB. Sourced from: - LevelDbDataSourceImpl, db2/common/LevelDB, db2/common/RocksDB, TronDatabase all set WriteOptions.sync(storage.isDbSync()), so db.sync applies to both engines (RocksDB path included). - TransactionHistoryStore.put / TransactionRetStore.put gate writes on storage.transactionHistorySwitch; reads are not gated. The cutoff is block-apply time, not chain-confirmation, so the doc says "processed while the switch was off". - dbSettings is only consumed by RocksDbSettings, which only feeds RocksDB Options; the LevelDB path uses storage.properties[*] with different key names and never reads dbSettings.
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.
Summary
Audited
docs/architecture/database.mdagainst the current java-tronstorage layer and the
Toolkit.jar dbsubcommands. Fixes a fewinaccuracies and fills in the gaps a reader naturally hits when
looking at the example
storage { ... }block. Content-aligned withthe English counterpart
tronprotocol/documentation-en#604.
Notable corrections:
db convertis x86_64-only:DbConvert.javachecksArch.isArm64()at the top ofcall()and exits early with an"unsupported architecture" message, so it does nothing on arm64.
Surfaced this as a note at the start of the migration section.
documented
src_db_path/dst_db_pathas if they were CLI flags,but
DbConvert.javadeclares them as picocli@Parameterswithindex = "0"/index = "1". Renamed the section to "位置参数",switched to
<src>/<dst>placeholders, and added the explicitdb convert <src> <dst>command shape.Rocksdb_vs_Leveldb.mdlink pointed at the legacytronprotocol/documentationrepo, which is no longer maintained.Filled-in gaps under the
storage { ... }example block:db.sync: explained that it controls whether the underlyingengine waits for each write to be physically flushed to disk
before returning. Default
false. Verified that all four callsites —
LevelDbDataSourceImpl,db2/common/LevelDB,db2/common/RocksDB,TronDatabase— setWriteOptions.sync(storage.isDbSync()), so the flag applies toboth engines (the RocksDB path included).
transHistory.switch: explained that when"off",TransactionHistoryStore.putandTransactionRetStore.putsilently drop new writes (
BooleanUtils.toBoolean(switch)gate),which makes
gettransactioninfobyidreturn empty for anytransaction processed while the switch was off. Reads of
pre-existing data are not gated. Default
"on".dbSettingsis RocksDB-only: added a leading sentence to"RocksDB 优化参数" noting that the block is only consumed by
RocksDbSettings.initCustomSettings(and from there byRocksDbDataSourceImpl). The LevelDB code path has its ownper-db tuning via
storage.properties[*]with different keynames (
blockSize,writeBufferSize,cacheSize,maxOpenFiles,compressionType) and never readsdbSettings.Formatting:
**注意**:— the trailing10-hours note used the bare
>备注:form (no space, wronglabel, wraps to next line); now matches the bolded single-line
style used by the arm64 note added in this PR.
Test plan
Arch.isArm64()gating inDbConvert.java@Parametersindices and default values inDbConvert.javadb.syncconsumers acrossLevelDbDataSourceImpl,db2/common/LevelDB,db2/common/RocksDB,TronDatabasetransHistory.switchgatesput()inTransactionHistoryStoreandTransactionRetStore, and thatWallet.getTransactionInfoByIdreads from bothdbSettingsonly flows intoRocksDbSettingsandRocksDbDataSourceImpl; LevelDB path usesStorageUtils.getOptionsByDbName/Storage.newDefaultDbOptionswith separate key names