Skip to content

Commit 35de979

Browse files
fix: connect abort and improve log (#3809)
1 parent 78b5ca4 commit 35de979

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

java/openmldb-spark-connector/src/main/java/com/_4paradigm/openmldb/spark/OpenmldbTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public OpenmldbTable(OpenmldbConfig config) {
5555
// no need to check table exists, schema() will check it later
5656
} catch (SqlException e) {
5757
e.printStackTrace();
58-
throw new RuntimeException("conn openmldb failed", e);
58+
throw new RuntimeException("connect to openmldb failed", e); // abort immediately
5959
}
6060
// TODO: cache schema & delete executor?
6161
}

java/openmldb-taskmanager/src/main/java/com/_4paradigm/openmldb/taskmanager/config/TaskManagerConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ private void init() throws ConfigException {
247247
}
248248

249249
// Get properties and check
250+
// server.host will be used by RunBatchSql, it's not good to be null
250251
if (props.getProperty("server.host") == null) {
251252
props.setProperty("server.host", "0.0.0.0");
252253
}
@@ -369,14 +370,13 @@ private void init() throws ConfigException {
369370
}
370371
}
371372

372-
String SPARK_HOME = firstNonEmpty(props.getProperty("spark.home"), System.getenv("SPARK_HOME"));
373+
String SPARK_HOME = firstNonEmpty(props.getProperty("spark.home"));
373374
// isEmpty checks null and empty
374375
if (isEmpty(SPARK_HOME)) {
375376
throw new ConfigException("spark.home", "should set config 'spark.home' or environment variable 'SPARK_HOME'");
376377
}
377-
if (SPARK_HOME != null) {
378-
props.setProperty("spark.home", SPARK_HOME);
379-
}
378+
// rewrite env for spark submit
379+
props.setProperty("spark.home", SPARK_HOME);
380380

381381
// TODO: Check if we can get spark-submit
382382

java/openmldb-taskmanager/src/main/java/com/_4paradigm/openmldb/taskmanager/server/TaskManagerServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static void main(String[] args) {
141141
server.start();
142142
} catch (Exception e) {
143143
e.printStackTrace();
144-
logger.error(String.format("Fail to start TaskManager, message: ", e.getMessage()));
144+
logger.error("Fail to start TaskManager", e);
145145
}
146146
}
147147

0 commit comments

Comments
 (0)