Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .changelog/6239.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/worker/storage/committee: Fix stuck storage finalization
10 changes: 8 additions & 2 deletions go/storage/mkvs/db/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import (
"github.com/oasisprotocol/oasis-core/go/storage/mkvs/writelog"
)

// ModuleName is the module name.
const ModuleName = "storage/mkvs/db"
const (
// ModuleName is the module name.
ModuleName = "storage/mkvs/db"

// MaxPendingVersions is the maximum number of allowed non-finalized versions.
// Increasing this too much can result in the metadata growing too much.
MaxPendingVersions = 5000
)

var (
// ErrNodeNotFound indicates that a node with the specified hash couldn't be found
Expand Down
8 changes: 2 additions & 6 deletions go/storage/mkvs/db/pathbadger/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import (
"github.com/oasisprotocol/oasis-core/go/storage/mkvs/db/api"
)

// maxPendingVersions is the maximum number of allowed non-finalized versions. Increasing this too
// much can result in the metadata growing too much.
const maxPendingVersions = 5000

// serializedMetadata is the on-disk serialized metadata.
type serializedMetadata struct {
// Version is the database schema version.
Expand Down Expand Up @@ -123,7 +119,7 @@ func (m *metadata) reserveRootSeqNo(version uint64, rootType uint8) (uint16, err
m.Lock()
defer m.Unlock()

if len(m.value.NextPendingRootSeq) >= maxPendingVersions {
if len(m.value.NextPendingRootSeq) > api.MaxPendingVersions {
return math.MaxUint16, fmt.Errorf("mkvs/pathbadger: too many non-finalized versions")
}

Expand All @@ -146,7 +142,7 @@ func (m *metadata) setPendingRootSeqNo(version uint64, rootHash api.TypedHash, s
m.Lock()
defer m.Unlock()

if len(m.value.PendingRootSeqs) >= maxPendingVersions {
if len(m.value.PendingRootSeqs) > api.MaxPendingVersions {
return fmt.Errorf("mkvs/pathbadger: too many non-finalized versions")
}

Expand Down
Loading
Loading