Skip to content

Commit

Permalink
feat: journal nodebufferlist snapshot data for journal file recovering
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Nov 25, 2024
1 parent 518a7ab commit d2b38bf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions triedb/pathdb/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,15 @@ func (db *Database) loadDiskLayer(r *rlp.Stream, journalTypeForReader JournalTyp

if db.config.TrieNodeBufferType == NodeBufferList && journalTypeForReader == JournalFileType && !db.fastRecovery {
log.Info("decode journal file data")
if err := journalBuf.Decode(&nodesArray); err != nil {
var layerNum uint64
if err := journalBuf.Decode(&layerNum); err != nil {
return nil, fmt.Errorf("11 failed to load disk nodes: %v", err)
}
for i, val := range nodesArray {
log.Info("print load decode layers node info", "index", i, "root", val.root, "layers", val.layers,
"size", val.size)
}
log.Info("print load layers", "layer", layerNum)
// for i, val := range nodesArray {
// log.Info("print load decode layers node info", "index", i, "root", val.root, "layers", val.layers,
// "size", val.size)
// }
} else {
// Resolve nodes cached in node buffer
var encoded []journalNodes
Expand Down Expand Up @@ -516,7 +518,9 @@ func (dl *diskLayer) journal(w io.Writer, journalType JournalType) error {
log.Info("print journal multi layers node info", "index", i, "root", val.root, "layers", val.layers,
"size", val.size)
}
if err := rlp.Encode(journalBuf, nodes); err != nil {
layerNum := dl.buffer.getLayers()
log.Info("print journal layers", "layer", layerNum)
if err := rlp.Encode(journalBuf, layerNum); err != nil {
return err
}
log.Info("Journal file and node buffer list", "multi layer nodes count", len(nodes))
Expand Down

0 comments on commit d2b38bf

Please sign in to comment.