Skip to content

Commit

Permalink
downloader, pathdb/database: do not disable database during snap sync…
Browse files Browse the repository at this point in the history
… for backward compatibility
  • Loading branch information
Francesco4203 committed Oct 31, 2024
1 parent b92dac2 commit c62cfb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit c62cfb7

Please sign in to comment.