Skip to content

Commit

Permalink
Remove hard-coded values for default compression level.
Browse files Browse the repository at this point in the history
Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
  • Loading branch information
mulerm authored and mulugetam committed Apr 4, 2024
1 parent 98947b1 commit ef53f3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
import org.apache.lucene.codecs.FilterCodec;
import org.apache.lucene.codecs.StoredFieldsFormat;
import org.apache.lucene.codecs.lucene99.Lucene99Codec;
import org.opensearch.common.settings.Settings;
import org.opensearch.index.codec.PerFieldMappingPostingFormatCodec;
import org.opensearch.index.mapper.MapperService;

import java.util.Set;

import static org.opensearch.index.engine.EngineConfig.INDEX_CODEC_COMPRESSION_LEVEL_SETTING;

/**
*
* Extends {@link FilterCodec} to reuse the functionality of Lucene Codec.
Expand All @@ -28,7 +31,7 @@
public abstract class Lucene99CustomCodec extends FilterCodec {

/** Default compression level used for compression */
public static final int DEFAULT_COMPRESSION_LEVEL = 3;
public static final int DEFAULT_COMPRESSION_LEVEL = INDEX_CODEC_COMPRESSION_LEVEL_SETTING.getDefault(Settings.EMPTY);

/** Each mode represents a compression algorithm. */
public enum Mode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@

import com.intel.qat.QatZipper;

import static org.opensearch.index.engine.EngineConfig.INDEX_CODEC_COMPRESSION_LEVEL_SETTING;

/**
* Extends {@link FilterCodec} to reuse the functionality of Lucene Codec.
*
* @opensearch.internal
*/
public abstract class Lucene99QatCodec extends FilterCodec {

/** Default compression level used for compression */
public static final int DEFAULT_COMPRESSION_LEVEL = 6;

/** A setting to specifiy the QAT acceleration mode. */
public static final Setting<QatZipper.Mode> INDEX_CODEC_QAT_MODE_SETTING = new Setting<>("index.codec.qatmode", "auto", s -> {
switch (s) {
Expand All @@ -45,9 +44,12 @@ public abstract class Lucene99QatCodec extends FilterCodec {
}
}, Property.IndexScope, Property.Dynamic);

/** Just a terse way to reference the default execution mode. */
/** A terse way to reference the default QAT execution mode. */
public static final QatZipper.Mode DEFAULT_QAT_MODE = INDEX_CODEC_QAT_MODE_SETTING.getDefault(Settings.EMPTY);

/** Default compression level used for compression */
public static final int DEFAULT_COMPRESSION_LEVEL = INDEX_CODEC_COMPRESSION_LEVEL_SETTING.getDefault(Settings.EMPTY);

/** Each mode represents a compression algorithm. */
public enum Mode {
/** QAT lz4 mode. */
Expand Down

0 comments on commit ef53f3b

Please sign in to comment.