Skip to content
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

Merged
merged 7 commits into from
Feb 14, 2025

Conversation

ganeshvanahalli
Copy link
Contributor

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 using block-metadata-fetcher, but in the case if node wants to start tracking from an older trackBlockMetadataFrom 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 blockMetadata

Resolves NIT-3096

for start < finish {
mid := (start + finish + 1) / 2
if wasKeyFound(uint64(mid), blockMetadataInputFeedPrefix) ||
wasKeyFound(uint64(mid), missingBlockMetadataInputFeedPrefix) {
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tsahee tsahee enabled auto-merge February 14, 2025 15:50
@tsahee tsahee merged commit 3bc9741 into master Feb 14, 2025
14 of 15 checks passed
@tsahee tsahee deleted the backfill-trackersinarbdb-missingblockmetadata branch February 14, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants