-
Notifications
You must be signed in to change notification settings - Fork 141
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
Discover indexes sequentially #2379
Discover indexes sequentially #2379
Conversation
c1e96aa
to
21430cb
Compare
54b6e5c
to
b2f956f
Compare
b2f956f
to
2d9662b
Compare
[skip changelog]
2d9662b
to
809ea24
Compare
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.
I left minor comments 🙏
// Adjust offset if it skipped some previous chains. | ||
(offset, previousChainTipIndex) = | ||
GetPreviousChainInfo(chainInfos.Peek().Item1) is { } cinfo | ||
? (Math.Max(0, (int)(offset - cinfo.Item2 - 1)), (int)cinfo.Item2) |
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.
Is this casting (i.e., (int)
) safe? I guess (long)
seems natural... (of course, it is unnatural that offset
was int
, but... 🤔 )
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.
Yes, I agree about it. In my thought, it was int
because LINQ Enumerable.Skip
supports only int
type as argument 😭 So... it may be better to skip manually (with continue
in for-loop
)
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.
I made it handle block indexes as long
type instead of int
type in cdc8b2a. Please review again 🙇🏻♂️
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
…entially Discover indexes sequentially
This pull request tries to resolve #2338.
Overview
Since #1606, the blockchain node has been forking chain while syncing blocks. So there are too many forked chain ids. And they occur very deep recursion depth (stack overflow).
So this pull request makes
RocksDBStore.IterateIndexes
discover indexes sequentially without recursion. Fetch chain ids and store it as stack, iterate them.