Skip to content

Commit

Permalink
[Rename] Clean up imports and variable names in server module
Browse files Browse the repository at this point in the history
This commit cleans up imports, variable names, comments, and other misc usages
of ES with the new OpenSearch name.

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize committed Mar 18, 2021
1 parent 3f7c817 commit 1e036c8
Show file tree
Hide file tree
Showing 87 changed files with 222 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ public void testParseRejection() throws Exception {
assertEquals("87A7NvevQxSrEwMbtRCecg", r.getFailures().get(0).getNodeId());
assertThat(r.getFailures().get(0).getReason(), instanceOf(OpenSearchRejectedExecutionException.class));
assertEquals("rejected execution of org.opensearch.transport.TransportService$5@52d06af2 on "
+ "EsThreadPoolExecutor[search, queue capacity = 1000, org.opensearch.common.util.concurrent."
+ "EsThreadPoolExecutor@778ea553[Running, pool size = 7, active threads = 7, queued tasks = 1000, "
+ "OpenSearchThreadPoolExecutor[search, queue capacity = 1000, org.opensearch.common.util.concurrent."
+ "OpenSearchThreadPoolExecutor@778ea553[Running, pool size = 7, active threads = 7, queued tasks = 1000, "
+ "completed tasks = 4182]]", r.getFailures().get(0).getReason().getMessage());
assertThat(r.getHits(), hasSize(1));
assertEquals("test", r.getHits().get(0).getIndex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
import org.opensearch.common.util.concurrent.EsThreadPoolExecutor;
import org.opensearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor;
import org.opensearch.common.util.concurrent.OpenSearchThreadPoolExecutor;
import org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void testExecutionErrorOnDirectExecutorService() throws InterruptedExcept
}

public void testExecutionErrorOnFixedESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor fixedExecutor = OpenSearchExecutors.newFixed("test", 1, 1,
final OpenSearchThreadPoolExecutor fixedExecutor = OpenSearchExecutors.newFixed("test", 1, 1,
OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
checkExecutionError(getExecuteRunner(fixedExecutor));
Expand All @@ -81,7 +81,7 @@ public void testExecutionErrorOnFixedESThreadPoolExecutor() throws InterruptedEx
}

public void testExecutionErrorOnScalingESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor scalingExecutor = OpenSearchExecutors.newScaling("test", 1, 1,
final OpenSearchThreadPoolExecutor scalingExecutor = OpenSearchExecutors.newScaling("test", 1, 1,
10, TimeUnit.SECONDS, OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
checkExecutionError(getExecuteRunner(scalingExecutor));
Expand All @@ -92,7 +92,7 @@ public void testExecutionErrorOnScalingESThreadPoolExecutor() throws Interrupted
}

public void testExecutionErrorOnAutoQueueFixedESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor autoQueueFixedExecutor = OpenSearchExecutors.newAutoQueueFixed("test", 1, 1,
final OpenSearchThreadPoolExecutor autoQueueFixedExecutor = OpenSearchExecutors.newAutoQueueFixed("test", 1, 1,
1, 1, 1, TimeValue.timeValueSeconds(10), OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
checkExecutionError(getExecuteRunner(autoQueueFixedExecutor));
Expand All @@ -103,7 +103,7 @@ public void testExecutionErrorOnAutoQueueFixedESThreadPoolExecutor() throws Inte
}

public void testExecutionErrorOnSinglePrioritizingThreadPoolExecutor() throws InterruptedException {
final PrioritizedEsThreadPoolExecutor prioritizedExecutor = OpenSearchExecutors.newSinglePrioritizing("test",
final PrioritizedOpenSearchThreadPoolExecutor prioritizedExecutor = OpenSearchExecutors.newSinglePrioritizing("test",
OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext(), threadPool.scheduler());
try {
checkExecutionError(getExecuteRunner(prioritizedExecutor));
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testExecutionExceptionOnDirectExecutorService() throws InterruptedEx
}

public void testExecutionExceptionOnFixedESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor fixedExecutor = OpenSearchExecutors.newFixed("test", 1, 1,
final OpenSearchThreadPoolExecutor fixedExecutor = OpenSearchExecutors.newFixed("test", 1, 1,
OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
checkExecutionException(getExecuteRunner(fixedExecutor), true);
Expand All @@ -190,7 +190,7 @@ public void testExecutionExceptionOnFixedESThreadPoolExecutor() throws Interrupt
}

public void testExecutionExceptionOnScalingESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor scalingExecutor = OpenSearchExecutors.newScaling("test", 1, 1,
final OpenSearchThreadPoolExecutor scalingExecutor = OpenSearchExecutors.newScaling("test", 1, 1,
10, TimeUnit.SECONDS, OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
checkExecutionException(getExecuteRunner(scalingExecutor), true);
Expand All @@ -201,7 +201,7 @@ public void testExecutionExceptionOnScalingESThreadPoolExecutor() throws Interru
}

public void testExecutionExceptionOnAutoQueueFixedESThreadPoolExecutor() throws InterruptedException {
final EsThreadPoolExecutor autoQueueFixedExecutor = OpenSearchExecutors.newAutoQueueFixed("test", 1, 1,
final OpenSearchThreadPoolExecutor autoQueueFixedExecutor = OpenSearchExecutors.newAutoQueueFixed("test", 1, 1,
1, 1, 1, TimeValue.timeValueSeconds(10), OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext());
try {
// fixed_auto_queue_size wraps stuff into TimedRunnable, which is an AbstractRunnable
Expand All @@ -213,7 +213,7 @@ public void testExecutionExceptionOnAutoQueueFixedESThreadPoolExecutor() throws
}

public void testExecutionExceptionOnSinglePrioritizingThreadPoolExecutor() throws InterruptedException {
final PrioritizedEsThreadPoolExecutor prioritizedExecutor = OpenSearchExecutors.newSinglePrioritizing("test",
final PrioritizedOpenSearchThreadPoolExecutor prioritizedExecutor = OpenSearchExecutors.newSinglePrioritizing("test",
OpenSearchExecutors.daemonThreadFactory("test"), threadPool.getThreadContext(), threadPool.scheduler());
try {
checkExecutionException(getExecuteRunner(prioritizedExecutor), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static Shell.Result runOpenSearchStartCommand(Shell sh) throws IOExceptio
return sh.runIgnoreExitCode("service opensearch start");
}

public static void assertElasticsearchStarted(Shell sh, Installation installation) throws Exception {
public static void assertOpenSearchearchStarted(Shell sh, Installation installation) throws Exception {
waitForOpenSearch(installation);

if (isSystemd()) {
Expand All @@ -261,7 +261,7 @@ public static void restartOpenSearch(Shell sh, Installation installation) throws
} else {
sh.run("service opensearch restart");
}
assertElasticsearchStarted(sh, installation);
assertOpenSearchearchStarted(sh, installation);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.lucene.search.spans.SpanTermQuery;
import org.opensearch.common.lucene.search.MultiPhrasePrefixQuery;
import org.opensearch.common.lucene.search.function.FunctionScoreQuery;
import org.opensearch.index.search.ESToParentBlockJoinQuery;
import org.opensearch.index.search.OpenSearchToParentBlockJoinQuery;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -85,8 +85,8 @@ protected void flatten(Query sourceQuery, IndexReader reader, Collection<Query>
for (Term term : synQuery.getTerms()) {
flatten(new TermQuery(term), reader, flatQueries, boost);
}
} else if (sourceQuery instanceof ESToParentBlockJoinQuery) {
Query childQuery = ((ESToParentBlockJoinQuery) sourceQuery).getChildQuery();
} else if (sourceQuery instanceof OpenSearchToParentBlockJoinQuery) {
Query childQuery = ((OpenSearchToParentBlockJoinQuery) sourceQuery).getChildQuery();
if (childQuery != null) {
flatten(childQuery, reader, flatQueries, boost);
}
Expand Down
8 changes: 4 additions & 4 deletions server/src/main/java/org/opensearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ public static Type fromDisplayName(final String displayName, final boolean stric
// these are parsed at startup, and we require that we are able to recognize the values passed in by the startup scripts
type = Type.fromDisplayName(System.getProperty("es.distribution.type", "unknown"), true);

final String esPrefix = "elasticsearch-" + Version.CURRENT;
final String opensearchPrefix = "opensearch-" + Version.CURRENT;
final URL url = getOpenSearchCodeSourceLocation();
final String urlStr = url == null ? "" : url.toString();
if (urlStr.startsWith("file:/") && (
urlStr.endsWith(esPrefix + ".jar") ||
urlStr.matches("(.*)" + esPrefix + "(-)?((alpha|beta|rc)[0-9]+)?(-SNAPSHOT)?.jar")
urlStr.endsWith(opensearchPrefix + ".jar") ||
urlStr.matches("(.*)" + opensearchPrefix + "(-)?((alpha|beta|rc)[0-9]+)?(-SNAPSHOT)?.jar")
)) {
try (JarInputStream jar = new JarInputStream(FileSystemUtils.openFileURLStream(url))) {
Manifest manifest = jar.getManifest();
Expand All @@ -112,7 +112,7 @@ public static Type fromDisplayName(final String displayName, final boolean stric
throw new RuntimeException(e);
}
} else {
// not running from the official elasticsearch jar file (unit tests, IDE, uber client jar, shadiness)
// not running from the official opensearch jar file (unit tests, IDE, uber client jar, shadiness)
hash = "unknown";
date = "unknown";
version = Version.CURRENT.toString();
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public boolean isBeta() {

/**
* Returns true iff this version is an alpha version
* Note: This has been introduced in elasticsearch version 5. Previous versions will never
* Note: This has been introduced in version 5 of the OpenSearch predecessor. Previous versions will never
* have an alpha version.
*/
public boolean isAlpha() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public String getHostname() {
}

/**
* The current ES version
* The current OpenSearch version
*/
public Version getVersion() {
return version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public UpgradeSettingsRequest() {
/**
* Constructs a new request to update minimum compatible version settings for one or more indices
*
* @param versions a map from index name to elasticsearch version, oldest lucene segment version tuple
* @param versions a map from index name to opensearch version, oldest lucene segment version tuple
*/
public UpgradeSettingsRequest(Map<String, Tuple<Version, String>> versions) {
this.versions = versions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
* doesn't know. But before returning the result it will check that enough information were
* parsed to return a valid {@link GetResponse} instance and throws a {@link ParsingException}
* otherwise. This is the case when we get a 404 back, which can be parsed as a normal
* {@link GetResponse} with found set to false, or as an elasticsearch exception. The caller
* {@link GetResponse} with found set to false, or as an opensearch exception. The caller
* of this method needs a way to figure out whether we got back a valid get response, which
* can be done by catching ParsingException.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private static Environment createEnvironment(
builder.setSecureSettings(secureSettings);
}
return InternalSettingsPreparer.prepareEnvironment(builder.build(), Collections.emptyMap(), configPath,
// HOSTNAME is set by elasticsearch-env and elasticsearch-env.bat so it is always available
// HOSTNAME is set by opensearch-env and opensearch-env.bat so it is always available
() -> System.getenv("HOSTNAME"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public final BootstrapCheckResult check(BootstrapContext context) {
if (maxFileDescriptorCount != -1 && maxFileDescriptorCount < limit) {
final String message = String.format(
Locale.ROOT,
"max file descriptors [%d] for elasticsearch process is too low, increase to at least [%d]",
"max file descriptors [%d] for opensearch process is too low, increase to at least [%d]",
getMaxFileDescriptorCount(),
limit);
return BootstrapCheckResult.failure(message);
Expand All @@ -317,7 +317,7 @@ static class MlockallCheck implements BootstrapCheck {
@Override
public BootstrapCheckResult check(BootstrapContext context) {
if (BootstrapSettings.MEMORY_LOCK_SETTING.get(context.settings()) && !isMemoryLocked()) {
return BootstrapCheckResult.failure("memory locking requested for elasticsearch process but memory is not locked");
return BootstrapCheckResult.failure("memory locking requested for opensearch process but memory is not locked");
} else {
return BootstrapCheckResult.success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private JNANatives() {}
// Set to true, in case native system call filter install was successful
static boolean LOCAL_SYSTEM_CALL_FILTER = false;
// Set to true, in case policy can be applied to all threads of the process (even existing ones)
// otherwise they are only inherited for new threads (ES app threads)
// otherwise they are only inherited for new threads (OpenSearch app threads)
static boolean LOCAL_SYSTEM_CALL_FILTER_ALL = false;
// set to the maximum number of threads that can be created for
// the user ID that owns the running OpenSearch process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void onFatalUncaught(final String threadName, final Throwable t) {
logger.error(message, t);
Terminal.DEFAULT.errorPrintln(message);
t.printStackTrace(Terminal.DEFAULT.getErrorWriter());
// Without a final flush, the stacktrace may not be shown before ES exits
// Without a final flush, the stacktrace may not be shown before OpenSearch exits
Terminal.DEFAULT.flush();
}

Expand All @@ -76,7 +76,7 @@ void onNonFatalUncaught(final String threadName, final Throwable t) {
logger.error(message, t);
Terminal.DEFAULT.errorPrintln(message);
t.printStackTrace(Terminal.DEFAULT.getErrorWriter());
// Without a final flush, the stacktrace may not be shown if ES goes on to exit
// Without a final flush, the stacktrace may not be shown if OpenSearch goes on to exit
Terminal.DEFAULT.flush();
}

Expand Down
8 changes: 4 additions & 4 deletions server/src/main/java/org/opensearch/bootstrap/Security.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* between security and ease of use:
* <ul>
* <li>Assigns file permissions to user-configurable paths that can
* be specified from the command-line or {@code elasticsearch.yml}.</li>
* be specified from the command-line or {@code opensearch.yml}.</li>
* <li>Allows for some contained usage of native code that would not
* otherwise be permitted.</li>
* </ul>
Expand All @@ -85,7 +85,7 @@
* permission, but there are extenuating circumstances.
* <p>
* Scripts (groovy) are assigned minimal permissions. This does not provide adequate
* sandboxing, as these scripts still have access to ES classes, and could
* sandboxing, as these scripts still have access to OpenSearch classes, and could
* modify members, etc that would cause bad things to happen later on their
* behalf (no package protections are yet in place, this would need some
* cleanups to the scripting apis). But still it can provide some defense for users
Expand All @@ -94,7 +94,7 @@
* <h2>Debugging Security</h2>
* A good place to start when there is a problem is to turn on security debugging:
* <pre>
* ES_JAVA_OPTS="-Djava.security.debug=access,failure" bin/elasticsearch
* ES_JAVA_OPTS="-Djava.security.debug=access,failure" bin/opensearch
* </pre>
* <p>
* When running tests you have to pass it to the test runner like this:
Expand Down Expand Up @@ -134,7 +134,7 @@ static void configure(Environment environment, boolean filterBadDefaults) throws
}

/**
* Return a map from codebase name to codebase url of jar codebases used by ES core.
* Return a map from codebase name to codebase url of jar codebases used by OpenSearch core.
*/
@SuppressForbidden(reason = "find URL path")
static Map<String, URL> getCodebaseJarMap(Set<URL> urls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* On Linux BPF Filters are installed using either {@code seccomp(2)} (3.17+) or {@code prctl(2)} (3.5+). {@code seccomp(2)}
* is preferred, as it allows filters to be applied to any existing threads in the process, and one motivation
* here is to protect against bugs in the JVM. Otherwise, code will fall back to the {@code prctl(2)} method
* which will at least protect elasticsearch application threads.
* which will at least protect opensearch application threads.
* <p>
* Linux BPF filters will return {@code EACCES} (Access Denied) for the following system calls:
* <ul>
Expand Down Expand Up @@ -128,7 +128,7 @@ interface LinuxLibrary extends Library {
static final int SECCOMP_SET_MODE_FILTER = 1; // since Linux 3.17
static final int SECCOMP_FILTER_FLAG_TSYNC = 1; // since Linux 3.17

/** otherwise, we can use prctl(2), which will at least protect ES application threads */
/** otherwise, we can use prctl(2), which will at least protect OpenSearch application threads */
static final int PR_GET_NO_NEW_PRIVS = 39; // since Linux 3.5
static final int PR_SET_NO_NEW_PRIVS = 38; // since Linux 3.5
static final int PR_GET_SECCOMP = 21; // since Linux 2.6.23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected final Environment createEnv(final Settings baseSettings, final Map<Str
}
return InternalSettingsPreparer.prepareEnvironment(baseSettings, settings,
getConfigPath(esPathConf),
// HOSTNAME is set by elasticsearch-env and elasticsearch-env.bat so it is always available
// HOSTNAME is set by opensearch-env and opensearch-env.bat so it is always available
() -> System.getenv("HOSTNAME"));
}

Expand Down
Loading

0 comments on commit 1e036c8

Please sign in to comment.