Skip to content

Revert "core/rawdb: open meta file in read only mode (#26009)"#1879

Merged
brilliant-lx merged 1 commit intobnb-chain:developfrom
node-real:revert-freezer-readonly
Sep 19, 2023
Merged

Revert "core/rawdb: open meta file in read only mode (#26009)"#1879
brilliant-lx merged 1 commit intobnb-chain:developfrom
node-real:revert-freezer-readonly

Conversation

@NathanBSC
Copy link
Copy Markdown
Contributor

@NathanBSC NathanBSC commented Sep 19, 2023

Description

This reverts commit b9ba6f6e4d86d0ee86c63e8f4552e233fe0450aa.

Rationale

dir chaindata generated by old version of geth(before big merge) doesn't contain *meta files which are used to tail deletion.
so for back-compatible, still open meta file in append mode even readonly flagged.

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

Copy link
Copy Markdown
Contributor

@fynnss fynnss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Without this pr, It'll return "*.meta file: no such file or directory" error when open historical bsc snapshot database as readonly.

# ./geth db stats --datadir server/data-seed/
INFO [09-19|04:13:45.869] Maximum peer count                       ETH=50 LES=0 total=50
INFO [09-19|04:13:45.871] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [09-19|04:13:45.875] Set global gas cap                       cap=50,000,000
INFO [09-19|04:13:45.875] Initializing the KZG library             backend=gokzg
INFO [09-19|04:13:46.293] Using leveldb as the backing database
INFO [09-19|04:13:46.293] Allocated cache and file handles         database=/server/server/data-seed/geth/chaindata cache=408.00MiB handles=4096 readonly=true
INFO [09-19|04:13:54.841] Using LevelDB as the backing database
INFO [09-19|04:13:54.847] Found legacy ancient chain path          location=/server/server/data-seed/geth/chaindata/ancient
Chain metadata
  databaseVersion: 8 (0x8)
  headBlockHash: 0x6eab3c4761643ae9817382596332a98bbbbd6cd7ed3c870327decef37fd7711b
  headFastBlockHash: 0x6eab3c4761643ae9817382596332a98bbbbd6cd7ed3c870327decef37fd7711b
  headHeaderHash: 0x6eab3c4761643ae9817382596332a98bbbbd6cd7ed3c870327decef37fd7711b
  lastPivotNumber: 6920578 (0x699982)
  len(snapshotSyncStatus): 0 bytes
  snapshotDisabled: false
  snapshotJournal: 2991918 bytes
  snapshotRecoveryNumber: 31435739 (0x1dfabdb)
  snapshotRoot: 0xf2034e8566930e7ed51956d27bdfeec0d151c76c09fb2681f0f644e79acf6a12
  txIndexTail: 0 (0x0)
  fastTxLookupLimit: 2350000 (0x23dbb0)


Fatal: Could not open database: open /server/server/data-seed/geth/chaindata/ancient/headers.meta: no such file or directory

@fynnss fynnss self-requested a review September 19, 2023 07:45
@buddh0 buddh0 requested a review from brilliant-lx September 19, 2023 07:58
@brilliant-lx brilliant-lx merged commit 41f0667 into bnb-chain:develop Sep 19, 2023
@NathanBSC NathanBSC deleted the revert-freezer-readonly branch September 21, 2023 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants