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

Segregate advance and advanceUninterruptibly flow in postJoinCursor to allow for interrupts in advance #15222

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ public static PostJoinCursor wrap(
}

private void advanceToMatch()
{
if (valueMatcher != null) {
while (!isDone() && !valueMatcher.matches(false)) {
baseCursor.advance();
}
}
}

private void advanceToMatchUninterruptibly()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please leave a comment here that this can be a long-running CPU call. Which is why advanceUninterruptibly is not directly used in advance() call unlike other cursors. Please link the github issue in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

{
if (valueMatcher != null) {
while (!isDone() && !valueMatcher.matches(false)) {
Expand Down Expand Up @@ -99,15 +108,15 @@ public Filter getPostJoinFilter()
@Override
public void advance()
{
advanceUninterruptibly();
BaseQuery.checkInterrupted();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a note on why the checkInterrupted() is not needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment.

baseCursor.advance();
Copy link
Contributor

Choose a reason for hiding this comment

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

Will be good to put some comments as in why this change is being done in the code for a future developer to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments.

advanceToMatch();
}

@Override
public void advanceUninterruptibly()
{
baseCursor.advanceUninterruptibly();
advanceToMatch();
advanceToMatchUninterruptibly();
}

@Override
Expand Down
Loading