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

Making version of lucene k-nn engine match lucene current version #691

Conversation

martin-gaievski
Copy link
Member

Signed-off-by: Martin Gaievski gaievski@amazon.com

Description

Update version of Lucene kNN engine, it matches version of Lucene that is coming with core OpenSearch. Currently it's used as engine text description, it shouldn't cause bwc issues.

Check List

  • All tests pass
  • 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.

@martin-gaievski martin-gaievski added Maintenance Add support for new versions of OpenSearch/Dashboards from upstream backport 2.x v2.5.0 'Issues and PRs related to version v2.5.0' labels Dec 22, 2022
@martin-gaievski martin-gaievski requested a review from a team December 22, 2022 18:19
@martin-gaievski martin-gaievski force-pushed the lucene-engine-version-match-lucene-current-version branch from 8a8ffab to e6c69a5 Compare December 22, 2022 18:27

public void testVersion() {
Lucene luceneInstance = Lucene.INSTANCE;
assertEquals("9.5.0", luceneInstance.getVersion());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test will fail when OS upgrades to a new version. Let's not hard code this version. See if we can get this value from some other constant which is present in OS. So that when that constants updates the test uses the latest version.

I think you can use Version.LATEST.toString()

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it will fail on OS upgrade, I actually done it on purpose for us to make sure version upgrade doesn't flow unattended, like it was with 9.2 that made all the way up to 9.5. With variables it's harder to check which exact value it has.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But here is the problem, if we have hard code the value as "9.5.0" as intentional, then in src file too we should make it 9.5.0 rather than Version.LATEST.toString(). Because the next time this Unit test will fail and then we need to take a decision whether to upgrade or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we need to discuss if k-NN engine is different from codec. For codec now we may have 9.4 (through bwc package) but lucene library will be 9.5. Does it mean the whole lucene k-NN engine is 9.4 as well? Engine is kNN concept, we can change it as needed.
We use codec, reader, writer, format that are essentially coming from codec. But rest of classes are from current lucene version (9.5 in my example).

My opinion - version of codec and engine should match. IMO we should upgrade to latest codec from our lucene version (like 9.5 that is in 2.5 snapshot). But if can keep older codec versions then engine should remain 9.4 too.
@jmazanec15 what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Here is our current guidance on Codec versioning: https://github.com/opensearch-project/k-NN/blob/main/DEVELOPER_GUIDE.md#codec-versioning.

Right now, we have 2 versioning systems - the first marks the codec version used for lucene, the second marks the version for k-NN. This is a bit confusing, however, I believe that the reasoning is so that we can properly read older segment files.

Copy link
Collaborator

@navneet1v navneet1v Dec 24, 2022

Choose a reason for hiding this comment

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

@martin-gaievski on doing some deep-dive I understand the purpose of this code change better. We are updating the version of lucene, which is not related to codec over here.

My opinion - version of codec and engine should match. IMO we should upgrade to latest codec from our lucene version (like 9.5 that is in 2.5 snapshot). But if can keep older codec versions then engine should remain 9.4 too.

I agree that we should upgrade the codec version to include the latest codec. I will pick up that change.

But still my first comment hold over here. In the test we should not hard code string as "9.5.0", we should get this from Version.LATEST.toString(). Because this is unit test we want to make sure that if someone changes the value to other version which is not latest, in the src files tests should detect it. I don't feel comfortable in putting a hardcoded value in test. Here is another option we can explore, we can update the src file variable to take value from OpenSearch instead of Lucene. ref: https://github.com/opensearch-project/OpenSearch/blob/2.x/server/src/main/java/org/opensearch/Version.java#L108-L109

Copy link
Member Author

Choose a reason for hiding this comment

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

ack, let me update to Version.LATEST

@codecov-commenter
Copy link

Codecov Report

Merging #691 (e6c69a5) into main (c412c8a) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #691      +/-   ##
============================================
- Coverage     84.46%   84.42%   -0.05%     
+ Complexity     1055     1053       -2     
============================================
  Files           149      149              
  Lines          4307     4307              
  Branches        385      385              
============================================
- Hits           3638     3636       -2     
- Misses          489      491       +2     
  Partials        180      180              
Impacted Files Coverage Δ
...ain/java/org/opensearch/knn/index/util/Lucene.java 93.33% <100.00%> (ø)
...earch/knn/index/codec/KNN910Codec/KNN910Codec.java 87.50% <0.00%> (-12.50%) ⬇️
...earch/knn/index/codec/KNN920Codec/KNN920Codec.java 81.81% <0.00%> (-9.10%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@martin-gaievski martin-gaievski force-pushed the lucene-engine-version-match-lucene-current-version branch from 93f987f to efcd5c2 Compare January 3, 2023 20:58
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski martin-gaievski force-pushed the lucene-engine-version-match-lucene-current-version branch from efcd5c2 to 5841a20 Compare January 4, 2023 19:02
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski martin-gaievski force-pushed the lucene-engine-version-match-lucene-current-version branch from 5841a20 to 689ca09 Compare January 4, 2023 19:04
@martin-gaievski martin-gaievski merged commit 577205e into opensearch-project:main Jan 6, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 6, 2023
* Making version of lucene k-nn engine match lucene current version

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
(cherry picked from commit 577205e)
martin-gaievski added a commit that referenced this pull request Jan 6, 2023
…) (#712)

* Making version of lucene k-nn engine match lucene current version

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
(cherry picked from commit 577205e)

Co-authored-by: Martin Gaievski <gaievski@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Maintenance Add support for new versions of OpenSearch/Dashboards from upstream v2.5.0 'Issues and PRs related to version v2.5.0'
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants