From 3217b74e86a47fd9bf1924197fa1ad6b57aa041a Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Fri, 22 Dec 2023 10:53:46 -0700 Subject: [PATCH] add logs --- store/iavl/store.go | 3 ++- store/rootmulti/store.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/store/iavl/store.go b/store/iavl/store.go index 0ecdb9a140cb..aecccc250b63 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -80,7 +80,8 @@ func LoadStoreWithInitialVersion(db dbm.DB, logger log.Logger, key types.StoreKe } return &Store{ - tree: &mutableTree{tree}, + tree: &mutableTree{tree}, + logger: logger, }, nil } diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index aa65acfe06ee..1c8554f1fe2d 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -424,6 +424,7 @@ func (rs *Store) LastCommitID() types.CommitID { // Commit implements Committer/CommitStore. func (rs *Store) Commit() types.CommitID { + fmt.Println("calling commit") var previousHeight, version int64 if rs.lastCommitInfo.GetVersion() == 0 && rs.initialVersion > 1 { // This case means that no commit has been made in the store, we @@ -443,6 +444,7 @@ func (rs *Store) Commit() types.CommitID { rs.logger.Debug("commit header and version mismatch", "header_height", rs.commitHeader.Height, "version", version) } + fmt.Println("calling commit stores") rs.lastCommitInfo = commitStores(version, rs.stores, rs.removalMap) rs.lastCommitInfo.Timestamp = rs.commitHeader.Time defer rs.flushMetadata(rs.db, version, rs.lastCommitInfo) @@ -594,6 +596,7 @@ func (rs *Store) GetKVStore(key types.StoreKey) types.KVStore { } func (rs *Store) handlePruning(version int64) error { + fmt.Println("calling handle pruning") rs.pruningManager.HandleHeight(version - 1) // we should never prune the current version. if !rs.pruningManager.ShouldPruneAtHeight(version) { return nil @@ -607,6 +610,7 @@ func (rs *Store) handlePruning(version int64) error { // If clearPruningManager is true, the pruning manager will return the pruning heights, // and they are appended to the pruningHeights to be pruned. func (rs *Store) PruneStores(clearPruningManager bool, pruningHeights []int64) (err error) { + fmt.Println("calling prune stores") if clearPruningManager { heights, err := rs.pruningManager.GetFlushAndResetPruningHeights() if err != nil { @@ -639,6 +643,8 @@ func (rs *Store) PruneStores(clearPruningManager bool, pruningHeights []int64) ( store = rs.GetCommitKVStore(key) + fmt.Println("pruning store", "key", key, "height", pruneHeight) + err := store.(*iavl.Store).DeleteVersionsTo(pruneHeight) if err == nil { continue