core/filtermaps: properly handle history cutoff while rendering index head (WIP) #31447
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.
This PR ensures safe behavior of the log indexer when head indexing cannot be performed because of history cutoff. Previously only the tail indexing conditions were aware of the cutoff point.
Now if a receipt is missing, the renderer returns
errHistoryCutoff
in which case the indexer main loop will not reattempt the same thing but instead it will reset the database, triggering a new checkpoint initialization attempt (maybe the database was old but the client has been updated and has recent checkpoints). If the latest checkpoint is also older than the cutoff point then theinit
function also returnserrHistoryCutoff
and the indexer goes into disabled state.Another issue fixed here is that in case of unexpected errors
waitForEvent
was called which was incorrect because what it really did was that it waited for a new target head and if there was already an unindexed target head then it did not block at all, letting the indexer loop to spin on max speed with the same error, not even noticing node shutdown.This PR is based on top of #31081 because it also touches the database reset logic which has been refactored in that previous PR.