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 19, 2023
1 parent dd094a0 commit f7b3ba3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class CodecService {
* the raw unfiltered lucene default. useful for testing
*/
public static final String LUCENE_DEFAULT_CODEC = "lucene_default";
public static final String DEFAULT = "default";
public static final String BEST_COMPRESSION = "best_compression";
public static final String ZSTD_CODEC = "zstd";
public static final String ZSTD_NO_DICT_CODEC = "zstd_no_dict";

Expand All @@ -80,12 +82,16 @@ public CodecService(@Nullable MapperService mapperService, IndexSettings indexSe
}
if (mapperService == null) {
codecs.put(LZ4_CODEC, new Lucene95Codec());
codecs.put(DEFAULT, new Lucene95Codec());
codecs.put(ZLIB_CODEC, new Lucene95Codec(Mode.BEST_COMPRESSION));
codecs.put(BEST_COMPRESSION, new Lucene95Codec(Mode.BEST_COMPRESSION));
codecs.put(ZSTD_CODEC, new ZstdCodec(compressionLevel));
codecs.put(ZSTD_NO_DICT_CODEC, new ZstdNoDictCodec(compressionLevel));
} else {
codecs.put(LZ4_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
codecs.put(DEFAULT, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger));
codecs.put(ZLIB_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));
codecs.put(BEST_COMPRESSION, new PerFieldMappingPostingFormatCodec(Mode.BEST_COMPRESSION, mapperService, logger));
codecs.put(ZSTD_CODEC, new ZstdCodec(mapperService, logger, compressionLevel));
codecs.put(ZSTD_NO_DICT_CODEC, new ZstdNoDictCodec(mapperService, logger, compressionLevel));
}
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 f7b3ba3

Please sign in to comment.