-
Notifications
You must be signed in to change notification settings - Fork 492
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
Add trackers for missing block metadata retroactively #2945
Conversation
arbnode/transaction_streamer.go
Outdated
for start < finish { | ||
mid := (start + finish + 1) / 2 | ||
if wasKeyFound(uint64(mid), blockMetadataInputFeedPrefix) || | ||
wasKeyFound(uint64(mid), missingBlockMetadataInputFeedPrefix) { |
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.
easier to make wasKeyFound accept just one index and attempt both blockMetadataInputFeedPrefix and missingBlockMetadataInputFeedPrefix
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.
agreed
} | ||
|
||
start := s.trackBlockMetadataFrom | ||
finish := msgCount - 1 |
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.
start by checking if there is a value for the first tracked block. This will usually succeed then we can be done with just one database access.
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.
ahh I had this check after the binary search (since its a required check), will just move this before search
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.
LGTM
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.
LGTM
This PR, on startup, enables the node to back-fill trackers for missing block metadata when
trackBlockMetadataFrom
config value has moved backwards. We have support for fetching of missing block metadata by first tracking them in arbdb through insertion of keys (trackers) for those block numbers, and fetching usingblock-metadata-fetcher
, but in the case if node wants to start tracking from an oldertrackBlockMetadataFrom
block number- this PR allows the node to do so.This gives a guarantee that a node will either have all blockMetadata starting from
trackBlockMetadataFrom
or it is currently trying to fetch the missing ones to rebuild the gaps in blockMetadataResolves NIT-3096