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

[Access] Bootstrap register db and start indexer #4780

Merged
merged 8 commits into from
Oct 3, 2023

Conversation

peterargue
Copy link
Contributor

@peterargue peterargue commented Sep 29, 2023

Closes: #4778

Bootstrap the register db and start the indexer on Access nodes.

Base automatically changed from petera/4739-index-tx-results-events to master September 29, 2023 19:25
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f7a3a89) 55.78% compared to head (72b79ba) 57.17%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4780      +/-   ##
==========================================
+ Coverage   55.78%   57.17%   +1.38%     
==========================================
  Files         939      773     -166     
  Lines       86902    72771   -14131     
==========================================
- Hits        48480    41607    -6873     
+ Misses      34771    27998    -6773     
+ Partials     3651     3166     -485     
Flag Coverage Δ
unittests 57.17% <ø> (+1.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 175 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterargue peterargue self-assigned this Sep 29, 2023
// other components from starting while bootstrapping the register db since it may
// take hours to complete.

pdb, err := pStorage.OpenRegisterPebbleDB(builder.registersDBPath)
Copy link
Member

@sideninja sideninja Oct 2, 2023

Choose a reason for hiding this comment

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

How come this is not created as a module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it could be, but we only use it here so I figured it wasn't necessary.

// since indexing is done using execution data, make sure that execution data
// will be available starting at the checkpoint height. otherwise, the indexer
// will fail to progress.
if builder.checkpointHeight < builder.executionDataConfig.InitialBlockHeight {
Copy link
Member

@sideninja sideninja Oct 2, 2023

Choose a reason for hiding this comment

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

This is out of the scope of this PR but is there no way to get the height of the checkpoint from the checkpoint? This feels like we could set it to the wrong value or skip some heights by mistake. cc @zhangchiqing @koko1123

Also, is the check sufficient? What if the checkpoint height is bigger than the initial height of exe data, isn't that unexpected too? Shouldn't the height always be -1 the exe data height? What is the case where this is not true?

Copy link
Contributor

Choose a reason for hiding this comment

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

This check is sufficient for root block, but is not a check we should keep if we're using a checkpoint generated by dynamic bootstrap later, but we're at least 3 months away from that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there no way to get the height of the checkpoint from the checkpoint?

my understanding is that checkpoints currently do not include the height. That is coming in a future improvement from the storehouse work.

Also, is the check sufficient? What if the checkpoint height is bigger than the initial height of exe data, isn't that unexpected too? Shouldn't the height always be -1 the exe data height? What is the case where this is not true?

At the beginning of the spork, checkpointHeight should the the same as InitialBlockHeight. Both should be the root height. For nodes starting after the spork, or using a smaller execution data retention window, they may not be the same.

My 2 cents is it's better to be flexible where possible (and safe). that way the software can handle situations we may not anticipated, like recovering from an outage. In this case, we just need to make sure that the configuration allows for indexing to work. As long as there is execution data available from checkpoint + 1 and higher, the indexer will be able to progress.

Copy link
Member

Choose a reason for hiding this comment

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

Good thinking.

Copy link
Member

@sideninja sideninja left a comment

Choose a reason for hiding this comment

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

Nice


return builder.ExecutionDataRequester, nil
})

if builder.executionDataIndexingEnabled {
Copy link
Member

@sideninja sideninja Oct 2, 2023

Choose a reason for hiding this comment

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

I see there are a couple of scenarios where building a component depends on a boolean flag, would it make sense to have a builder option for it, something like so:

builder.
    Requires(builder.executionDataIndexingEnabled).
    Module("...") // ...

If the value is false the whole procedure would stop. Likely unrelated to this PR, just as a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, that's a cool idea. It would require a bit of refactoring in the node builder, but could make some of the bootstrapping logic cleaner.

There aren't a ton of places we load conditional modules/components like this though. mostly in the AN/ON codebase since they have more user options


checkpointFile := builder.checkpointFile
if checkpointFile == cmd.NotSet {
checkpointFile = path.Join(builder.BootstrapDir, bootstrap.PathRootCheckpoint)
Copy link
Member

Choose a reason for hiding this comment

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

should we make this file bootstrap.PathRootCheckpoint to be used by the bootstraping checkpoint as well? what is this file used for otherwise? for producing checkpoint on demand?

err = wal.StoreCheckpointV6([]*trie.MTrie{matchTrie}, dbDir, bootstrapCheckpointFile, zerolog.Nop(), 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a good question. what's your take @zhangchiqing ?

Copy link
Member

Choose a reason for hiding this comment

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

yes, we can

@peterargue peterargue added this pull request to the merge queue Oct 3, 2023
Merged via the queue into master with commit 0bdbb8e Oct 3, 2023
36 checks passed
@peterargue peterargue deleted the petera/4778-bootstrap-an-indexer-db-1 branch October 3, 2023 21:26
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Access] Load indexer and register db in node bootstrap
5 participants