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

[BUG FIX] Fix knn index shard to get bwc engine paths #309

Merged
merged 6 commits into from
Mar 8, 2022

Conversation

jmazanec15
Copy link
Member

Description

Fixes getEnginePaths in KNNIndexShard to retrieve all engine paths, regardless of what version the index was created. Prevents silent failure when warmup completes but doesnt load any segments.

Instead of checking if the engine file that the current version of the plugin would create is in the segment, it just checks the prefix and suffix of the file that would be created. To prevent this failure in the future, a new test was added. Intentionally, the structure is hardcoded. This will ensure that this will be caught in the future if segment file naming conventions change.

Issues Resolved

#308

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

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.

Fixes getEnginePaths in KNNIndexShard to retrieve all engine paths,
regardless of what version the index was created. Prevents silent
failure when warmup completes but doesnt load any segments.

Signed-off-by: John Mazanec <[email protected]>
@jmazanec15 jmazanec15 added Bug Fixes Changes to a system or product designed to handle a programming bug/glitch backport 1.x backport 1.2 label to add to PRs to auto backport labels Mar 8, 2022
@jmazanec15 jmazanec15 requested a review from a team March 8, 2022 00:46
Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
vamshin
vamshin previously approved these changes Mar 8, 2022
Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks.

Some checks seem to be failing. You may want to fix it.

protected Map<String, SpaceType> getEnginePaths(Collection<String> files, String segmentName, String fieldName,
String fileExtension, Path shardPath, SpaceType spaceType) {
return files.stream()
.filter(fileName -> fileName.startsWith(buildEngineFilePrefix(segmentName)))
Copy link
Member

@VijayanB VijayanB Mar 8, 2022

Choose a reason for hiding this comment

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

We don't have to compute buildEngineFilePrefix for every file. This can be called once outside streams and used inside filter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. Updated.

@jmazanec15
Copy link
Member Author

LGTM! Thanks.

Some checks seem to be failing. You may want to fix it.

Right. Its checkstyle. I was going to get review first before fixing it, as to not clutter the diff.

Signed-off-by: John Mazanec <[email protected]>
vamshin
vamshin previously approved these changes Mar 8, 2022
Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@martin-gaievski martin-gaievski self-requested a review March 8, 2022 18:46
martin-gaievski
martin-gaievski previously approved these changes Mar 8, 2022
naveentatikonda
naveentatikonda previously approved these changes Mar 8, 2022
Signed-off-by: John Mazanec <[email protected]>
@jmazanec15 jmazanec15 merged commit bb28393 into opensearch-project:main Mar 8, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 8, 2022
Fixes getEnginePaths in KNNIndexShard to retrieve all engine paths,
regardless of what version the index was created. Prevents silent
failure when warmup completes but doesnt load any segments.

Signed-off-by: John Mazanec <[email protected]>
(cherry picked from commit bb28393)
@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.2 failed:

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

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.2 1.2
# Navigate to the new working tree
cd .worktrees/backport-1.2
# Create a new branch
git switch --create backport/backport-309-to-1.2
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 bb283932b5834172142d18188668db8fa31676d6
# Push it to GitHub
git push --set-upstream origin backport/backport-309-to-1.2
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.2

Then, create a pull request where the base branch is 1.2 and the compare/head branch is backport/backport-309-to-1.2.

martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 30, 2022
…ject#309)

Fixes getEnginePaths in KNNIndexShard to retrieve all engine paths,
regardless of what version the index was created. Prevents silent
failure when warmup completes but doesnt load any segments.

Signed-off-by: John Mazanec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.x backport 1.2 label to add to PRs to auto backport Bug Fixes Changes to a system or product designed to handle a programming bug/glitch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants