diff --git a/be/src/exec/es_scan_node.h b/be/src/exec/es_scan_node.h index de871a8731..a4563b59f3 100644 --- a/be/src/exec/es_scan_node.h +++ b/be/src/exec/es_scan_node.h @@ -15,8 +15,7 @@ // specific language governing permissions and limitations // under the License. -#ifndef BDG_PALO_BE_SRC_QUERY_EXEC_ES_SCAN_NODE_H -#define BDG_PALO_BE_SRC_QUERY_EXEC_ES_SCAN_NODE_H +#pragma once #include #include @@ -89,4 +88,3 @@ private: } -#endif diff --git a/be/src/util/debug_util.cpp b/be/src/util/debug_util.cpp index 29cc714feb..35e18231d7 100644 --- a/be/src/util/debug_util.cpp +++ b/be/src/util/debug_util.cpp @@ -91,17 +91,17 @@ std::string print_plan_node_type(const TPlanNodeType::type& type) { std::string get_build_version(bool compact) { std::stringstream ss; - ss << PALO_BUILD_VERSION + ss << DORIS_BUILD_VERSION #ifdef NDEBUG << " RELEASE" #else << " DEBUG" #endif - << " (build " << PALO_BUILD_HASH + << " (build " << DORIS_BUILD_HASH << ")"; if (!compact) { - ss << std::endl << "Built on " << PALO_BUILD_TIME << " by " << PALO_BUILD_INFO; + ss << std::endl << "Built on " << DORIS_BUILD_TIME << " by " << DORIS_BUILD_INFO; } return ss.str(); diff --git a/bin/start_fe.sh b/bin/start_fe.sh index 50703926f6..ec22132d73 100755 --- a/bin/start_fe.sh +++ b/bin/start_fe.sh @@ -69,6 +69,48 @@ if [ "$JAVA_HOME" = "" ]; then fi JAVA=$JAVA_HOME/bin/java +# get jdk version, return version as an Integer. +# 1.8 => 8, 13.0 => 13 +jdk_version() { + local result + local java_cmd=$JAVA_HOME/bin/java + local IFS=$'\n' + # remove \r for Cygwin + local lines=$("$java_cmd" -Xms32M -Xmx32M -version 2>&1 | tr '\r' '\n') + if [[ -z $java_cmd ]] + then + result=no_java + else + for line in $lines; do + if [[ (-z $result) && ($line = *"version \""*) ]] + then + local ver=$(echo $line | sed -e 's/.*version "\(.*\)"\(.*\)/\1/; 1q') + # on macOS, sed doesn't support '?' + if [[ $ver = "1."* ]] + then + result=$(echo $ver | sed -e 's/1\.\([0-9]*\)\(.*\)/\1/; 1q') + else + result=$(echo $ver | sed -e 's/\([0-9]*\)\(.*\)/\1/; 1q') + fi + fi + done + fi + echo "$result" +} + +# check java version and choose correct JAVA_OPTS +java_version=$(jdk_version) +final_java_opt=$JAVA_OPTS +if [ $java_version -gt 8 ]; then + if [ -z "$JAVA_OPTS_FOR_JDK_9" ]; then + echo "JAVA_OPTS_FOR_JDK_9 is not set in fe.conf" >> $LOG_DIR/fe.out + exit -1 + fi + final_java_opt=$JAVA_OPTS_FOR_JDK_9 +fi +echo "using java version $java_version" >> $LOG_DIR/fe.out +echo $final_java_opt >> $LOG_DIR/fe.out + # add libs to CLASSPATH for f in $DORIS_HOME/lib/*.jar; do CLASSPATH=$f:${CLASSPATH}; @@ -102,9 +144,9 @@ if [ x"$HELPER" != x"" ]; then fi if [ ${RUN_DAEMON} -eq 1 ]; then - nohup $LIMIT $JAVA $JAVA_OPTS org.apache.doris.PaloFe ${HELPER} "$@" >> $LOG_DIR/fe.out 2>&1 > $LOG_DIR/fe.out 2>&1 > $LOG_DIR/fe.out 2>&1 > $LOG_DIR/fe.out 2>&1 $pidfile diff --git a/conf/fe.conf b/conf/fe.conf index 9b6e2a0b38..7f3acbdbc3 100644 --- a/conf/fe.conf +++ b/conf/fe.conf @@ -25,7 +25,10 @@ LOG_DIR = ${DORIS_HOME}/log DATE = `date +%Y%m%d-%H%M%S` -JAVA_OPTS="-Xmx4096m -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xloggc:$DORIS_HOME/log/fe.gc.log.$DATE" +JAVA_OPTS="-Xmx4096m -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xloggc:$DORIS_HOME/log/fe.gc.log.$DATE" + +# For jdk 9+, this JAVA_OPTS will be used as default JVM options +JAVA_OPTS_FOR_JDK_9="-Xmx4096m -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xlog:gc*:$DORIS_HOME/log/fe.gc.log.$DATE:time" ## ## the lowercase properties are read by main program. diff --git a/fe/pom.xml b/fe/pom.xml index 7ecf36947a..9203659606 100644 --- a/fe/pom.xml +++ b/fe/pom.xml @@ -528,6 +528,28 @@ under the License. 3.6.5.Final + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + com.sun.activation + javax.activation + 1.2.0 + + + + + + javax.xml.ws + jaxws-api + 2.3.0 + + diff --git a/fe/src/main/java/org/apache/doris/PaloFe.java b/fe/src/main/java/org/apache/doris/PaloFe.java index 81c2fb4b0f..f10e9cfa5d 100644 --- a/fe/src/main/java/org/apache/doris/PaloFe.java +++ b/fe/src/main/java/org/apache/doris/PaloFe.java @@ -22,6 +22,7 @@ import org.apache.doris.common.CommandLineOptions; import org.apache.doris.common.Config; import org.apache.doris.common.Log4jConfig; import org.apache.doris.common.Version; +import org.apache.doris.common.util.JdkUtils; import org.apache.doris.http.HttpServer; import org.apache.doris.journal.bdbje.BDBTool; import org.apache.doris.journal.bdbje.BDBToolOptions; @@ -70,6 +71,7 @@ public class PaloFe { return; } + CommandLineOptions cmdLineOpts = parseArgs(args); System.out.println(cmdLineOpts.toString()); @@ -81,6 +83,12 @@ public class PaloFe { // init config new Config().init(dorisHomeDir + "/conf/fe.conf"); + + // check it after Config is initialized, otherwise the config 'check_java_version' won't work. + if (!JdkUtils.checkJavaVersion()) { + throw new IllegalArgumentException("Java version doesn't match"); + } + Log4jConfig.initLogging(); // set dns cache ttl @@ -116,7 +124,7 @@ public class PaloFe { } } catch (Throwable e) { e.printStackTrace(); - System.exit(-1); + return; } } @@ -233,10 +241,11 @@ public class PaloFe { private static void checkCommandLineOptions(CommandLineOptions cmdLineOpts) { if (cmdLineOpts.isVersion()) { - System.out.println("Build version: " + Version.PALO_BUILD_VERSION); - System.out.println("Build time: " + Version.PALO_BUILD_TIME); - System.out.println("Build info: " + Version.PALO_BUILD_INFO); - System.out.println("Build hash: " + Version.PALO_BUILD_HASH); + System.out.println("Build version: " + Version.DORIS_BUILD_VERSION); + System.out.println("Build time: " + Version.DORIS_BUILD_TIME); + System.out.println("Build info: " + Version.DORIS_BUILD_INFO); + System.out.println("Build hash: " + Version.DORIS_BUILD_HASH); + System.out.println("Java compile version: " + Version.DORIS_JAVA_COMPILE_VERSION); System.exit(0); } else if (cmdLineOpts.runBdbTools()) { BDBTool bdbTool = new BDBTool(Catalog.getCurrentCatalog().getBdbDir(), cmdLineOpts.getBdbToolOpts()); @@ -275,3 +284,4 @@ public class PaloFe { } } } + diff --git a/fe/src/main/java/org/apache/doris/common/Config.java b/fe/src/main/java/org/apache/doris/common/Config.java index 403b29d504..22a0cc10bf 100644 --- a/fe/src/main/java/org/apache/doris/common/Config.java +++ b/fe/src/main/java/org/apache/doris/common/Config.java @@ -993,5 +993,11 @@ public class Config extends ConfigBase { */ @ConfField(mutable = true, masterOnly = true) public static int max_running_rollup_job_num_per_table = 1; + + /* + * If set to true, Doris will check if the compiled and running versions of Java are compatible + */ + @ConfField + public static boolean check_java_version = true; } diff --git a/fe/src/main/java/org/apache/doris/common/util/JdkUtils.java b/fe/src/main/java/org/apache/doris/common/util/JdkUtils.java new file mode 100644 index 0000000000..e46b3401d3 --- /dev/null +++ b/fe/src/main/java/org/apache/doris/common/util/JdkUtils.java @@ -0,0 +1,76 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.common.util; + +import org.apache.doris.common.Config; +import org.apache.doris.common.Version; + +import com.google.common.annotations.VisibleForTesting; + +public class JdkUtils { + + /* + * Doris will check if the compiled and running versions of Java are compatible. + * The principle the java version at runtime should higher than or equal to the + * java version at compile time + */ + @VisibleForTesting + public static boolean checkJavaVersion() { + if (!Config.check_java_version) { + return true; + } + + String javaCompileVersionStr = getJavaVersionFromFullVersion(Version.DORIS_JAVA_COMPILE_VERSION); + String javaRuntimeVersionStr = System.getProperty("java.version"); + + int compileVersion = JdkUtils.getJavaVersionAsInteger(javaCompileVersionStr); + int runtimeVersion = JdkUtils.getJavaVersionAsInteger(javaRuntimeVersionStr); + + if (runtimeVersion < compileVersion) { + System.out.println("The runtime java version " + javaRuntimeVersionStr + " is less than " + + "compile version " + javaCompileVersionStr); + return false; + } + + return true; + } + + /* + * Input: openjdk full 'version "13.0.1+9"', 'java full version "1.8.0_131-b11"' + * Output: '13.0.1+9', '1.8.0_131-b11' + */ + public static String getJavaVersionFromFullVersion(String fullVersionStr) { + int begin = fullVersionStr.indexOf("\""); + int end = fullVersionStr.lastIndexOf("\""); + String versionStr = fullVersionStr.substring(begin + 1, end); + return versionStr; + } + + /* + * Input: '13.0.1+9', '1.8.0_131-b11' + * Output: 13, 8 + */ + public static int getJavaVersionAsInteger(String javaVersionStr) { + String[] parts = javaVersionStr.split("\\."); + if (parts[0].equals("1")) { + return Integer.valueOf(parts[1]); + } else { + return Integer.valueOf(parts[0]); + } + } +} diff --git a/fe/src/main/java/org/apache/doris/http/action/IndexAction.java b/fe/src/main/java/org/apache/doris/http/action/IndexAction.java index 6921517c81..af17b29db5 100644 --- a/fe/src/main/java/org/apache/doris/http/action/IndexAction.java +++ b/fe/src/main/java/org/apache/doris/http/action/IndexAction.java @@ -17,17 +17,17 @@ package org.apache.doris.http.action; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import org.apache.doris.common.Version; import org.apache.doris.http.ActionController; import org.apache.doris.http.BaseRequest; import org.apache.doris.http.BaseResponse; import org.apache.doris.http.IllegalArgException; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import io.netty.handler.codec.http.HttpMethod; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; @@ -67,10 +67,10 @@ public class IndexAction extends WebBaseAction { private void appendVersionInfo(StringBuilder buffer) { buffer.append("

