Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
  • Loading branch information
sarthakaggarwal97 committed Sep 3, 2023
1 parent 518a90d commit a473a9e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public enum Mode {
/**
* ZStandard mode with dictionary
*/
ZSTD("zstd"),
ZSTD("Lucene95CustomCodec"),
/**
* ZStandard mode without dictionary
*/
ZSTD_NO_DICT("zstdnodict");
ZSTD_NO_DICT("Lucene95CustomCodec");

private final String codec;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ public void testBestCompressionWithCompressionLevel() {
}

public void testLuceneCodecsWithCompressionLevel() {
String codecName = randomFrom(Codec.availableCodecs());
Codec codec = Codec.forName(codecName);

final Settings customCodecSettings = Settings.builder()
.put(INDEX_CODEC_COMPRESSION_LEVEL_SETTING.getKey(), randomIntBetween(1, 6))
.put(EngineConfig.INDEX_CODEC_SETTING.getKey(), randomFrom("zstd", "zstd_no_dict"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
import java.util.Set;

/**
* This {@link CodecAliases} allows us to manage the settings with {@link Codec}.
* This {@link CodecAliases} to provide aliases for the {@link Codec}.
*
* @opensearch.internal
*/
public interface CodecAliases {

/**
* Retrieves a set of aliases for an codec.
*
* @return A non-null set of alias strings. If no aliases are available, an empty set should be returned.
*/
Set<String> aliases();
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
Codec codec = Codec.forName(codecName);
if (codec instanceof CodecAliases) {
CodecAliases codecWithAlias = (CodecAliases) codec;
if (codecWithAlias.aliases() != null && codecWithAlias.aliases().contains(s)) {
if (codecWithAlias.aliases().contains(s)) {
return s;
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ private static void doValidateCodecSettings(final String codec) {
Codec availableCodec = Codec.forName(codecName);
if (availableCodec instanceof CodecAliases) {
CodecAliases availableCodecWithAlias = (CodecAliases) availableCodec;
if (availableCodecWithAlias.aliases() != null && availableCodecWithAlias.aliases().contains(codec)) {
if (availableCodecWithAlias.aliases().contains(codec)) {
if (availableCodec instanceof CodecSettings
&& ((CodecSettings) availableCodec).supports(INDEX_CODEC_COMPRESSION_LEVEL_SETTING)) {
return;
Expand Down

0 comments on commit a473a9e

Please sign in to comment.