-
Notifications
You must be signed in to change notification settings - Fork 236
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
feat: introduce init tip
setting for indexer to skip previous block synchronization
#4244
Conversation
- get_indexer_tip - rollback
# # The initial tip number and hash can be set as the starting height for building indexes in indexer-r. Effective only during the initial index creation. | ||
# init_tip_number = 10000 | ||
# # The initial tip hash must match the tip number; otherwise, it will result in a rollback to empty. | ||
# init_tip_hash = "0x8fbd0ec887159d2814cee475911600e3589849670f5ee1ed9798b38fdeef4e44" |
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.
suggest to use one block hash parameter only, indexer may use get_header
rpc to fetch the block number, and start the indexing service only when corresponding header was found.
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.
Entering a number manually considering a situation where the block height of the node itself may not have been reached and get_header
may fail.
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.
please refer to my previous comment:
start the indexing service only when corresponding header was found.
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.
Another issue is that if the hash is wrong, then there is no chance of rollback.
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.
indexer service won't starting if the hash is wrong.
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.
OK, got it.
What problem does this PR solve?
Problem Summary:
CKB-indexer supports building indexes only for interested blocks. This can be done by setting
block_filter
before this PR. But the filter can only traverse the block from 0 and for the uninterested block also need to save itsHeader(BlockNumber, &'a Byte32, bool)
.What is changed and how it works?
This pr introduces the
init tip
setting, which can be set directly when the indexer initializes the database for the first time, which brings two benefits:What's Changed:
apply_init_tip
function, which is called inIndexerService::new
Related changes
This feature will also be used for index-r:
Check List
Tests
Header(BlockNumber, &'a Byte32, bool)
Side effects
Release note