Skip to content

Commit

Permalink
reinstating default and best_compression
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 committed Jul 20, 2023
1 parent a6922b6 commit 56d5686
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,19 @@ public CodecService(@Nullable MapperService mapperService, IndexSettings indexSe
}
if (mapperService == null) {
codecs.put(CodecType.DEFAULT.getName(), new Lucene95Codec());
codecs.put(CodecType.LZ4.getName(), new Lucene95Codec());
codecs.put(CodecType.BEST_COMPRESSION.getName(), new Lucene95Codec(Mode.BEST_COMPRESSION));
codecs.put(CodecType.ZLIB.getName(), new Lucene95Codec(Mode.BEST_COMPRESSION));
codecs.put(CodecType.ZSTD.getName(), new ZstdCodec(compressionLevel));
codecs.put(CodecType.ZSTD_NO_DICT.getName(), new ZstdNoDictCodec(compressionLevel));
} else {
codecs.put(CodecType.DEFAULT.getName(), new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
codecs.put(CodecType.LZ4.getName(), new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
codecs.put(
CodecType.BEST_COMPRESSION.getName(),
new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger)
);
codecs.put(CodecType.ZLIB.getName(), new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));
codecs.put(CodecType.ZSTD.getName(), new ZstdCodec(mapperService, logger, compressionLevel));
codecs.put(CodecType.ZSTD_NO_DICT.getName(), new ZstdNoDictCodec(mapperService, logger, compressionLevel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
public enum CodecType {

DEFAULT("default", Set.of()),
LZ4("lz4", Set.of()),
BEST_COMPRESSION("best_compression", Set.of()),
ZLIB("zlib", Set.of()),
ZSTD("zstd", Set.of(EngineConfig.INDEX_CODEC_COMPRESSION_LEVEL_SETTING)),
ZSTD_NO_DICT("zstd_no_dict", Set.of(EngineConfig.INDEX_CODEC_COMPRESSION_LEVEL_SETTING)),
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
public static final Setting<String> INDEX_CODEC_SETTING = new Setting<>("index.codec", "lz4", s -> {
switch (s) {
case "lz4":
case "default":
case "best_compression":
case "zlib":
case "zstd":
case "zstd_no_dict":
Expand All @@ -139,7 +141,8 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
default:
if (Codec.availableCodecs().contains(s) == false) { // we don't error message the not officially supported ones
throw new IllegalArgumentException(
"unknown value for [index.codec] must be one of [lz4, zlib, zstd, zstd_no_dict] but was: " + s
"unknown value for [index.codec] must be one of [default, best_compression, lz4, zlib, zstd, zstd_no_dict] but was: "
+ s
);
}
return s;
Expand Down

0 comments on commit 56d5686

Please sign in to comment.