[5.0] treat a end_block_num=0 as "forever" in snapshot scheduler for compatibility with leap 4.0 behavior#2402
Merged
spoonincode merged 1 commit intorelease/5.0from Aug 17, 2024
Merged
Conversation
heifner
approved these changes
Aug 16, 2024
greg7mdp
approved these changes
Aug 16, 2024
Contributor
|
Note:start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
leap 5's snapshot scheduling implementation changed the meaning of
end_block_num=0which breaks both requests that previously worked and any previously scheduled snapshots with that value (the scheduled snapshots will effectively be removed upon upgrade to leap5).In leap4 requests were submitted as
leap/plugins/producer_plugin/include/eosio/producer_plugin/producer_plugin.hpp
Lines 85 to 89 in 01dab51
This has the important behavior that if a request does not specify
end_block_numit remains 0 and is written out tosnapshot-schedule.jsonwith"end_block_num":0. I believe what happens then is thatend_block_num=0gets treated as "forever" by it not being removed from the scheduled list here,leap/plugins/producer_plugin/include/eosio/producer_plugin/snapshot_scheduler.hpp
Lines 94 to 99 in 01dab51
But leap5 changes things up. There is an additional indirection on the requests,
leap/libraries/chain/include/eosio/chain/snapshot_scheduler.hpp
Lines 47 to 54 in 0242caa
before the similar
snapshot_request_informationis used,leap/libraries/chain/include/eosio/chain/snapshot_scheduler.hpp
Lines 40 to 45 in 0242caa
So, importantly, in 5.0 if the request does not specify the
optional<uint32_t> end_block_numthen it is set to UINT32_MAX,leap/plugins/producer_plugin/producer_plugin.cpp
Lines 1538 to 1544 in 0242caa
And then leap5's schedule pruning does not treat
end_block_num=0as special because it expects "forever requests" to beend_block_num=UINT32_MAX; so anyend_block_num=0requests (be it new ones arriving on RPC, or old ones read from the JSON file) just get removed immediately.leap/libraries/chain/snapshot_scheduler.cpp
Lines 30 to 31 in 0242caa
So this PR replaces
end_block_num=0withend_block_num=UINT32_MAXboth,snapshot-schedule.jsonentries withend_block_num=0, andschedule_snapshotRPC request, so that behavior with requests that worked in leap4 remain the same in leap5Resolves #2261