Skip to content

Commit

Permalink
Add some logging, tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Nov 13, 2024
1 parent 3e08c45 commit a655e7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace st
// not frozen anything yet. Ensure that no blocks are missing yet from the
// key-value store, since that would mean we already had an old freezer.


// With a sharded node, if the desired start height is set then the ancients
// wont start at the genesis height, so we validate based on the shard start
genesisHeight := uint64(0)
Expand All @@ -230,21 +229,22 @@ func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace st
// The freezer might not inclue the tail, so we use the
// This doesn't work because the value in the freezer will be empty :(
if frozen, err := frdb.Ancients(); err != nil {
return nil, err;
return nil, err
} else if frozen > 0 && frozen < genesisHeight {
genesisHeight = frozen
}

log.Info("Subql Creating Freezer", "genesisHeight", genesisHeight)

// If the genesis hash is empty, we have a new key-value store, so nothing to
// validate in this method. If, however, the genesis hash is not nil, compare
// it to the freezer content.
if kvgenesis, _ := db.Get(headerHashKey(genesisHeight)); len(kvgenesis) > 0 {
frozen, _ := frdb.Ancients()
tail, _ := frdb.Tail()
log.Info("Frozen details", "tail", tail, "frozen", frozen)
// With sharding we check the number of items not deleted, not the total number
if frozen - tail > 0 {
tail, _ := frdb.Tail()
log.Info("Frozen details", "tail", tail, "frozen", frozen)
if frozen-tail > 0 {
// If the freezer already contains something, ensure that the genesis blocks
// match, otherwise we might mix up freezers across chains and destroy both
// the freezer and the key-value store.
Expand Down

0 comments on commit a655e7f

Please sign in to comment.