Skip to content

Commit

Permalink
Remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yzang2019 committed Oct 5, 2023
1 parent 505449f commit 13b74a6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
5 changes: 0 additions & 5 deletions diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root
if err != nil {
return err
}
fmt.Printf("curIter %d\n", prevVersion)

prevIter, err := NewNodeIterator(prevRoot, ndb)
if err != nil {
Expand Down Expand Up @@ -69,7 +68,6 @@ func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root
for curIter.Valid() {
node := curIter.GetNode()
shared := node.version <= prevVersion
fmt.Printf("curIter version %d has %d nodesToVisit \n", node.version, len(curIter.nodesToVisit))
curIter.Next(shared)
if shared {
sharedNode = node
Expand All @@ -81,14 +79,11 @@ func (ndb *nodeDB) extractStateChanges(prevVersion int64, prevRoot []byte, root

return nil
}
fmt.Printf("before advanceSharedNode\n")

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
6 changes: 1 addition & 5 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func (ndb *nodeDB) traverseNodes(fn func(hash []byte, node *Node) error) error {
return nil
}

// traverseStateChanges iterate the range of versions, compare each version to it's predecessor to extract the state changes of it.
// traverseStateChanges iterate the range of versions, compare each version to its predecessor to extract the state changes of it.
// endVersion is exclusive, set to `math.MaxInt64` to cover the latest version.
func (ndb *nodeDB) traverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *ChangeSet) error) error {
predecessor, err := ndb.getPreviousVersion(startVersion)
Expand All @@ -1071,24 +1071,20 @@ func (ndb *nodeDB) traverseStateChanges(startVersion, endVersion int64, fn func(
if err != nil {
return err
}
fmt.Printf("Traversing range from %d to %d with predecessor %d\n", startVersion, endVersion, predecessor)
return ndb.traverseRange(rootKeyFormat.Key(startVersion), rootKeyFormat.Key(endVersion), func(k, hash []byte) error {
var version int64
rootKeyFormat.Scan(k, &version)

fmt.Printf("traversed version: %d\n", version)
var changeSet ChangeSet
receiveKVPair := func(pair *KVPair) error {
changeSet.Pairs = append(changeSet.Pairs, pair)
return nil
}

fmt.Printf("extractStateChanges version: %d\n", version)
if err := ndb.extractStateChanges(predecessor, prevRoot, hash, receiveKVPair); err != nil {
return err
}

fmt.Printf("applying fn for version: %d\n", version)
if err := fn(version, &changeSet); err != nil {
return err
}
Expand Down

0 comments on commit 13b74a6

Please sign in to comment.