Skip to content

Commit

Permalink
fix: save version to immutable iavl tree before writing to file
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <elias@vega.xyz>
  • Loading branch information
EVODelavega committed Apr 22, 2024
1 parent c13c922 commit ed90880
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/snapshot/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func (e *Engine) Snapshot(ctx context.Context) ([]byte, DoneCh, error) {

e.commitsLeftBeforeSnapshot = e.intervalBetweenSnapshots

return e.snapshotNow(ctx, true, true)
return e.snapshotNow(ctx, true)
}

// SnapshotDump takes a snapshot on demand, without persisting it to the underlying DB
Expand All @@ -527,7 +527,7 @@ func (e *Engine) SnapshotDump(ctx context.Context, path string) ([]byte, error)
return nil, err
}
defer func() { _ = f.Close() }()
hash, ch, err := e.snapshotNow(ctx, true, false) // do not persist
hash, ch, err := e.snapshotNow(ctx, true)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -568,12 +568,12 @@ func (e *Engine) SnapshotDump(ctx context.Context, path string) ([]byte, error)
func (e *Engine) SnapshotNow(ctx context.Context) ([]byte, error) {
e.ensureEngineIsStarted()

now, _, err := e.snapshotNow(ctx, false, true)
now, _, err := e.snapshotNow(ctx, false)

return now, err
}

func (e *Engine) snapshotNow(ctx context.Context, saveAsync, persist bool) ([]byte, DoneCh, error) {
func (e *Engine) snapshotNow(ctx context.Context, saveAsync bool) ([]byte, DoneCh, error) {
defer metrics.StartSnapshot("all")()
e.snapshotTreeLock.Lock()

Expand Down

0 comments on commit ed90880

Please sign in to comment.