Version

"); buffer.append("
version info
"); - buffer.append("Version: " + Version.PALO_BUILD_VERSION + "
"); - buffer.append("Git: " + Version.PALO_BUILD_HASH + "
"); - buffer.append("Build Info: " + Version.PALO_BUILD_INFO + "
"); - buffer.append("Build Time: " + Version.PALO_BUILD_TIME + "
"); + buffer.append("Version: " + Version.DORIS_BUILD_VERSION + "
"); + buffer.append("Git: " + Version.DORIS_BUILD_HASH + "
"); + buffer.append("Build Info: " + Version.DORIS_BUILD_INFO + "
"); + buffer.append("Build Time: " + Version.DORIS_BUILD_TIME + "
"); buffer.append("
"); } diff --git a/fe/src/main/java/org/apache/doris/qe/GlobalVariable.java b/fe/src/main/java/org/apache/doris/qe/GlobalVariable.java index 6d41030b4f..2d92734989 100644 --- a/fe/src/main/java/org/apache/doris/qe/GlobalVariable.java +++ b/fe/src/main/java/org/apache/doris/qe/GlobalVariable.java @@ -27,7 +27,7 @@ import java.time.ZoneId; // NOTE: If you want access your variable safe, please hold VariableMgr's lock before access. public final class GlobalVariable { @VariableMgr.VarAttr(name = "version_comment", flag = VariableMgr.READ_ONLY) - public static String versionComment = "Doris version " + Version.PALO_BUILD_VERSION; + public static String versionComment = "Doris version " + Version.DORIS_BUILD_VERSION; @VariableMgr.VarAttr(name = "version", flag = VariableMgr.READ_ONLY) public static String version = "5.1.0"; diff --git a/fe/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/src/main/java/org/apache/doris/qe/StmtExecutor.java index cad3e892ed..54d06d78a2 100644 --- a/fe/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -136,7 +136,7 @@ public class StmtExecutor { summaryProfile.addInfoString(ProfileManager.QUERY_TYPE, "Query"); summaryProfile.addInfoString(ProfileManager.QUERY_STATE, context.getState().toString()); - summaryProfile.addInfoString("Doris Version", Version.PALO_BUILD_VERSION); + summaryProfile.addInfoString("Doris Version", Version.DORIS_BUILD_VERSION); summaryProfile.addInfoString(ProfileManager.USER, context.getQualifiedUser()); summaryProfile.addInfoString(ProfileManager.DEFAULT_DB, context.getDatabase()); summaryProfile.addInfoString(ProfileManager.SQL_STATEMENT, originStmt); diff --git a/fe/src/main/java/org/apache/doris/rpc/BackendServiceProxy.java b/fe/src/main/java/org/apache/doris/rpc/BackendServiceProxy.java index 2a45c6d011..d9a90dedea 100644 --- a/fe/src/main/java/org/apache/doris/rpc/BackendServiceProxy.java +++ b/fe/src/main/java/org/apache/doris/rpc/BackendServiceProxy.java @@ -18,6 +18,7 @@ package org.apache.doris.rpc; import org.apache.doris.common.Config; +import org.apache.doris.common.util.JdkUtils; import org.apache.doris.proto.PCancelPlanFragmentRequest; import org.apache.doris.proto.PCancelPlanFragmentResult; import org.apache.doris.proto.PExecPlanFragmentResult; @@ -31,6 +32,8 @@ import org.apache.doris.thrift.TExecPlanFragmentParams; import org.apache.doris.thrift.TNetworkAddress; import org.apache.doris.thrift.TUniqueId; +import com.baidu.bjf.remoting.protobuf.utils.JDKCompilerHelper; +import com.baidu.bjf.remoting.protobuf.utils.compiler.JdkCompiler; import com.baidu.jprotobuf.pbrpc.client.ProtobufRpcProxy; import com.baidu.jprotobuf.pbrpc.transport.RpcClient; import com.baidu.jprotobuf.pbrpc.transport.RpcClientOptions; @@ -53,6 +56,11 @@ public class BackendServiceProxy { private static BackendServiceProxy INSTANCE; + static { + int javaRuntimeVersion = JdkUtils.getJavaVersionAsInteger(System.getProperty("java.version")); + JDKCompilerHelper.setCompiler(new JdkCompiler(JdkCompiler.class.getClassLoader(), String.valueOf(javaRuntimeVersion))); + } + public BackendServiceProxy() { final RpcClientOptions rpcOptions = new RpcClientOptions(); rpcOptions.setMaxWait(Config.brpc_idle_wait_max_time); diff --git a/fe/src/main/java/org/apache/doris/task/ExportExportingTask.java b/fe/src/main/java/org/apache/doris/task/ExportExportingTask.java index fe98aa7dfc..7e8d75932b 100644 --- a/fe/src/main/java/org/apache/doris/task/ExportExportingTask.java +++ b/fe/src/main/java/org/apache/doris/task/ExportExportingTask.java @@ -257,7 +257,7 @@ public class ExportExportingTask extends MasterTask { summaryProfile.addInfoString(ProfileManager.QUERY_TYPE, "Query"); summaryProfile.addInfoString(ProfileManager.QUERY_STATE, job.getState().toString()); - summaryProfile.addInfoString("Doris Version", Version.PALO_BUILD_VERSION); + summaryProfile.addInfoString("Doris Version", Version.DORIS_BUILD_VERSION); summaryProfile.addInfoString(ProfileManager.USER, "xxx"); summaryProfile.addInfoString(ProfileManager.DEFAULT_DB, String.valueOf(job.getDbId())); summaryProfile.addInfoString(ProfileManager.SQL_STATEMENT, job.getSql()); diff --git a/fe/src/test/java/org/apache/doris/common/JdkUtilsTest.java b/fe/src/test/java/org/apache/doris/common/JdkUtilsTest.java new file mode 100644 index 0000000000..c0766e2cfe --- /dev/null +++ b/fe/src/test/java/org/apache/doris/common/JdkUtilsTest.java @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.common; + +import org.apache.doris.common.util.JdkUtils; + +import org.junit.Assert; +import org.junit.Test; + +public class JdkUtilsTest { + + @Test + public void testNormal() { + Assert.assertTrue(JdkUtils.checkJavaVersion()); + } + + @Test + public void testFunctions() { + String versionStr = JdkUtils.getJavaVersionFromFullVersion("java full version \"1.8.0_131-b11\""); + Assert.assertEquals("1.8.0_131-b11", versionStr); + versionStr = JdkUtils.getJavaVersionFromFullVersion("openjdk full version \"13.0.1+9\""); + Assert.assertEquals("13.0.1+9", versionStr); + + int version = JdkUtils.getJavaVersionAsInteger("1.8.0_131-b11"); + Assert.assertEquals(8, version); + version = JdkUtils.getJavaVersionAsInteger("1.7.0_79-b15"); + Assert.assertEquals(7, version); + version = JdkUtils.getJavaVersionAsInteger("13.0.1+9"); + Assert.assertEquals(13, version); + version = JdkUtils.getJavaVersionAsInteger("11.0.0+7"); + Assert.assertEquals(11, version); + } +} diff --git a/fe/src/test/java/org/apache/doris/common/jmockit/FieldReflection.java b/fe/src/test/java/org/apache/doris/common/jmockit/FieldReflection.java index a6207cb3e1..4939737129 100644 --- a/fe/src/test/java/org/apache/doris/common/jmockit/FieldReflection.java +++ b/fe/src/test/java/org/apache/doris/common/jmockit/FieldReflection.java @@ -5,14 +5,11 @@ package org.apache.doris.common.jmockit; -import sun.reflect.FieldAccessor; -import sun.reflect.ReflectionFactory; - import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.lang.reflect.Type; import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; @@ -225,7 +222,7 @@ public final class FieldReflection { } try { if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) { - setStaticFinalField(field, value); + throw new IllegalArgumentException("Do not allow to set static final field"); } else { makeAccessible(field); field.set(targetObject, value); @@ -236,6 +233,7 @@ public final class FieldReflection { } } + /* private static void setStaticFinalField(Field field, Object value) throws IllegalAccessException { if (field == null) { throw new IllegalStateException(); @@ -246,13 +244,14 @@ public final class FieldReflection { } catch (NoSuchFieldException e) { throw new RuntimeException(e); } - + modifiersField.setAccessible(true); int nonFinalModifiers = modifiersField.getInt(field) - 16; modifiersField.setInt(field, nonFinalModifiers); FieldAccessor accessor = ReflectionFactory.getReflectionFactory().newFieldAccessor(field, false); accessor.set((Object)null, value); } + */ public static Class getClassType(Type declaredType) { while(!(declaredType instanceof Class)) { @@ -285,3 +284,4 @@ public final class FieldReflection { } } + diff --git a/fe/src/test/java/org/apache/doris/deploy/AmbariDeployManagerTest.java b/fe/src/test/java/org/apache/doris/deploy/AmbariDeployManagerTest.java index d180dc550e..545b28558a 100644 --- a/fe/src/test/java/org/apache/doris/deploy/AmbariDeployManagerTest.java +++ b/fe/src/test/java/org/apache/doris/deploy/AmbariDeployManagerTest.java @@ -21,6 +21,7 @@ import org.apache.doris.catalog.Catalog; import org.apache.doris.common.util.Util; import org.apache.doris.deploy.impl.AmbariDeployManager; +import org.apache.commons.codec.binary.Base64; import org.junit.Before; import org.junit.Test; @@ -44,7 +45,7 @@ public class AmbariDeployManagerTest { Field encodedAuthInfoF = manager.getClass().getDeclaredField("encodedAuthInfo"); encodedAuthInfoF.setAccessible(true); - encodedAuthInfoF.set(manager, new sun.misc.BASE64Encoder().encode("admin:admin".getBytes())); + encodedAuthInfoF.set(manager, Base64.encodeBase64String("admin:admin".getBytes())); Field ambariUrlF = manager.getClass().getDeclaredField("ambariUrl"); ambariUrlF.setAccessible(true); diff --git a/fs_brokers/apache_hdfs_broker/pom.xml b/fs_brokers/apache_hdfs_broker/pom.xml index e272f69dff..cc95619b55 100644 --- a/fs_brokers/apache_hdfs_broker/pom.xml +++ b/fs_brokers/apache_hdfs_broker/pom.xml @@ -258,6 +258,14 @@ under the License. 1.7.5 test + + + + javax.annotation + javax.annotation-api + 1.3.2 + + diff --git a/gensrc/script/gen_build_version.sh b/gensrc/script/gen_build_version.sh index ea58e7c1d0..ac90587f77 100755 --- a/gensrc/script/gen_build_version.sh +++ b/gensrc/script/gen_build_version.sh @@ -44,7 +44,7 @@ then echo "DORIS_HOME: ${DORIS_HOME}" fi -if [[ -z ${PALO_TEST_BINARY_DIR} ]]; then +if [[ -z ${DORIS_TEST_BINARY_DIR} ]]; then if [ -e ${DORIS_HOME}/gensrc/build/java/org/apache/doris/common/Version.java \ -a -e ${DORIS_HOME}/gensrc/build/gen_cpp/version.h ]; then exit @@ -73,6 +73,20 @@ build_hash="${url}@${revision}" build_time="${date}" build_info="${user}@${hostname}" +java_cmd= +if [[ (-n "$JAVA_HOME") && (-x "$JAVA_HOME/bin/java") ]]; then + java_cmd="$JAVA_HOME/bin/java" +else + echo "JAVA_HOME is not set, or java bin is not found" + exit -1 +fi + +java_version_str=`$java_cmd -fullversion 2>&1` +java_version_str=$(echo $java_version_str | sed -e 's/"/\\"/g') + +echo "get java cmd: $java_cmd" +echo "get java version: $java_version_str" + VERSION_PACKAGE="${DORIS_HOME}/gensrc/build/java/org/apache/doris/common" mkdir -p ${VERSION_PACKAGE} cat >"${VERSION_PACKAGE}/Version.java" <"${VERSION_PACKAGE}/Version.java" <"${GEN_CPP_DIR}/version.h" <