forked from TrueCloudLab/frostfs-node
[#181] ir: Do not process container estimations by non-alphabet nodes
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
db5321309d
commit
f09ee27af9
2 changed files with 12 additions and 1 deletions
|
@ -20,6 +20,10 @@ type (
|
||||||
EpochDuration() uint64
|
EpochDuration() uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alphaState interface {
|
||||||
|
IsAlphabet() bool
|
||||||
|
}
|
||||||
|
|
||||||
subEpochEventHandler struct {
|
subEpochEventHandler struct {
|
||||||
handler event.Handler // handle to execute
|
handler event.Handler // handle to execute
|
||||||
durationMul uint32 // X: X/Y of epoch in blocks
|
durationMul uint32 // X: X/Y of epoch in blocks
|
||||||
|
@ -31,6 +35,8 @@ type (
|
||||||
epochTimerArgs struct {
|
epochTimerArgs struct {
|
||||||
l *logger.Logger
|
l *logger.Logger
|
||||||
|
|
||||||
|
alphabetState alphaState
|
||||||
|
|
||||||
newEpochHandlers []newEpochHandler
|
newEpochHandlers []newEpochHandler
|
||||||
|
|
||||||
cnrWrapper *container.Client // to invoke stop container estimation
|
cnrWrapper *container.Client // to invoke stop container estimation
|
||||||
|
@ -91,6 +97,11 @@ func newEpochTimer(args *epochTimerArgs) *timer.BlockTimer {
|
||||||
args.stopEstimationDMul,
|
args.stopEstimationDMul,
|
||||||
args.stopEstimationDDiv,
|
args.stopEstimationDDiv,
|
||||||
func() {
|
func() {
|
||||||
|
if !args.alphabetState.IsAlphabet() {
|
||||||
|
args.l.Debug("non-alphabet mode, do not stop container estimations")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
epochN := args.epoch.EpochCounter()
|
epochN := args.epoch.EpochCounter()
|
||||||
if epochN == 0 { // estimates are invalid in genesis epoch
|
if epochN == 0 { // estimates are invalid in genesis epoch
|
||||||
return
|
return
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
|
||||||
prm.SetEpoch(epoch - 1)
|
prm.SetEpoch(epoch - 1)
|
||||||
prm.SetHash(ev.TxHash())
|
prm.SetHash(ev.TxHash())
|
||||||
|
|
||||||
if epoch > 0 { // estimates are invalid in genesis epoch
|
if epoch > 0 && np.alphabetState.IsAlphabet() { // estimates are invalid in genesis epoch
|
||||||
err = np.containerWrp.StartEstimation(prm)
|
err = np.containerWrp.StartEstimation(prm)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue