Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yzang2019 committed Oct 4, 2023
1 parent 09eb599 commit ad8d8bb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package iavl

import (
"bytes"
"fmt"

"github.com/cosmos/iavl/proto"
)
Expand All @@ -21,16 +22,18 @@ type KVPairReceiver func(pair *KVPair) error
//
// The algorithm don't run in constant memory strictly, but it tried the best the only
// keep minimal intermediate states in memory.
func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root []byte, receiver KVPairReceiver) error {
func (ndb *nodeDB) EextractStateChanges(prevVersion int64, prevRoot []byte, root []byte, receiver KVPairReceiver) error {
curIter, err := NewNodeIterator(root, ndb)
if err != nil {
return err
}
fmt.Printf("curIter %d\n", prevVersion)

prevIter, err := NewNodeIterator(prevRoot, ndb)
if err != nil {
return err
}
fmt.Printf("prevIter \n")

var (
// current shared node between two versions
Expand Down Expand Up @@ -78,10 +81,13 @@ func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root

return nil
}

if err := advanceSharedNode(); err != nil {
return err
}

fmt.Printf("after advanceSharedNode\n")

// addOrphanedLeave receives a new orphaned leave node found in previous version,
// compare with the current newLeaves, to produce `iavl.KVPair` stream.
addOrphanedLeave := func(orphaned *Node) error {
Expand Down Expand Up @@ -140,11 +146,14 @@ func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root
}
}
}
fmt.Printf("before consumeNewLeaves \n")

if err := consumeNewLeaves(); err != nil {
return err
}

fmt.Printf("after consumeNewLeaves \n")

if err := curIter.Error(); err != nil {
return err
}
Expand Down

0 comments on commit ad8d8bb

Please sign in to comment.