-
Notifications
You must be signed in to change notification settings - Fork 668
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: add index for stacks block id in nakamoto_block_headers #5414
Conversation
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.
Do we need a new schema version?
I didn't think so -- doesn't the index creation code just always run and check if indexes need to be created? |
oops, I missed the |
Nope, I was wrong! if create_flag {
// instantiate!
StacksChainState::instantiate_db(mainnet, chain_id, index_path, true)
} else {
let mut marf = StacksChainState::open_index(index_path)?;
if !Self::need_schema_migrations(marf.sqlite_conn(), mainnet, chain_id)? {
return Ok(marf);
}
// need a migration
let tx = marf.storage_tx()?;
StacksChainState::apply_schema_migrations(&tx, mainnet, chain_id)?;
StacksChainState::add_indexes(&tx)?;
tx.commit()?; Will add a schema version. |
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.
Minor nit, but fine to ignore
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, just the comment nit.
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!
Description
Optimization: add index for
index_block_hash
innakamoto_block_headers