Skip to content

Commit

Permalink
fix: patch fix for batchstore reset and storage radius (#4494)
Browse files Browse the repository at this point in the history
  • Loading branch information
istae authored Dec 7, 2023
1 parent dd14545 commit ed24b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/statestore/storeadapter/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func allSteps() migration.Steps {
2: deletePrefix("sync_interval"),
3: deletePrefix("sync_interval"),
4: deletePrefix("blocklist"),
5: deletePrefix("batchstore"),
}
}

Expand Down
7 changes: 5 additions & 2 deletions pkg/storer/internal/reserve/reserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import (

// loggerName is the tree path name of the logger for this package.
const loggerName = "reserve"

const reserveNamespace = "reserve"

// hack: make sures the network's storage radius does not fall below a certain value
const minRadius = 9

/*
pull by bin - binID
evict by bin - batchID
Expand Down Expand Up @@ -69,7 +71,7 @@ func New(
if err != nil && !errors.Is(err, storage.ErrNotFound) {
return nil, err
}
rs.radius.Store(uint32(rItem.Radius))
rs.radius.Store(uint32(max(rItem.Radius, minRadius)))

epochItem := &EpochItem{}
err = store.Get(epochItem)
Expand Down Expand Up @@ -463,6 +465,7 @@ func (r *Reserve) EvictionTarget() int {
}

func (r *Reserve) SetRadius(store storage.Store, rad uint8) error {
rad = max(rad, minRadius)
r.radius.Store(uint32(rad))
r.radiusSetter.SetStorageRadius(rad)
return store.Put(&radiusItem{Radius: rad})
Expand Down

0 comments on commit ed24b89

Please sign in to comment.