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

Fix: avoid ZSTD codec from overriding service codec factory. #7037

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `net.minidev:json-smart` from 2.4.7 to 2.4.10
- Bump `org.apache.maven:maven-model` from 3.6.2 to 3.9.1
- Bump `org.codehaus.jettison:jettison` from 1.5.3 to 1.5.4 ([#6878](https://github.com/opensearch-project/OpenSearch/pull/6878))
- Add `com.github.luben:zstd-jni:1.5.4-1` ([#3577](https://github.com/opensearch-project/OpenSearch/pull/3577))
- Add `com.github.luben:zstd-jni:1.5.5-1` ([#3577](https://github.com/opensearch-project/OpenSearch/pull/3577))
- Bump: Netty from 4.1.90.Final to 4.1.91.Final , ASM 9.4 to ASM 9.5, ByteBuddy 1.14.2 to 1.14.3 ([#6981](https://github.com/opensearch-project/OpenSearch/pull/6981))
- Bump `com.azure:azure-storage-blob` from 12.15.0 to 12.21.1

Expand Down
2 changes: 1 addition & 1 deletion sandbox/plugins/custom-codecs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ opensearchplugin {
}

dependencies {
api "com.github.luben:zstd-jni:1.5.4-1"
api "com.github.luben:zstd-jni:1.5.5-1"
}

yamlRestTest.enabled = false;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fda1d6278299af27484e1cc3c79a060e41b7ef7e
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.EnginePlugin;
import org.opensearch.index.codec.CodecServiceFactory;
import org.opensearch.index.IndexSettings;

import java.util.Optional;

/**
* A plugin that implements custom codecs. Supports these codecs:
Expand All @@ -25,16 +21,6 @@
* @opensearch.internal
*/
public final class CustomCodecPlugin extends Plugin implements EnginePlugin {

/** Creates a new instance */
/** Creates a new instance. */
public CustomCodecPlugin() {}

/**
* @param indexSettings is the default indexSettings
* @return the engine factory
*/
@Override
public Optional<CodecServiceFactory> getCustomCodecServiceFactory(final IndexSettings indexSettings) {
return Optional.of(new CustomCodecServiceFactory());
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public Lucene95CustomStoredFieldsFormat(Lucene95CustomCodec.Mode mode, int compr
zstdNoDictCompressionMode = new ZstdNoDictCompressionMode(compressionLevel);
}

/**
* Returns a {@link StoredFieldsReader} to load stored fields.
* @param directory The index directory.
* @param si The SegmentInfo that stores segment information.
* @param fn The fieldInfos.
* @param context The IOContext that holds additional details on the merge/search context.
*/
@Override
public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, FieldInfos fn, IOContext context) throws IOException {
String value = si.getAttribute(MODE_KEY);
Expand All @@ -71,6 +78,12 @@ public StoredFieldsReader fieldsReader(Directory directory, SegmentInfo si, Fiel
return impl(mode).fieldsReader(directory, si, fn, context);
}

/**
* Returns a {@link StoredFieldsReader} to write stored fields.
* @param directory The index directory.
* @param si The SegmentInfo that stores segment information.
* @param context The IOContext that holds additional details on the merge/search context.
*/
@Override
public StoredFieldsWriter fieldsWriter(Directory directory, SegmentInfo si, IOContext context) throws IOException {
String previous = si.putAttribute(MODE_KEY, mode.name());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public ZstdCodec(int compressionLevel) {
super(Mode.ZSTD, compressionLevel);
}

/** The name for this codec. */
@Override
public String toString() {
return getClass().getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ protected ZstdCompressionMode(int compressionLevel) {
this.compressionLevel = compressionLevel;
}

/** Creates a new compressor instance.*/
@Override
public Compressor newCompressor() {
return new ZstdCompressor(compressionLevel);
}

/** Creates a new decompressor instance. */
@Override
public Decompressor newDecompressor() {
return new ZstdDecompressor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public ZstdNoDictCodec(int compressionLevel) {
super(Mode.ZSTDNODICT, compressionLevel);
}

/** The name for this codec. */
@Override
public String toString() {
return getClass().getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ protected ZstdNoDictCompressionMode(int compressionLevel) {
this.compressionLevel = compressionLevel;
}

/** Creates a new compressor instance.*/
@Override
public Compressor newCompressor() {
return new ZstdCompressor(compressionLevel);
}

/** Creates a new decompressor instance. */
@Override
public Decompressor newDecompressor() {
return new ZstdDecompressor();
Expand Down