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

Allow null value for params in method mappings #354

Merged
merged 5 commits into from
Apr 5, 2022

Conversation

jmazanec15
Copy link
Member

Description

By default, in OpenSearch 1.0 and 1.1, if parameters were not set for method definitions, they were assigned a value of null. This causes an issue on upgrade to 1.2+, where null values for parameters are not accepted and throw a MappingParsingException.

The fix is to skip parsing the parameter value as a map in the input JSON if it is null.

Issues Resolved

#353

Check List

  • 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.

Adds tests to reproduce Mapping Parsing Error when the parameters take
the value null. Confirmed that both tests fail.

Signed-off-by: John Mazanec <[email protected]>
Allow user to input null value for parameters field for KNNMethodContext
and MethodComponentContext.

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 backport 1.3 Backports PRs to 1.3 branch labels Apr 5, 2022
@jmazanec15 jmazanec15 requested a review from a team April 5, 2022 18:28
@codecov-commenter
Copy link

Codecov Report

Merging #354 (77ffa9b) into main (d9a9f59) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #354      +/-   ##
============================================
+ Coverage     83.99%   84.00%   +0.01%     
- Complexity      900      902       +2     
============================================
  Files           130      130              
  Lines          3854     3858       +4     
  Branches        353      355       +2     
============================================
+ Hits           3237     3241       +4     
  Misses          457      457              
  Partials        160      160              
Impacted Files Coverage Δ
...ava/org/opensearch/knn/index/KNNMethodContext.java 93.18% <100.00%> (+0.15%) ⬆️
...g/opensearch/knn/index/MethodComponentContext.java 90.90% <100.00%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9a9f59...77ffa9b. Read the comment docs.

martin-gaievski
martin-gaievski previously approved these changes Apr 5, 2022
Copy link
Member

@martin-gaievski martin-gaievski left a comment

Choose a reason for hiding this comment

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

looks good, thank you

VijayanB
VijayanB previously approved these changes Apr 5, 2022
Adding BWC test. Currently it fails for 1.1 to 1.2+. Will fix in
subsequent commit.

Signed-off-by: John Mazanec <[email protected]>
@jmazanec15 jmazanec15 dismissed stale reviews from VijayanB and martin-gaievski via 8ffcd3c April 5, 2022 19:22
Adds support for parameters set to null so that index upgrades do not
fail.

Signed-off-by: John Mazanec <[email protected]>
@martin-gaievski
Copy link
Member

Have you tried to run bwc on 1.2, I think that's the version where the issue can be reproduced with your new bwc test but without the code change?

martin-gaievski
martin-gaievski previously approved these changes Apr 5, 2022
Copy link
Member

@martin-gaievski martin-gaievski left a comment

Choose a reason for hiding this comment

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

looks good, thank you

Released versions 1.2 and 1.3 do not support setting parameters to null
so they will fail the test.

Signed-off-by: John Mazanec <[email protected]>
@jmazanec15 jmazanec15 merged commit b08127c into opensearch-project:main Apr 5, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 5, 2022
Allow user to input null value for parameters field for KNNMethodContext
and MethodComponentContext. Adds tests to reproduce Mapping Parsing Error when the parameters take
the value null as well as BWC tests.

Signed-off-by: John Mazanec <[email protected]>
(cherry picked from commit b08127c)
@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-354-to-1.2
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b08127c2c4dcd1844072302e838f44897c8f18f5
# Push it to GitHub
git push --set-upstream origin backport/backport-354-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-354-to-1.2.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 5, 2022
Allow user to input null value for parameters field for KNNMethodContext
and MethodComponentContext. Adds tests to reproduce Mapping Parsing Error when the parameters take
the value null as well as BWC tests.

Signed-off-by: John Mazanec <[email protected]>
(cherry picked from commit b08127c)
jmazanec15 added a commit to jmazanec15/k-NN-1 that referenced this pull request Apr 5, 2022
Allow user to input null value for parameters field for KNNMethodContext
and MethodComponentContext. Adds tests to reproduce Mapping Parsing Error when the parameters take
the value null as well as BWC tests.

Signed-off-by: John Mazanec <[email protected]>
(cherry picked from commit b08127c)
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 backport 1.3 Backports PRs to 1.3 branch Bug Fixes Changes to a system or product designed to handle a programming bug/glitch v2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants