Skip to content
This repository has been archived by the owner on Feb 18, 2025. It is now read-only.

downloader, pathdb/database: do not disable database during snap sync for backward compatibility #622

Closed
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
8 changes: 5 additions & 3 deletions eth/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,11 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode
// subsequent state reads, explicitly disable the trie database and state
// syncer is responsible to address and correct any state missing.
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
if err := d.blockchain.TrieDB().Disable(); err != nil {
return err
}
// Disabling trie database for snap sync, We will not disable here for backward compatibility with handling consensus logic.

// if err := d.blockchain.TrieDB().Disable(); err != nil {
// return err
// }
}
// Snap sync uses the snapshot namespace to store potentially flakey data until
// sync completely heals and finishes. Pause snapshot maintenance in the mean
Expand Down
8 changes: 5 additions & 3 deletions trie/triedb/pathdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ func New(diskdb ethdb.Database, config *Config) *Database {
}
// Disable database in case node is still in the initial state sync stage.
if rawdb.ReadSnapSyncStatusFlag(diskdb) == rawdb.StateSyncRunning && !db.readOnly {
if err := db.Disable(); err != nil {
log.Crit("Failed to disable database", "err", err) // impossible to happen
}
// Disabling trie database for snap sync, We will not disable here for backward compatibility with handling consensus logic.

// if err := db.Disable(); err != nil {
// log.Crit("Failed to disable database", "err", err) // impossible to happen
// }
}
log.Warn("Path-based state scheme is an experimental feature")
return db
Expand Down
Loading