-
Notifications
You must be signed in to change notification settings - Fork 198
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
Fix nodes coordinator registry save #3504
Fix nodes coordinator registry save #3504
Conversation
Codecov Report
@@ Coverage Diff @@
## development #3504 +/- ##
============================================
Coverage 73.87% 73.88%
============================================
Files 582 582
Lines 74532 74545 +13
============================================
+ Hits 55064 55075 +11
- Misses 15065 15066 +1
- Partials 4403 4404 +1
Continue to review full report at Codecov.
|
|
||
// LoadState loads the nodes coordinator state from the used boot storage | ||
func (ihgs *indexHashedNodesCoordinatorWithRater) LoadState(key []byte) error { | ||
return ihgs.baseLoadState(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for the move to the appropriate file
} | ||
|
||
for epoch, epochNodesData := range ihgs.nodesConfig { | ||
minEpoch := 0 | ||
if ihgs.currentEpoch >= nodeCoordinatorStoredEpochs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a typo here? I think nodesCoordinatorStoredEpochs
sounds better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, for performance reasons I would have put it in reverse, like:
minEpoch = int(ihgs.currentEpoch) - nodeCoordinatorStoredEpochs + 1
if minEpoch < 0{
minEpoch = 0
}
as for the current state (epoch 400+) the node will always execute the if branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on internal tests: only epochs 7, 6 and 5 were saved in the storage.
…lrondNetwork/elrond-go into fix-nodes-coordinator-registry-pruning
1cd21e8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case there is a restart in every epoch, the registry for nodes coordinator does not get pruned.
This PR ensures that every nodes coordinator registry save is done only for the configured number of epochs.