This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
grandpa: cleanup stale entries in set id session mapping #13237
grandpa: cleanup stale entries in set id session mapping #13237
Changes from 4 commits
bcc6c9a
0cca7c1
5b07212
50b175d
7f3b301
ac6caad
cb3fadb
0598c70
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Just curious.
In case we have more than
X
entries this will bail out entirely.In this case what is the strategy to cleanup the leftovers?
The note talks about a multi-block migration. How this can be implemented? And who is in charge to implement it? Just asking to prevent it from being forgotten forever 😃
Also at this point can't we at least use a best effort approach and cleanup the first
X
entries?Another idea/question (not a super expert of runtime upgrades... but I assume it can work)
If we save in the state a temporary variable to keep track of where we arrived (with the cleanup) so far and we leave this migration code here for the next runtime, then in the worst case after a bunch of upgrades we cleaned everything and at that point we also remove the temporary state variable.
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.
I just put this (random) cut-off here to prevent any users from shooting themselves in the foot. By "multi-block" migration I mean exactly what you suggested, just keep track of the current state of cleanup and remove N entries every block until it's finished. The reason I didn't implement this is because we don't need it for any of our networks and I figured it was unnecessary to add the extra complexity. I put this note here in case any other user of substrate needs to implement this (TBH even 25000 entries might be fast enough to do in a single block, I didn't test this as our limits are way lower than this ~6500).
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.
Got it! Thank you