Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Avoid reload block when seeking backward in SegmentTermsEnum. #13253
base: main
Are you sure you want to change the base?
Avoid reload block when seeking backward in SegmentTermsEnum. #13253
Changes from 11 commits
0da782d
d8ec44e
95fd6e0
60f3d26
25747e8
3969078
e7f7188
90997e3
258b061
21b21c9
a610c4e
ab465e0
73f4f3b
51ba012
b0567d7
4b5896c
14961a8
77af39f
597c126
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 am confused why there are two cases under the
rewindWithoutReload
case. One case you can roll backentCount
temporarily, because you know the target term is before the current term? And in the 2nd case, you don't know that, but you do know the target term is in this current block? But then why are we even rewinding?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.
We get
lastFrame
fromstack[0]
firstly, and comparetarget
to last seek'dterm
to updatelastFrame
to reuse seek state, and assign it tocurrentFrame
. ThiscurrentFrame
only got bytarget
and last seek'dterm
's common prefix, we still need to continue walking the index to seektarget
term's block.I think we need rewinding to set frame's state (
nextEnt
,entCount
, etc.) to prepare for seeking. Unlikerewind
,rewindWithoutReload
can keep loaded block's data (sameFP
).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.
rewindWithoutReload
is called when currentFrame's is loaded andfp
equalsfpOrig
.Doing this can avoid reload a loaded block, when we finally need seek it, and it is still in
stack
.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.
Maybe I was not clear. I mean we can
rewindWithoutReload
whencurrentFrame.fp == currentFrame.fpOrig
, base on this, if we finally seek the same block with lastterm
, roll backentCount
temporarily.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.
Maybe change to
we can rewind without reloading
? We don't seem to reduceentCount
anymore?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.
We can reduce entCount to nextEnt if we finally seek the same block.
This has been already implemented in: