Skip to content

Commit

Permalink
Problem: no version in memiavl log (#1311)
Browse files Browse the repository at this point in the history
* Problem: no log version in memiavl

* Apply suggestions from code review

* add doc
  • Loading branch information
mmsqe authored Feb 5, 2024
1 parent 0f1c1a9 commit b7b261a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [#1302](https://github.com/crypto-org-chain/cronos/pull/1302) Fix concurrent map access in rootmulti store.
- [#1304](https://github.com/crypto-org-chain/cronos/pull/1304) Write versiondb with fsync, and relax the version requirement on startup.
- [#1308](https://github.com/crypto-org-chain/cronos/pull/1308) Update ethermint to fix duplicate cache events emitted from evm hooks and wrong priority tx.
- [#1311](https://github.com/crypto-org-chain/cronos/pull/1311) Add missing version in memiavl log.

### Improvements

Expand Down
8 changes: 4 additions & 4 deletions memiavl/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ func Load(dir string, opts Options) (*DB, error) {

if snapshot != currentSnapshot {
// downgrade `"current"` link first
opts.Logger.Info("downgrade current link to %s", snapshot)
opts.Logger.Info("downgrade current link to", "snapshot", snapshot)
if err := updateCurrentSymlink(dir, snapshot); err != nil {
return nil, fmt.Errorf("fail to update current snapshot link: %w", err)
}
}

// truncate the WAL
opts.Logger.Info("truncate WAL from back, version: %d", opts.TargetVersion)
opts.Logger.Info("truncate WAL from back", "version", opts.TargetVersion)
if err := wal.TruncateBack(walIndex(int64(opts.TargetVersion), mtree.initialVersion)); err != nil {
return nil, fmt.Errorf("fail to truncate wal logs: %w", err)
}
Expand All @@ -223,9 +223,9 @@ func Load(dir string, opts Options) (*DB, error) {
}

if err := atomicRemoveDir(filepath.Join(dir, snapshotName(version))); err != nil {
opts.Logger.Error("fail to prune snapshot, version: %d", version)
opts.Logger.Error("fail to prune snapshot", "version", version, "err", err)
} else {
opts.Logger.Info("prune snapshot, version: %d", version)
opts.Logger.Info("prune snapshot", "version", version)
}
return false, nil
}); err != nil {
Expand Down

0 comments on commit b7b261a

Please sign in to comment.