FrankChen021 commented on code in PR #19709:
URL: https://github.com/apache/druid/pull/19709#discussion_r3622003613
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ForkingTaskRunner.java:
##########
@@ -506,6 +507,28 @@ public TaskStatus call()
}
}
+ private String getJavaCommand()
+ {
+ return getJavaCommand(config.getJavaCommand(), new File("."));
+ }
+
+ /**
+ * Resolves the command used to launch the peon JVM. When the operator has
not overridden
+ * {@code druid.indexer.runner.javaCommand} (i.e. it is still the default
{@code "java"}), and the bundled
+ * {@link #RUN_JAVA_COMMAND} script is present in {@code workingDir}, prefer
it so that {@code DRUID_JAVA_HOME} /
+ * {@code JAVA_HOME} are honored. Otherwise fall back to the configured
command (the plain {@code java} on the
+ * PATH by default). The existence check against {@code workingDir} is
reliable because peons inherit this
+ * process's working directory.
+ */
+ public static String getJavaCommand(String configuredJavaCommand, File
workingDir)
+ {
+ if
(ForkingTaskRunnerConfig.DEFAULT_JAVA_COMMAND.equals(configuredJavaCommand)
+ && new File(workingDir, RUN_JAVA_COMMAND).exists()) {
Review Comment:
[P2] Check launcher executability before selecting it
`exists()` also accepts non-executable files and directories. In
installations where mode bits were not preserved, peon startup now selects
`bin/run-java` and fails in `ProcessBuilder` instead of falling back to the
working `java` command on PATH. Require a regular executable file before
returning the bundled launcher, and cover the non-executable case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]