diff --git a/cosmos-sdk-store/pruning/manager.go b/cosmos-sdk-store/pruning/manager.go index 9a99e4915..28df77df2 100755 --- a/cosmos-sdk-store/pruning/manager.go +++ b/cosmos-sdk-store/pruning/manager.go @@ -143,6 +143,7 @@ func (m *Manager) LoadSnapshotHeights(db dbm.DB) error { } loadedPruneSnapshotHeights, err := loadPruningSnapshotHeights(db) + fmt.Printf("LOADED PRUNE SNAPSHOT HEIGHTS: %+v\n", loadedPruneSnapshotHeights) if err != nil { return err } diff --git a/cosmos-sdk-store/rootmulti/store.go b/cosmos-sdk-store/rootmulti/store.go index 3712a698e..50e215346 100755 --- a/cosmos-sdk-store/rootmulti/store.go +++ b/cosmos-sdk-store/rootmulti/store.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "math" + "runtime/debug" "sort" "strings" "sync" @@ -245,7 +246,9 @@ func (rs *Store) loadVersion(ver int64, upgrades *types.StoreUpgrades) error { rs.logger.Debug("loadVersion commitID", "key", key, "ver", ver, "hash", fmt.Sprintf("%x", commitID.Hash)) // If it has been added, set the initial version + fmt.Printf("STORE OF %s WAS ADDED\n", key.Name()) if upgrades.IsAdded(key.Name()) || upgrades.RenamedFrom(key.Name()) != "" { + fmt.Printf("STORE: %s INITITAL VERSION: %d\n", key.Name(), int64(ver)+1) storeParams.initialVersion = uint64(ver) + 1 } else if commitID.Version != ver && storeParams.typ == types.StoreTypeIAVL { return fmt.Errorf("version of store %s mismatch root store's version; expected %d got %d; new stores should be added using StoreUpgrades", key.Name(), ver, commitID.Version) @@ -461,6 +464,11 @@ func (rs *Store) LastCommitID() types.CommitID { // Commit implements Committer/CommitStore. func (rs *Store) Commit() types.CommitID { + fmt.Println("COMMIT") + fmt.Printf("STORE: %#v\n", rs) + fmt.Printf("LASTCOMMITINFOVERSION: %d\n", rs.lastCommitInfo.GetVersion()) + fmt.Printf("INITIALVERSION: %d\n", rs.initialVersion) + debug.PrintStack() 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 @@ -1016,6 +1024,7 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID db = dbm.NewPrefixDB(rs.db, []byte(prefix)) } + fmt.Printf("STORE PARAMS: %+v\n", params) switch params.typ { case types.StoreTypeMulti: panic("recursive MultiStores not yet supported") @@ -1024,9 +1033,12 @@ func (rs *Store) loadCommitStoreFromParams(key types.StoreKey, id types.CommitID var store types.CommitKVStore var err error + fmt.Println("DISABLE FAST NODE", rs.iavlDisableFastNode) if params.initialVersion == 0 { + fmt.Println("INITVERSION Is 0") store, err = iavl.LoadStore(db, rs.logger, key, id, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) } else { + fmt.Println("INITVERSION Is NOT 0") store, err = iavl.LoadStoreWithInitialVersion(db, rs.logger, key, id, params.initialVersion, rs.iavlCacheSize, rs.iavlDisableFastNode, rs.metrics) } @@ -1191,12 +1203,15 @@ func GetLatestVersion(db dbm.DB) int64 { // Commits each store and returns a new commitInfo. func commitStores(version int64, storeMap map[types.StoreKey]types.CommitKVStore, removalMap map[types.StoreKey]bool) *types.CommitInfo { + fmt.Println("COMMIT STORES") + debug.PrintStack() storeInfos := make([]types.StoreInfo, 0, len(storeMap)) storeKeys := keysFromStoreKeyMap(storeMap) for _, key := range storeKeys { store := storeMap[key] last := store.LastCommitID() + fmt.Println("COMMIT STORES: KEY: %#v, LAST: %#v, VERSION: %d\n", key, last, version) // If a commit event execution is interrupted, a new iavl store's version // will be larger than the RMS's metadata, when the block is replayed, we diff --git a/iavl/mutable_tree.go b/iavl/mutable_tree.go index 3ec57eb87..ecad41ee2 100644 --- a/iavl/mutable_tree.go +++ b/iavl/mutable_tree.go @@ -51,6 +51,7 @@ func NewMutableTree(db dbm.DB, cacheSize int, skipFastStorageUpgrade bool, lg lo for _, opt := range options { opt(&opts) } + fmt.Printf("NEW MUTABLE TREE OPTS: %+v\n", opts) ndb := newNodeDB(db, cacheSize, opts, lg) head := &ImmutableTree{ndb: ndb, skipFastStorageUpgrade: skipFastStorageUpgrade} @@ -435,10 +436,12 @@ func (tree *MutableTree) Load() (int64, error) { // Returns the version number of the specific version found func (tree *MutableTree) LoadVersion(targetVersion int64) (int64, error) { + fmt.Printf("TARGET VERSION: %d\n", targetVersion) firstVersion, err := tree.ndb.getFirstVersion() if err != nil { return 0, err } + fmt.Printf("FIRST VERSION: %d\n", firstVersion) if firstVersion > 0 && firstVersion < int64(tree.ndb.opts.InitialVersion) { return firstVersion, fmt.Errorf("initial version set to %v, but found earlier version %v", @@ -450,6 +453,7 @@ func (tree *MutableTree) LoadVersion(targetVersion int64) (int64, error) { return 0, err } + fmt.Printf("LATEST VERSION: %d\n", latestVersion) if firstVersion > 0 && firstVersion < int64(tree.ndb.opts.InitialVersion) { return latestVersion, fmt.Errorf("initial version set to %v, but found earlier version %v", tree.ndb.opts.InitialVersion, firstVersion)