Skip to content

Commit

Permalink
Refactor bootstrap for JPMS support
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi committed Jan 24, 2025
1 parent 931c1aa commit 6c17381
Show file tree
Hide file tree
Showing 86 changed files with 90 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,12 @@ class ClusterFormationTasks {
standardOutput = new ByteArrayOutputStream()
doLast {
String out = standardOutput.toString()
if (out.contains("${ext.pid} org.opensearch.bootstrap.OpenSearch") == false) {
if (out.contains("${ext.pid} org.opensearch.server.bootstrap.OpenSearch") == false) {
logger.error('jps -l')
logger.error(out)
logger.error("pid file: ${node.pidFile}")
logger.error("pid: ${ext.pid}")
throw new GradleException("jps -l did not report any process with org.opensearch.bootstrap.OpenSearch\n" +
throw new GradleException("jps -l did not report any process with org.opensearch.server.bootstrap.OpenSearch\n" +
"Did you run gradle clean? Maybe an old pid file is still lying around.")
} else {
logger.info(out)
Expand Down
4 changes: 2 additions & 2 deletions distribution/src/bin/opensearch
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [[ $DAEMONIZE = false ]]; then
-Dopensearch.distribution.type="$OPENSEARCH_DISTRIBUTION_TYPE" \
-Dopensearch.bundled_jdk="$OPENSEARCH_BUNDLED_JDK" \
-cp "$OPENSEARCH_CLASSPATH" \
org.opensearch.bootstrap.OpenSearch \
org.opensearch.server.bootstrap.OpenSearch \
"$@" <<<"$KEYSTORE_PASSWORD"
else
exec \
Expand All @@ -81,7 +81,7 @@ else
-Dopensearch.distribution.type="$OPENSEARCH_DISTRIBUTION_TYPE" \
-Dopensearch.bundled_jdk="$OPENSEARCH_BUNDLED_JDK" \
-cp "$OPENSEARCH_CLASSPATH" \
org.opensearch.bootstrap.OpenSearch \
org.opensearch.server.bootstrap.OpenSearch \
"$@" \
<<<"$KEYSTORE_PASSWORD" &
retval=$?
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/opensearch-service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ if not "%SERVICE_USERNAME%" == "" (
)
)
rem //IS == Install Service
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %OPENSEARCH_START_TYPE% --StopTimeout %OPENSEARCH_STOP_TIMEOUT% --StartClass org.opensearch.bootstrap.OpenSearch --StartMethod main ++StartParams --quiet --StopClass org.opensearch.bootstrap.OpenSearch --StopMethod close --Classpath "%OPENSEARCH_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %OPENSEARCH_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%OPENSEARCH_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %OPENSEARCH_START_TYPE% --StopTimeout %OPENSEARCH_STOP_TIMEOUT% --StartClass org.opensearch.server.bootstrap.OpenSearch --StartMethod main ++StartParams --quiet --StopClass org.opensearch.server.bootstrap.OpenSearch --StopMethod close --Classpath "%OPENSEARCH_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %OPENSEARCH_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%OPENSEARCH_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"

if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_ID%' service
Expand Down
2 changes: 1 addition & 1 deletion distribution/src/bin/opensearch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ECHO.!KEYSTORE_PASSWORD!| "%JAVA%" %OPENSEARCH_JAVA_OPTS% -Dopensearch ^
-Dopensearch.path.home="%OPENSEARCH_HOME%" -Dopensearch.path.conf="%OPENSEARCH_PATH_CONF%" ^
-Dopensearch.distribution.type="%OPENSEARCH_DISTRIBUTION_TYPE%" ^
-Dopensearch.bundled_jdk="%OPENSEARCH_BUNDLED_JDK%" ^
-cp "%OPENSEARCH_CLASSPATH%" "org.opensearch.bootstrap.OpenSearch" !newparams!
-cp "%OPENSEARCH_CLASSPATH%" "org.opensearch.server.bootstrap.OpenSearch" !newparams!

endlocal
endlocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.settings.KeyStoreCommandTestCase;
import org.opensearch.common.settings.KeyStoreWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
import org.opensearch.Build;
import org.opensearch.Version;
import org.opensearch.bootstrap.JarHell;
import org.opensearch.server.bootstrap.JarHell;
import org.opensearch.cli.EnvironmentAwareCommand;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.Terminal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.io.PathUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.SuppressForbidden;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

/** Contains JarHell Classes */
package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.io.PathUtils;
import org.opensearch.core.common.Strings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.painless;

import org.opensearch.bootstrap.BootstrapInfo;
import org.opensearch.server.bootstrap.BootstrapInfo;
import org.opensearch.painless.antlr.Walker;
import org.opensearch.painless.ir.ClassNode;
import org.opensearch.painless.lookup.PainlessLookup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.painless.lookup;

import org.opensearch.bootstrap.BootstrapInfo;
import org.opensearch.server.bootstrap.BootstrapInfo;
import org.opensearch.painless.Def;
import org.opensearch.painless.MethodWriter;
import org.opensearch.painless.WriterConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.ParserDecorator;
import org.opensearch.SpecialPermission;
import org.opensearch.bootstrap.FilePermissionUtils;
import org.opensearch.bootstrap.JarHell;
import org.opensearch.server.bootstrap.FilePermissionUtils;
import org.opensearch.server.bootstrap.JarHell;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.io.PathUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.logging.log4j.Logger;
import org.opensearch.common.SuppressForbidden;
Expand All @@ -44,7 +44,7 @@
import java.util.List;

import static java.util.Collections.emptyList;
import static org.opensearch.bootstrap.BootstrapChecks.OPENSEARCH_ENFORCE_BOOTSTRAP_CHECKS;
import static org.opensearch.server.bootstrap.BootstrapChecks.OPENSEARCH_ENFORCE_BOOTSTRAP_CHECKS;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasToString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.lucene.util.Constants;
import org.opensearch.common.io.PathUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;


import org.opensearch.cli.ExitCodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.lucene.util.Constants;
import org.opensearch.common.SuppressForbidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.SuppressForbidden;
import org.opensearch.test.OpenSearchTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.lucene.util.Constants;
import org.opensearch.test.OpenSearchTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.lucene.util.Constants;
import org.apache.lucene.tests.util.LuceneTestCase;
Expand All @@ -45,9 +45,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystemException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.PosixFilePermission;
Expand All @@ -57,11 +55,9 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.instanceOf;

/**
* Create a simple "daemon controller", put it in the right place and check that it runs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void test30DaemonIsNotEnabledOnRestart() {
}

public void test31InstallDoesNotStartServer() {
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.bootstrap.OpenSearch")));
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.server.bootstrap.OpenSearch")));
}

private void assertRunsWithJavaHome() throws Exception {
Expand Down Expand Up @@ -200,7 +200,7 @@ public void test50Remove() throws Exception {
remove(distribution());

// removing must stop the service
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.bootstrap.OpenSearch")));
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.server.bootstrap.OpenSearch")));

if (isSystemd()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ public static void cleanEverything() throws Exception {
// kill opensearch processes
Platforms.onLinux(() -> {
sh.runIgnoreExitCode("pkill -u opensearch");
sh.runIgnoreExitCode("ps aux | grep -i 'org.opensearch.bootstrap.OpenSearch' | awk {'print $2'} | xargs kill -9");
sh.runIgnoreExitCode("ps aux | grep -i 'org.opensearch.server.bootstrap.OpenSearch' | awk {'print $2'} | xargs kill -9");
});

Platforms.onWindows(() -> {
// the view of processes returned by Get-Process doesn't expose command line arguments, so we use WMI here
sh.runIgnoreExitCode(
"Get-WmiObject Win32_Process | "
+ "Where-Object { $_.CommandLine -Match 'org.opensearch.bootstrap.OpenSearch' } | "
+ "Where-Object { $_.CommandLine -Match 'org.opensearch.server.bootstrap.OpenSearch' } | "
+ "ForEach-Object { $_.Terminate() }"
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static void waitForOpenSearchToStart() {

psOutput = dockerShell.run("ps -ww ax").stdout;

if (psOutput.contains("org.opensearch.bootstrap.OpenSearch")) {
if (psOutput.contains("org.opensearch.server.bootstrap.OpenSearch")) {
isOpenSearchRunning = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion release-notes/opensearch.release-notes-2.13.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- Force merge API supports performing on primary shards only ([#11269](https://github.com/opensearch-project/OpenSearch/pull/11269))
- Add kuromoji_completion analyzer and filter ([#4835](https://github.com/opensearch-project/OpenSearch/issues/4835))
- [Admission Control] Integrate IO Usage Tracker to the Resource Usage Collector Service and Emit IO Usage Stats ([#11880](https://github.com/opensearch-project/OpenSearch/pull/11880))
- The org.opensearch.bootstrap.Security should support codebase for JAR files with classifiers ([#12586](https://github.com/opensearch-project/OpenSearch/issues/12586))
- The org.opensearch.server.bootstrap.Security should support codebase for JAR files with classifiers ([#12586](https://github.com/opensearch-project/OpenSearch/issues/12586))
- Remote reindex: Add support for configurable retry mechanism ([#12561](https://github.com/opensearch-project/OpenSearch/pull/12561))
- Tracing for deep search path ([#12103](https://github.com/opensearch-project/OpenSearch/pull/12103))
- [Metrics Framework] Adds support for asynchronous gauge metric type. ([#12642](https://github.com/opensearch-project/OpenSearch/issues/12642))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.opensearch.action.support.AutoCreateIndex;
import org.opensearch.action.support.DestructiveOperations;
import org.opensearch.action.support.replication.TransportReplicationAction;
import org.opensearch.bootstrap.BootstrapSettings;
import org.opensearch.server.bootstrap.BootstrapSettings;
import org.opensearch.client.Client;
import org.opensearch.cluster.ClusterModule;
import org.opensearch.cluster.ClusterName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.monitor.process;

import org.opensearch.bootstrap.BootstrapInfo;
import org.opensearch.server.bootstrap.BootstrapInfo;
import org.opensearch.monitor.Probes;

import java.lang.management.ManagementFactory;
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
import org.opensearch.action.search.SearchTransportService;
import org.opensearch.action.support.TransportAction;
import org.opensearch.action.update.UpdateHelper;
import org.opensearch.bootstrap.BootstrapCheck;
import org.opensearch.bootstrap.BootstrapContext;
import org.opensearch.server.bootstrap.BootstrapCheck;
import org.opensearch.server.bootstrap.BootstrapContext;
import org.opensearch.client.Client;
import org.opensearch.client.node.NodeClient;
import org.opensearch.cluster.ClusterInfoService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
package org.opensearch.node;

import org.opensearch.core.common.transport.BoundTransportAddress;
import org.opensearch.server.bootstrap.BootstrapContext;

import java.util.List;

/**
* An exception thrown during node validation. Node validation runs immediately before a node
* begins accepting network requests in
* {@link Node#validateNodeBeforeAcceptingRequests(org.opensearch.bootstrap.BootstrapContext, BoundTransportAddress, List)}.
* {@link Node#validateNodeBeforeAcceptingRequests(BootstrapContext, BoundTransportAddress, List)}.
* This exception is a checked exception that is declared as thrown from this method for the purpose of bubbling up to the user.
*
* @opensearch.internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface NetworkPlugin {
* These pluggable client/server transport implementations have their lifecycle managed by Node.
*
* Auxiliary transports are additionally defined by a port range on which they bind. Opening permissions on these
* ports is awkward as {@link org.opensearch.bootstrap.Security} is configured previous to Node initialization during
* ports is awkward as {@link org.opensearch.server.bootstrap.Security} is configured previous to Node initialization during
* bootstrap. To allow pluggable AuxTransports access to configurable port ranges we require the port range be provided
* through an {@link org.opensearch.common.settings.Setting.AffixSetting} of the form 'AUX_SETTINGS_PREFIX.{aux-transport-key}.ports'.
*/
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/plugins/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.plugins;

import org.opensearch.bootstrap.BootstrapCheck;
import org.opensearch.server.bootstrap.BootstrapCheck;
import org.opensearch.client.Client;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.fasterxml.jackson.core.json.JsonReadFeature;

import org.opensearch.Version;
import org.opensearch.bootstrap.JarHell;
import org.opensearch.server.bootstrap.JarHell;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.xcontent.json.JsonXContentParser;
import org.opensearch.core.common.Strings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.opensearch.OpenSearchException;
import org.opensearch.Version;
import org.opensearch.action.admin.cluster.node.info.PluginsAndModules;
import org.opensearch.bootstrap.JarHell;
import org.opensearch.server.bootstrap.JarHell;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.inject.Module;
import org.opensearch.common.lifecycle.LifecycleComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.opensearch.common.annotation.PublicApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
* GitHub history for details.
*/

package org.opensearch.bootstrap;
package org.opensearch.server.bootstrap;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.lucene.util.Constants;
import org.opensearch.bootstrap.jvm.DenyJvmVersionsParser;
import org.opensearch.server.bootstrap.jvm.DenyJvmVersionsParser;
import org.opensearch.cluster.coordination.ClusterBootstrapService;
import org.opensearch.cluster.node.DiscoveryNodeRole;
import org.opensearch.common.SuppressForbidden;
Expand Down
Loading

0 comments on commit 6c17381

Please sign in to comment.