Skip to content

Commit

Permalink
[Rename] Property and metadata keys with prefix es. (#389)
Browse files Browse the repository at this point in the history
Rename all property and metadata keys with prefix 'es.' to 'opensearch.'.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
  • Loading branch information
adnapibar authored and nknize committed Mar 20, 2021
1 parent 99e0964 commit ded8921
Show file tree
Hide file tree
Showing 86 changed files with 235 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {

boolean assertEsStdoutContains(String testCluster, String expectedOutput) {
assert new File(testProjectDir.root,
"build/testclusters/${testCluster}-0/logs/es.stdout.log").text.contains(expectedOutput)
"build/testclusters/${testCluster}-0/logs/opensearch.stdout.log").text.contains(expectedOutput)
true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class NodeInfo {
clusterName = project.path.replace(':', '_').substring(1) + '_' + prefix
}
baseDir = new File(project.buildDir, "cluster/${prefix} node${nodeNum}")
pidFile = new File(baseDir, 'es.pid')
pidFile = new File(baseDir, 'opensearch.pid')
this.nodeVersion = Version.fromString(nodeVersion)
this.isBwcNode = this.nodeVersion.before(VersionProperties.opensearch)
homeDir = new File(baseDir, "opensearch-${nodeVersion}")
Expand Down Expand Up @@ -187,9 +187,9 @@ class NodeInfo {
env = [:]
env.putAll(config.environmentVariables)
for (Map.Entry<String, String> property : System.properties.entrySet()) {
if (property.key.startsWith('tests.es.')) {
if (property.key.startsWith('tests.opensearch.')) {
args.add("-E")
args.add("${property.key.substring('tests.es.'.size())}=${property.value}")
args.add("${property.key.substring('tests.opensearch.'.size())}=${property.value}")
}
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
Expand All @@ -202,7 +202,7 @@ class NodeInfo {
else {
env.put('ES_PATH_CONF', pathConf)
}
if (!System.properties.containsKey("tests.es.path.data")) {
if (!System.properties.containsKey("tests.opensearch.path.data")) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
/*
* We have to delay building the string as the path will not exist during configuration which will fail on Windows due to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ public void execute(Task t) {
// TODO: remove setting logging level via system property
test.systemProperty("tests.logger.level", "WARN");
System.getProperties().entrySet().forEach(entry -> {
if ((entry.getKey().toString().startsWith("tests.") || entry.getKey().toString().startsWith("es."))) {
if ((entry.getKey().toString().startsWith("tests.") || entry.getKey().toString().startsWith("opensearch."))) {
test.systemProperty(entry.getKey().toString(), entry.getValue());
}
});

// TODO: remove this once ctx isn't added to update script params in 7.0
test.systemProperty("es.scripting.update.ctx_in_params", "false");
test.systemProperty("opensearch.scripting.update.ctx_in_params", "false");

// TODO: remove this property in 8.0
test.systemProperty("es.search.rewrite_sort", "true");
test.systemProperty("opensearch.search.rewrite_sort", "true");

// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
test.systemProperty("es.transport.cname_in_publish_address", "true");
test.systemProperty("opensearch.transport.cname_in_publish_address", "true");

// Set netty system properties to the properties we configure in jvm.options
test.systemProperty("io.netty.noUnsafe", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ public class OpenSearchNode implements TestClusterConfiguration {
confPathLogs = workingDir.resolve("logs");
transportPortFile = confPathLogs.resolve("transport.ports");
httpPortsFile = confPathLogs.resolve("http.ports");
esStdoutFile = confPathLogs.resolve("es.stdout.log");
esStderrFile = confPathLogs.resolve("es.stderr.log");
esStdinFile = workingDir.resolve("es.stdin");
esStdoutFile = confPathLogs.resolve("opensearch.stdout.log");
esStderrFile = confPathLogs.resolve("opensearch.stderr.log");
esStdinFile = workingDir.resolve("opensearch.stdin");
tmpDir = workingDir.resolve("tmp");
waitConditions.put("ports files", this::checkPortsFilesExistWithDelay);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class RunTask extends DefaultTestClustersTask {

private static final Logger logger = Logging.getLogger(RunTask.class);
public static final String CUSTOM_SETTINGS_PREFIX = "tests.es.";
public static final String CUSTOM_SETTINGS_PREFIX = "tests.opensearch.";

private Boolean debug = false;

Expand Down
2 changes: 1 addition & 1 deletion client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ check.dependsOn(asyncIntegTest)

testClusters.all {
testDistribution = 'DEFAULT'
systemProperty 'es.scripting.update.ctx_in_params', 'false'
systemProperty 'opensearch.scripting.update.ctx_in_params', 'false'
setting 'reindex.remote.whitelist', '[ "[::1]:*", "127.0.0.1:*" ]'

extraConfigFile 'roles.yml', file('roles.yml')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testDelete() throws IOException {
assertEquals("OpenSearch exception [type=version_conflict_engine_exception, reason=[" + docId + "]: " +
"version conflict, required seqNo [2], primary term [2]. current document has seqNo [3] and primary term [1]]",
exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
{
// Testing version type
Expand Down Expand Up @@ -154,7 +154,7 @@ public void testDelete() throws IOException {
assertEquals(RestStatus.CONFLICT, exception.status());
assertEquals("OpenSearch exception [type=version_conflict_engine_exception, reason=[" +
docId + "]: version conflict, current version [12] is higher or equal to the one provided [10]]", exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
{
// Testing routing
Expand Down Expand Up @@ -300,7 +300,7 @@ public void testGet() throws IOException {
() -> execute(getRequest, highLevelClient()::get, highLevelClient()::getAsync));
assertEquals(RestStatus.NOT_FOUND, exception.status());
assertEquals("OpenSearch exception [type=index_not_found_exception, reason=no such index [index]]", exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
IndexRequest index = new IndexRequest("index").id("id");
String document = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
Expand All @@ -314,7 +314,7 @@ public void testGet() throws IOException {
assertEquals(RestStatus.CONFLICT, exception.status());
assertEquals("OpenSearch exception [type=version_conflict_engine_exception, " + "reason=[id]: " +
"version conflict, current version [1] is different than the one provided [2]]", exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
{
GetRequest getRequest = new GetRequest("index", "id");
Expand Down Expand Up @@ -493,7 +493,7 @@ public void testGetSource() throws IOException {
() -> execute(getRequest, highLevelClient()::getSource, highLevelClient()::getSourceAsync));
assertEquals(RestStatus.NOT_FOUND, exception.status());
assertEquals("OpenSearch exception [type=index_not_found_exception, reason=no such index [index]]", exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
IndexRequest index = new IndexRequest("index").id("id");
String document = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
Expand Down Expand Up @@ -606,7 +606,7 @@ public void testIndex() throws IOException {
assertEquals("OpenSearch exception [type=version_conflict_engine_exception, reason=[id]: " +
"version conflict, required seqNo [1], primary term [5]. current document has seqNo [2] and primary term [1]]",
exception.getMessage());
assertEquals("index", exception.getMetadata("es.index").get(0));
assertEquals("index", exception.getMetadata("opensearch.index").get(0));
}
{
OpenSearchStatusException exception = expectThrows(OpenSearchStatusException.class, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public void testAliasesNonExistentIndex() throws IOException {
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
assertThat(exception.getMessage(),
equalTo("OpenSearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
assertThat(exception.getMetadata("es.index"), hasItem(nonExistentIndex));
assertThat(exception.getMetadata("opensearch.index"), hasItem(nonExistentIndex));

createIndex(index, Settings.EMPTY);
IndicesAliasesRequest mixedRequest = new IndicesAliasesRequest();
Expand All @@ -831,8 +831,8 @@ public void testAliasesNonExistentIndex() throws IOException {
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
assertThat(exception.getMessage(),
equalTo("OpenSearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
assertThat(exception.getMetadata("es.index"), hasItem(nonExistentIndex));
assertThat(exception.getMetadata("es.index"), not(hasItem(index)));
assertThat(exception.getMetadata("opensearch.index"), hasItem(nonExistentIndex));
assertThat(exception.getMetadata("opensearch.index"), not(hasItem(index)));
assertThat(aliasExists(index, alias), equalTo(false));
assertThat(aliasExists(alias), equalTo(false));

Expand All @@ -844,8 +844,8 @@ public void testAliasesNonExistentIndex() throws IOException {
assertThat(exception.status(), equalTo(RestStatus.NOT_FOUND));
assertThat(exception.getMessage(),
equalTo("OpenSearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
assertThat(exception.getMetadata("es.index"), hasItem(nonExistentIndex));
assertThat(exception.getMetadata("es.index"), not(hasItem(index)));
assertThat(exception.getMetadata("opensearch.index"), hasItem(nonExistentIndex));
assertThat(exception.getMetadata("opensearch.index"), not(hasItem(index)));
assertThat(aliasExists(index, alias), equalTo(false));
assertThat(aliasExists(alias), equalTo(false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected org.opensearch.OpenSearchException createServerTestInstance(XContentTy
IllegalArgumentException iae = new IllegalArgumentException("argument", ies);
org.opensearch.OpenSearchException exception = new org.opensearch.OpenSearchException("elastic_exception", iae);
exception.addHeader("key","value");
exception.addMetadata("es.meta","data");
exception.addMetadata("opensearch.meta","data");
exception.addSuppressed(new NumberFormatException("3/0"));
return exception;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ public void testInvalidMustacheTemplate() throws Exception {
OpenSearchException exception = expectThrows(OpenSearchException.class,
() -> factory.create(null, processorTag, null, config));
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
assertThat(exception.getMetadata("opensearch.processor_tag").get(0), equalTo(processorTag));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public void testCreateUnsupportedType() throws Exception {
fail("factory create should have failed");
} catch (OpenSearchParseException e) {
assertThat(e.getMessage(), Matchers.equalTo("[type] type [" + type + "] not supported, cannot convert field."));
assertThat(e.getMetadata("es.processor_type").get(0), equalTo(ConvertProcessor.TYPE));
assertThat(e.getMetadata("es.property_name").get(0), equalTo("type"));
assertThat(e.getMetadata("es.processor_tag"), nullValue());
assertThat(e.getMetadata("opensearch.processor_type").get(0), equalTo(ConvertProcessor.TYPE));
assertThat(e.getMetadata("opensearch.property_name").get(0), equalTo("type"));
assertThat(e.getMetadata("opensearch.processor_tag"), nullValue());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public void testInvalidMustacheTemplate() throws Exception {
OpenSearchException exception = expectThrows(OpenSearchException.class, () -> factory.create(null, processorTag,
null, config));
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
assertThat(exception.getMetadata("opensearch.processor_tag").get(0), equalTo(processorTag));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ public void testInvalidMustacheTemplate() throws Exception {
OpenSearchException exception = expectThrows(OpenSearchException.class,
() -> factory.create(null, processorTag, null, config));
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
assertThat(exception.getMetadata("opensearch.processor_tag").get(0), equalTo(processorTag));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void testInvalidMustacheTemplate() throws Exception {
OpenSearchException exception = expectThrows(OpenSearchException.class,
() -> factory.create(null, processorTag, null, config));
assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script"));
assertThat(exception.getMetadata("es.processor_tag").get(0), equalTo(processorTag));
assertThat(exception.getMetadata("opensearch.processor_tag").get(0), equalTo(processorTag));
}

}
2 changes: 1 addition & 1 deletion modules/ingest-geoip/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
tasks.named("test").configure {
// Windows cannot cleanup database files properly unless it loads everything on heap.
// See https://github.com/maxmind/MaxMind-DB-Reader-java#file-lock-on-windows for more information
systemProperty 'es.geoip.load_db_on_heap', 'true'
systemProperty 'opensearch.geoip.load_db_on_heap', 'true'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private Path getGeoIpDirectory(Processor.Parameters parameters) {
static Map<String, DatabaseReaderLazyLoader> loadDatabaseReaders(Path geoIpDirectory, Path geoIpConfigDirectory) throws IOException {
assertDatabaseExistence(geoIpDirectory, true);
assertDatabaseExistence(geoIpConfigDirectory, false);
final boolean loadDatabaseOnHeap = Booleans.parseBoolean(System.getProperty("es.geoip.load_db_on_heap", "false"));
final boolean loadDatabaseOnHeap = Booleans.parseBoolean(System.getProperty("opensearch.geoip.load_db_on_heap", "false"));
final Map<String, DatabaseReaderLazyLoader> databaseReaders = new HashMap<>();

// load the default databases
Expand Down
4 changes: 2 additions & 2 deletions modules/lang-painless/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ esplugin {

testClusters.all {
module ':modules:mapper-extras'
systemProperty 'es.scripting.update.ctx_in_params', 'false'
systemProperty 'opensearch.scripting.update.ctx_in_params', 'false'
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
systemProperty 'es.transport.cname_in_publish_address', 'true'
systemProperty 'opensearch.transport.cname_in_publish_address', 'true'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public Map<String, List<String>> getHeaders(PainlessLookup painlessLookup) {
}
}

headers.put("es.to_string", singletonList(toString));
headers.put("opensearch.to_string", singletonList(toString));
if (painlessClassName != null) {
headers.put("es.painless_class", singletonList(painlessClassName));
headers.put("opensearch.painless_class", singletonList(painlessClassName));
}
if (javaClassName != null) {
headers.put("es.java_class", singletonList(javaClassName));
headers.put("opensearch.java_class", singletonList(javaClassName));
}
return headers;
}
Expand Down
Loading

0 comments on commit ded8921

Please sign in to comment.