Skip to content

Commit

Permalink
meta: don't error out on migrated DB with old version
Browse files Browse the repository at this point in the history
Fixes

    error        shard/control.go:17        metabase failure, switching mode        {"shard_id": "XxhmeQZZRSQfDGfiCYo9mB", "stage": "init", "mode": "READ_ONLY", "error": "migrating from 2 to 3 version failed, consider database resync: graveyard value with unexpected 72 length"}

Signed-off-by: Roman Khimov <[email protected]>
  • Loading branch information
roman-khimov committed Dec 12, 2024
1 parent 4f4840c commit 3e89a3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog for NeoFS Node
### Added

### Fixed
- Incomplete metabase migration to version 3 leading to node start failure (#3048)

### Changed

Expand Down
6 changes: 5 additions & 1 deletion pkg/local_object_storage/metabase/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ func migrateFrom2Version(db *DB, tx *bbolt.Tx) error {
c := bkt.Cursor()

for k, v := c.First(); k != nil; k, v = c.Next() {
if l := len(v); l != addressKeySize {
l := len(v)
if l == addressKeySize+8 { // Because of a 0.44.0 bug we can have a migrated DB with version 2.
continue
}
if l != addressKeySize {
return fmt.Errorf("graveyard value with unexpected %d length", l)
}

Expand Down

0 comments on commit 3e89a3d

Please sign in to comment.