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

Fix record skipping when querying paginated data across shards #3061

Merged
merged 7 commits into from
Oct 13, 2024

Conversation

Swiddis
Copy link
Collaborator

@Swiddis Swiddis commented Oct 8, 2024

Description

When pulling unordered data from an index with multiple shards, data gets lost if the fetchSize is not a multiple of the shard count, as the persisted cursor position to continue paging is based on the last seen _doc which is duplicated when the primary shard count exceeds 1. This PR currently adds a reproducer for the bug -- finding a fix is still in progress.

Related Issues

#3064

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@Swiddis Swiddis force-pushed the bugfix/pagination-mismatch branch from ba741cd to e143507 Compare October 8, 2024 23:49
@Swiddis Swiddis added the bug Something isn't working label Oct 9, 2024
Signed-off-by: Simeon Widdis <[email protected]>
Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

Does it impact Join in legacy module also?

@@ -189,6 +189,9 @@ public OpenSearchResponse searchWithPIT(Function<SearchRequest, SearchResponse>
// Set sort field for search_after
if (this.sourceBuilder.sorts() == null) {
this.sourceBuilder.sort(DOC_FIELD_NAME, ASC);
// Workaround to preserve sort location more exactly,
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this is workaround, could u add the long-term solution issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

penghuo
penghuo previously approved these changes Oct 10, 2024
Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

Thx!

@penghuo
Copy link
Collaborator

penghuo commented Oct 10, 2024

what is the plan for Join in legacy module?
it is ok to public separate PR, just want to make sure it is planned.

@Swiddis Swiddis added the v2.18.0 Issues targeting release v2.18.0 label Oct 10, 2024
@penghuo penghuo added backport 2.x and removed v2.18.0 Issues targeting release v2.18.0 labels Oct 11, 2024
Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

Thx!

@Swiddis Swiddis merged commit e838e46 into opensearch-project:main Oct 13, 2024
13 of 14 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-3061-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e838e46f20c164fe00a907725034ea9896b90f93
# Push it to GitHub
git push --set-upstream origin backport/backport-3061-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-3061-to-2.x.

@Swiddis Swiddis added the v2.18.0 Issues targeting release v2.18.0 label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport-failed bug Something isn't working v2.18.0 Issues targeting release v2.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants