Skip to content

fix: prevent fallback to legacy store when migrating #955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/storage/driver/adapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ func (d *DefaultStorageDriverAdapter) OpenLedger(ctx context.Context, name strin
return nil, nil, err
}

isUpToDate, err := store.GetBucket().IsUpToDate(ctx, d.db)
lastVersion, err := store.GetBucket().GetLastVersion(ctx, d.db)
if err != nil {
return nil, nil, fmt.Errorf("checking if bucket is up to date: %w", err)
}

return ledgerstore.NewDefaultStoreAdapter(isUpToDate, store), l, nil
return ledgerstore.NewDefaultStoreAdapter(lastVersion >= 26, store), l, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magical number, corresponding to the migration 25.
The migration 25 was introduced in v2.2.0 of the ledger.
So checking for this version is enough to declare the database is up to date to use the new store.

}

func (d *DefaultStorageDriverAdapter) CreateLedger(ctx context.Context, l *ledger.Ledger) error {
Expand Down
Loading