-
Notifications
You must be signed in to change notification settings - Fork 40
Enable RFS for ES 8x as a Source cluster #1491
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
Changes from all commits
881a1ad
65d4465
472b135
8d41ce8
f23552b
fea49af
ac390ea
ad306c7
b13f78b
df38f88
8c7be3a
c869b3f
24dfbb1
7f0dc09
bed5fca
622c685
e68956c
af96cd8
e524802
e6b93ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.opensearch.migrations.bulkload.lucene.version_9; | ||
|
||
import java.io.IOException; | ||
import java.util.Iterator; | ||
|
||
import shadow.lucene9.org.apache.lucene.codecs.FieldsConsumer; | ||
import shadow.lucene9.org.apache.lucene.codecs.FieldsProducer; | ||
import shadow.lucene9.org.apache.lucene.codecs.PostingsFormat; | ||
import shadow.lucene9.org.apache.lucene.index.SegmentReadState; | ||
import shadow.lucene9.org.apache.lucene.index.SegmentWriteState; | ||
import shadow.lucene9.org.apache.lucene.index.Terms; | ||
import shadow.lucene9.org.apache.lucene.store.Directory; | ||
|
||
/** | ||
* PostingsFormat fallback for Elasticsearch 8.12+ segment formats. | ||
* | ||
* <p>This class provides a dummy implementation for "ES812Postings" to avoid runtime | ||
* errors when Lucene 9 attempts to load this postings format from snapshot-based | ||
* segment metadata during document migration.</p> | ||
* | ||
* <p>This migration assistant does not support reading real ES 8.x segment data that uses | ||
* proprietary `.psm` files. If any `.psm` file is detected, we fail fast with a clear error | ||
* message. Otherwise, an empty FieldsProducer is returned to simulate a no-op reader.</p> | ||
* | ||
* <p>Registered via Lucene's SPI to allow dynamic loading based on PostingsFormat name | ||
* stored in segment metadata.</p> | ||
* | ||
* <p><b>NOTE:</b> This class is intentionally limited to fallback behavior and not meant | ||
* to parse actual ES 8.x Lucene segments.</p> | ||
*/ | ||
public class IgnorePsmPostings extends PostingsFormat { | ||
|
||
public IgnorePsmPostings() { | ||
super("ES812Postings"); | ||
} | ||
|
||
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException { | ||
throw new UnsupportedOperationException("ES812Postings is read-only fallback"); | ||
} | ||
|
||
@Override | ||
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException { | ||
Directory dir = state.directory; | ||
for (String file : dir.listAll()) { | ||
if (file.endsWith(".psm")) { | ||
throw new UnsupportedOperationException( | ||
"Detected .psm file in segment, which is not supported by the migration assistant. " + | ||
"Your index may be using a newer/proprietary ES format. Migration cannot proceed." | ||
); | ||
} | ||
} | ||
return new FieldsProducer() { | ||
@Override public void close() {} | ||
@Override public void checkIntegrity() {} | ||
@Override public Iterator<String> iterator() { | ||
return java.util.Collections.emptyIterator(); | ||
} | ||
@Override public Terms terms(String field) { | ||
return null; | ||
} | ||
@Override public int size() { | ||
return 0; | ||
} | ||
}; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.opensearch.migrations.bulkload.lucene.version_9.IgnorePsmPostings |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,10 @@ public class SearchClusterContainer extends GenericContainer<SearchClusterContai | |
"docker.elastic.co/elasticsearch/elasticsearch:7.17.22", | ||
Version.fromString("ES 7.17.22") | ||
); | ||
public static final ContainerVersion ES_V8_17 = new Elasticsearch8Version( | ||
"docker.elastic.co/elasticsearch/elasticsearch:8.17.5", | ||
Version.fromString("ES 8.17.5") | ||
); | ||
public static final ContainerVersion ES_V7_10_2 = new ElasticsearchOssVersion( | ||
"docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2", | ||
Version.fromString("ES 7.10.2") | ||
|
@@ -65,26 +69,40 @@ private enum INITIALIZATION_FLAVOR { | |
BASE(Map.of("discovery.type", "single-node", | ||
"path.repo", CLUSTER_SNAPSHOT_DIR, | ||
"ES_JAVA_OPTS", "-Xms2g -Xmx2g", | ||
"index.store.type", "mmapfs", | ||
"bootstrap.system_call_filter", "false" | ||
"index.store.type", "mmapfs" | ||
)), | ||
ELASTICSEARCH( | ||
new ImmutableMap.Builder<String, String>().putAll(BASE.getEnvVariables()) | ||
.put("xpack.security.enabled", "false") | ||
.put("bootstrap.system_call_filter", "false") | ||
.build()), | ||
ELASTICSEARCH_OSS( | ||
new ImmutableMap.Builder<String, String>().putAll(BASE.getEnvVariables()) | ||
.put("bootstrap.system_call_filter", "false") | ||
.build()), | ||
ELASTICSEARCH_8( | ||
new ImmutableMap.Builder<String, String>().putAll(BASE.getEnvVariables()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we put all from ELASTICSEARCH then just add the ones that are specifically needed for 8 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main concern here is that ES 8 does not accept setting |
||
.put("xpack.security.enabled", "false") | ||
.put("xpack.security.enrollment.enabled", "false") | ||
.put("xpack.security.http.ssl.enabled", "false") | ||
.put("xpack.security.transport.ssl.enabled", "false") | ||
.put("cluster.name", "docker-test-cluster") | ||
.put("node.name", "test-node") | ||
.put("xpack.ml.enabled", "false") | ||
.put("xpack.watcher.enabled", "false") | ||
.build()), | ||
OPENSEARCH( | ||
new ImmutableMap.Builder<String, String>().putAll(BASE.getEnvVariables()) | ||
.put("plugins.security.disabled", "true") | ||
.put("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "SecurityIsDisabled123$%^") | ||
.put("bootstrap.system_call_filter", "false") | ||
.build()), | ||
OPENSEARCH_2_19( | ||
new ImmutableMap.Builder<String, String>().putAll(BASE.getEnvVariables()) | ||
.put("plugins.security.disabled", "true") | ||
.put("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "SecurityIsDisabled123$%^") | ||
.put("search.insights.top_queries.exporter.type", "debug") | ||
.put("bootstrap.system_call_filter", "false") | ||
.build() | ||
); | ||
|
||
|
@@ -240,6 +258,12 @@ public ElasticsearchVersion(String imageName, Version version) { | |
} | ||
} | ||
|
||
public static class Elasticsearch8Version extends ContainerVersion { | ||
public Elasticsearch8Version(String imageName, Version version) { | ||
super(imageName, version, INITIALIZATION_FLAVOR.ELASTICSEARCH_8, "elasticsearch"); | ||
} | ||
} | ||
|
||
public static class OpenSearchVersion extends ContainerVersion { | ||
public OpenSearchVersion(String imageName, Version version) { | ||
super(imageName, version, VersionMatchers.isOS_2_19.test(version) ? INITIALIZATION_FLAVOR.OPENSEARCH_2_19 : INITIALIZATION_FLAVOR.OPENSEARCH, "opensearch"); | ||
|
Uh oh!
There was an error while loading. Please reload this page.