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

Make index.codec setting case-insensitive. #7171

Closed
wants to merge 6 commits into from

Conversation

mulugetam
Copy link
Contributor

Description

OpenSearch currently supports default, best_compression, lucene_default, and ZSTD compression codecs for index.codec. The setting uses a case-sensitive comparison. If the user supplies BEST_COMPRESSION, for example, OpenSearch uses the default (LZ4) codec and not best_compression (deflate).

This PR addresses the issue by allowing a case-insensitive match for the setting. 

Issues Resolved

index.codec: BEST_COMPRESSION falls back to default (lz4) and not best_compression (deflate).

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@dblock
Copy link
Member

dblock commented Apr 17, 2023

If the user supplies BEST_COMPRESSION, for example, OpenSearch uses the default (LZ4) codec and not best_compression (deflate).

I would expect an error, is this not the case? What if I specify foobar as a coded? Do we fallback silently?

This is an interface change that breaks bcw isn't it? If user was supplying LUCENE_DEFAULT before, were they getting lz4 quietly and would now be getting lucene_default?

mulugetam and others added 2 commits April 17, 2023 12:12
…java

Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: mulugetam <mulugeta.mammo@intel.com>
Co-authored-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: mulugetam <mulugeta.mammo@intel.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mulugetam
Copy link
Contributor Author

If the user supplies BEST_COMPRESSION, for example, OpenSearch uses the default (LZ4) codec and not best_compression (deflate).

I would expect an error, is this not the case? What if I specify foobar as a coded? Do we fallback silently?

This is an interface change that breaks bcw isn't it? If user was supplying LUCENE_DEFAULT before, were they getting lz4 quietly and would now be getting lucene_default?

My bad, apparently the silent fallback has to do with OpenSearch-Benchmark (was using it for tests) and not OpenSearch. A direct REST call to OpenSearch with BEST_COMPRESSION throws an exception as expected.

I think the question now is whether we should allow for a case-insensitive match. I think we should. The current compression codecs are all in lower case except ZSTD: default, lucene_default, best_compression, ZSTD. I think we should either allow a case-insensitive matching or I should change ZSTD to zstd.

@mulugetam
Copy link
Contributor Author

OpenSearch-Benchmark bug report: opensearch-project/opensearch-benchmark#268

@dblock @reta

@andrross
Copy link
Member

I think we should either allow a case-insensitive matching or I should change ZSTD to zstd.

I vote for changing ZSTD to zstd for consistency, and keeping the case-sensitive behavior. I think we can make the backward-incompatible change as ZSTD support hasn't been released yet.

@reta
Copy link
Collaborator

reta commented Apr 17, 2023

OpenSearch-Benchmark bug report: opensearch-project/opensearch-benchmark#268

@dblock @reta

Thanks @mulugetam

I think the question now is whether we should allow for a case-insensitive match.

I would genuinely be surprised if ZSTD and zstd would be treated differently as codec name, may be we could use the case insensitive data structures for that:

        this.codecs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
        this.codecs.putAll(codecs.map());

Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
throw new IllegalArgumentException(
"unknown value for [index.codec] must be one of [default, best_compression] but was: " + s
"unknown value for [index.codec] must be one of [default, best_compression, lucene_default] or "
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're allowing for users to set it to lucene_default and/or one of the listed available codecs (Lucene80, Lucene70, etc), this needs to be documented on the static settings for index creation for index.codec setting.

Ref: https://opensearch.org/docs/2.4/api-reference/index-apis/create-index/#static-index-settings

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

…java

Co-authored-by: Poojita Raj <poojiraj@amazon.com>
Signed-off-by: mulugetam <mulugeta.mammo@intel.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@mulugetam
Copy link
Contributor Author

Looks like @dblock @andrross @Poojita-Raj and for a case-sensitive index.codec. @reta, may I close this PR? (I will create a new one that changes ZSTD to zstd)?

@reta
Copy link
Collaborator

reta commented Apr 18, 2023

Looks like @dblock @andrross @Poojita-Raj and for a case-sensitive index.codec. @reta, may I close this PR? (I will create a new one that changes ZSTD to zstd)?

Sure, thanks @mulugetam !

@mulugetam
Copy link
Contributor Author

Closing this PR and creating #7231 that changes the codec name from ZSTD to zstd.

@dblock @reta

@mulugetam mulugetam closed this Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants