You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2022/05/24 15:53:24 UTC
[iotdb] branch iotdb-3227 updated (5c94f7d8a0 -> 2a122b2f52)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a change to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
from 5c94f7d8a0 Merge branch 'master' of github.com:apache/iotdb into iotdb-3227
new 98f928fcf2 config node -> data node
new ffffe4f723 data node: create function
add 2c3d9f7a49 [IOTDB-3246]TsFile Validation Tool (#5970)
add 19dc56d05d [IOTDB-3087] enlarge default value of avg_series_point_number_threhold (#5961)
add 14fd2e8a1e Temporarily disable testDeleteinSelection in RewriteCompactionFileSelectorTest (#6000)
add 7d354edc08 Fix code scanning issue in spark tsfile SQLConstant (#5996)
new 8a95d8325d Merge branch 'master' of github.com:apache/iotdb into iotdb-3227
new f2b2ca0df6 setup UDF services in the same way
new 7ed5ad0cd7 implement SnapshotProcessor in UDFInfo
new 2a122b2f52 snapshot for UDFExecutableManager
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../confignode/client/AsyncDataNodeClientPool.java | 16 +
.../client/handlers/CreateFunctionHandler.java | 58 +++
.../iotdb/confignode/manager/UDFManager.java | 78 +++-
.../iotdb/confignode/persistence/UDFInfo.java | 41 +-
docs/UserGuide/Reference/Config-Manual.md | 12 +-
docs/zh/UserGuide/Reference/Config-Manual.md | 10 +-
.../apache/iotdb/commons/service/ServiceType.java | 1 +
.../commons/udf/service/UDFExecutableManager.java | 116 +++++-
.../udf/service/UDFRegistrationService.java | 15 +-
.../resources/conf/iotdb-engine.properties | 4 +-
.../{settle.bat => validate-tsfile.bat} | 4 +-
.../{settle.sh => validate-tsfile.sh} | 4 +-
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 11 +-
.../java/org/apache/iotdb/db/service/DataNode.java | 30 +-
.../service/thrift/impl/InternalServiceImpl.java | 20 +
.../db/tools/validate/TsFileValidationTool.java | 453 +++++++++++++++++++++
.../cross/RewriteCompactionFileSelectorTest.java | 2 +-
.../iotdb/spark/tsfile/qp/common/SQLConstant.java | 26 +-
thrift/src/main/thrift/mpp.thrift | 13 +
19 files changed, 836 insertions(+), 78 deletions(-)
create mode 100644 confignode/src/main/java/org/apache/iotdb/confignode/client/handlers/CreateFunctionHandler.java
copy server/src/assembly/resources/tools/tsfileToolSet/{settle.bat => validate-tsfile.bat} (96%)
copy server/src/assembly/resources/tools/tsfileToolSet/{settle.sh => validate-tsfile.sh} (92%)
create mode 100644 server/src/main/java/org/apache/iotdb/db/tools/validate/TsFileValidationTool.java
[iotdb] 05/06: implement SnapshotProcessor in UDFInfo
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 7ed5ad0cd79ed8ee631ab92e563fbdabde064fb5
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 18:14:32 2022 +0800
implement SnapshotProcessor in UDFInfo
---
.../org/apache/iotdb/confignode/persistence/UDFInfo.java | 11 +++++++----
.../iotdb/commons/udf/service/UDFExecutableManager.java | 15 ++++++++++++++-
.../iotdb/commons/udf/service/UDFRegistrationService.java | 15 ++++++++++++++-
3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
index 4033e3d518..0bfcd42a54 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
@@ -29,7 +29,6 @@ import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.consensus.request.write.CreateFunctionReq;
import org.apache.iotdb.rpc.TSStatusCode;
-import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,12 +81,16 @@ public class UDFInfo implements SnapshotProcessor {
}
@Override
- public boolean processTakeSnapshot(File snapshotDir) throws TException, IOException {
- return false;
+ public boolean processTakeSnapshot(File snapshotDir) throws IOException {
+ return udfExecutableManager.processTakeSnapshot(snapshotDir)
+ && udfRegistrationService.processTakeSnapshot(snapshotDir);
}
@Override
- public void processLoadSnapshot(File snapshotDir) throws TException, IOException {}
+ public void processLoadSnapshot(File snapshotDir) throws IOException {
+ udfExecutableManager.processLoadSnapshot(snapshotDir);
+ udfRegistrationService.processLoadSnapshot(snapshotDir);
+ }
public UDFExecutableManager getUdfExecutableManager() {
return udfExecutableManager;
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
index 63ccc2278f..5fe7e18380 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.commons.file.SystemFileFactory;
import org.apache.iotdb.commons.service.IService;
import org.apache.iotdb.commons.service.ServiceType;
+import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
import org.apache.commons.io.FileUtils;
@@ -35,7 +36,7 @@ import java.net.URL;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-public class UDFExecutableManager implements IService {
+public class UDFExecutableManager implements IService, SnapshotProcessor {
private final String temporaryLibRoot;
private final String extLibRoot;
@@ -168,4 +169,16 @@ public class UDFExecutableManager implements IService {
public static UDFExecutableManager getInstance() {
return INSTANCE;
}
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ // SnapshotProcessor
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public boolean processTakeSnapshot(File snapshotDir) throws IOException {
+ return false;
+ }
+
+ @Override
+ public void processLoadSnapshot(File snapshotDir) throws IOException {}
}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFRegistrationService.java b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFRegistrationService.java
index 2d81f4b710..ced510ece9 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFRegistrationService.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFRegistrationService.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.commons.file.SystemFileFactory;
import org.apache.iotdb.commons.service.IService;
import org.apache.iotdb.commons.service.ServiceType;
+import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
import org.apache.iotdb.commons.udf.api.UDF;
import org.apache.iotdb.commons.udf.api.exception.UDFRegistrationException;
import org.apache.iotdb.commons.udf.builtin.BuiltinAggregationFunction;
@@ -49,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-public class UDFRegistrationService implements IService {
+public class UDFRegistrationService implements IService, SnapshotProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(UDFRegistrationService.class);
@@ -472,4 +473,16 @@ public class UDFRegistrationService implements IService {
public static UDFRegistrationService getInstance() {
return INSTANCE;
}
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ // SnapshotProcessor
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public boolean processTakeSnapshot(File snapshotDir) throws IOException {
+ return false;
+ }
+
+ @Override
+ public void processLoadSnapshot(File snapshotDir) throws IOException {}
}
[iotdb] 06/06: snapshot for UDFExecutableManager
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2a122b2f5261572d29dc50bf9e68fb263fb4fb9e
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 23:53:11 2022 +0800
snapshot for UDFExecutableManager
---
.../iotdb/confignode/persistence/UDFInfo.java | 6 +-
.../commons/udf/service/UDFExecutableManager.java | 78 +++++++++++++++++++---
2 files changed, 71 insertions(+), 13 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
index 0bfcd42a54..b78a067177 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
@@ -61,7 +61,7 @@ public class UDFInfo implements SnapshotProcessor {
}
}
- public TSStatus createFunction(CreateFunctionReq req) {
+ public synchronized TSStatus createFunction(CreateFunctionReq req) {
final String functionName = req.getFunctionName();
final String className = req.getClassName();
final List<String> uris = req.getUris();
@@ -81,13 +81,13 @@ public class UDFInfo implements SnapshotProcessor {
}
@Override
- public boolean processTakeSnapshot(File snapshotDir) throws IOException {
+ public synchronized boolean processTakeSnapshot(File snapshotDir) throws IOException {
return udfExecutableManager.processTakeSnapshot(snapshotDir)
&& udfRegistrationService.processTakeSnapshot(snapshotDir);
}
@Override
- public void processLoadSnapshot(File snapshotDir) throws IOException {
+ public synchronized void processLoadSnapshot(File snapshotDir) throws IOException {
udfExecutableManager.processLoadSnapshot(snapshotDir);
udfRegistrationService.processLoadSnapshot(snapshotDir);
}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
index 5fe7e18380..ea43a16b86 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
@@ -27,6 +27,8 @@ import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -34,18 +36,21 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
public class UDFExecutableManager implements IService, SnapshotProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(UDFExecutableManager.class);
+
private final String temporaryLibRoot;
- private final String extLibRoot;
+ private final String udfLibRoot;
private final AtomicLong requestCounter;
- private UDFExecutableManager(String temporaryLibRoot, String extLibRoot) {
+ private UDFExecutableManager(String temporaryLibRoot, String udfLibRoot) {
this.temporaryLibRoot = temporaryLibRoot;
- this.extLibRoot = extLibRoot;
+ this.udfLibRoot = udfLibRoot;
requestCounter = new AtomicLong(0);
}
@@ -62,7 +67,7 @@ public class UDFExecutableManager implements IService, SnapshotProcessor {
getDirByRequestId(resource.getRequestId()), getDirByFunctionName(functionName));
}
- public void removeFromTemporaryLibRoot(UDFExecutableResource resource) throws IOException {
+ public void removeFromTemporaryLibRoot(UDFExecutableResource resource) {
removeFromTemporaryLibRoot(resource.getRequestId());
}
@@ -117,7 +122,7 @@ public class UDFExecutableManager implements IService, SnapshotProcessor {
}
public String getDirStringByFunctionName(String functionName) {
- return extLibRoot + File.separator + functionName + File.separator;
+ return udfLibRoot + File.separator + functionName + File.separator;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -128,7 +133,7 @@ public class UDFExecutableManager implements IService, SnapshotProcessor {
public void start() throws StartupException {
try {
makeDirIfNecessary(temporaryLibRoot);
- makeDirIfNecessary(extLibRoot);
+ makeDirIfNecessary(udfLibRoot);
} catch (Exception e) {
throw new StartupException(e);
}
@@ -151,9 +156,9 @@ public class UDFExecutableManager implements IService, SnapshotProcessor {
private static UDFExecutableManager INSTANCE = null;
public static synchronized UDFExecutableManager setupAndGetInstance(
- String temporaryLibRoot, String extLibRoot) {
+ String temporaryLibRoot, String udfLibRoot) {
if (INSTANCE == null) {
- INSTANCE = new UDFExecutableManager(temporaryLibRoot, extLibRoot);
+ INSTANCE = new UDFExecutableManager(temporaryLibRoot, udfLibRoot);
}
return INSTANCE;
}
@@ -176,9 +181,62 @@ public class UDFExecutableManager implements IService, SnapshotProcessor {
@Override
public boolean processTakeSnapshot(File snapshotDir) throws IOException {
- return false;
+ return takeSnapshotForDir(
+ temporaryLibRoot,
+ snapshotDir.getAbsolutePath() + File.separator + "ext" + File.separator + "temporary")
+ && takeSnapshotForDir(
+ udfLibRoot,
+ snapshotDir.getAbsolutePath() + File.separator + "ext" + File.separator + "udf");
+ }
+
+ private boolean takeSnapshotForDir(String source, String snapshotDestination) throws IOException {
+ final SystemFileFactory systemFileFactory = SystemFileFactory.INSTANCE;
+ final File sourceFile = systemFileFactory.getFile(source);
+ final File destinationFile = systemFileFactory.getFile(snapshotDestination);
+ final File temporaryFile =
+ systemFileFactory.getFile(destinationFile.getAbsolutePath() + "-" + UUID.randomUUID());
+
+ FileUtils.deleteQuietly(temporaryFile);
+ FileUtils.forceMkdir(temporaryFile);
+
+ try {
+ FileUtils.copyDirectory(sourceFile, temporaryFile);
+ FileUtils.deleteQuietly(destinationFile);
+ return temporaryFile.renameTo(destinationFile);
+ } finally {
+ FileUtils.deleteQuietly(temporaryFile);
+ }
}
@Override
- public void processLoadSnapshot(File snapshotDir) throws IOException {}
+ public void processLoadSnapshot(File snapshotDir) throws IOException {
+ loadSnapshotForDir(
+ snapshotDir.getAbsolutePath() + File.separator + "ext" + File.separator + "temporary",
+ temporaryLibRoot);
+ loadSnapshotForDir(
+ snapshotDir.getAbsolutePath() + File.separator + "ext" + File.separator + "udf",
+ udfLibRoot);
+ }
+
+ private void loadSnapshotForDir(String snapshotSource, String destination) throws IOException {
+ final SystemFileFactory systemFileFactory = SystemFileFactory.INSTANCE;
+ final File sourceFile = systemFileFactory.getFile(snapshotSource);
+ final File destinationFile = systemFileFactory.getFile(destination);
+ final File temporaryFile =
+ systemFileFactory.getFile(destinationFile.getAbsolutePath() + "-" + UUID.randomUUID());
+
+ try {
+ FileUtils.moveDirectory(destinationFile, temporaryFile);
+ FileUtils.forceMkdir(destinationFile);
+ try {
+ FileUtils.copyDirectory(sourceFile, destinationFile);
+ } catch (Exception e) {
+ LOGGER.error("Failed to load udf snapshot and rollback.");
+ FileUtils.deleteQuietly(destinationFile);
+ FileUtils.moveDirectory(temporaryFile, destinationFile);
+ }
+ } finally {
+ FileUtils.deleteQuietly(temporaryFile);
+ }
+ }
}
[iotdb] 02/06: data node: create function
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit ffffe4f723c59b54778d11e7f0b4eb40d7d4d8a4
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 12:19:35 2022 +0800
data node: create function
---
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 9 ++++++
.../java/org/apache/iotdb/db/service/DataNode.java | 34 +++++++++++++++-------
.../service/thrift/impl/InternalServiceImpl.java | 18 ++++++++++--
3 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 7e651bae80..58dedbee7a 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -249,6 +249,10 @@ public class IoTDBConfig {
private String udfDir =
IoTDBConstant.EXT_FOLDER_NAME + File.separator + IoTDBConstant.UDF_FOLDER_NAME;
+ /** External temporary lib directory for storing downloaded JAR files */
+ private String temporaryLibDir =
+ IoTDBConstant.EXT_FOLDER_NAME + File.separator + IoTDBConstant.TMP_FOLDER_NAME;
+
/** External lib directory for trigger, stores user-uploaded JAR files */
private String triggerDir =
IoTDBConstant.EXT_FOLDER_NAME + File.separator + IoTDBConstant.TRIGGER_FOLDER_NAME;
@@ -984,6 +988,7 @@ public class IoTDBConfig {
indexRootFolder = addHomeDir(indexRootFolder);
extDir = addHomeDir(extDir);
udfDir = addHomeDir(udfDir);
+ temporaryLibDir = addHomeDir(temporaryLibDir);
triggerDir = addHomeDir(triggerDir);
mqttDir = addHomeDir(mqttDir);
for (int i = 0; i < walDirs.length; i++) {
@@ -1177,6 +1182,10 @@ public class IoTDBConfig {
return udfDir;
}
+ public String getTemporaryLibDir() {
+ return temporaryLibDir;
+ }
+
public void setUdfDir(String udfDir) {
this.udfDir = udfDir;
}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
index 05ad28efcf..6629c2bd05 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -30,6 +30,7 @@ import org.apache.iotdb.commons.service.JMXService;
import org.apache.iotdb.commons.service.RegisterManager;
import org.apache.iotdb.commons.service.StartupChecks;
import org.apache.iotdb.commons.udf.service.UDFClassLoaderManager;
+import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
import org.apache.iotdb.commons.udf.service.UDFRegistrationService;
import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterReq;
import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterResp;
@@ -277,16 +278,8 @@ public class DataNode implements DataNodeMBean {
.getConfig()
.setRpcImplClassName(DataNodeTSIServiceImpl.class.getName());
- registerManager.register(TemporaryQueryDataFileService.getInstance());
- registerManager.register(
- UDFClassLoaderManager.setupAndGetInstance(
- IoTDBDescriptor.getInstance().getConfig().getUdfDir()));
- registerManager.register(
- UDFRegistrationService.setupAndGetInstance(
- IoTDBDescriptor.getInstance().getConfig().getSystemDir()
- + File.separator
- + "udf"
- + File.separator));
+ initUdfServices();
+
registerManager.register(ReceiverService.getInstance());
registerManager.register(MetricsService.getInstance());
@@ -328,6 +321,27 @@ public class DataNode implements DataNodeMBean {
logger.info("Congratulation, IoTDB DataNode is set up successfully. Now, enjoy yourself!");
}
+ private void initUdfServices() throws StartupException {
+ try {
+ UDFExecutableManager.setupAndGetInstance(
+ IoTDBDescriptor.getInstance().getConfig().getTemporaryLibDir(),
+ IoTDBDescriptor.getInstance().getConfig().getUdfDir());
+ } catch (Exception e) {
+ throw new StartupException(e);
+ }
+
+ registerManager.register(TemporaryQueryDataFileService.getInstance());
+ registerManager.register(
+ UDFClassLoaderManager.setupAndGetInstance(
+ IoTDBDescriptor.getInstance().getConfig().getUdfDir()));
+ registerManager.register(
+ UDFRegistrationService.setupAndGetInstance(
+ IoTDBDescriptor.getInstance().getConfig().getSystemDir()
+ + File.separator
+ + "udf"
+ + File.separator));
+ }
+
private void initConfigManager() {
long time = System.currentTimeMillis();
IoTDB.configManager.init();
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
index 805b4846ed..1c9721d091 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
@@ -32,6 +32,8 @@ import org.apache.iotdb.commons.consensus.SchemaRegionId;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
+import org.apache.iotdb.commons.udf.service.UDFRegistrationService;
import org.apache.iotdb.consensus.IConsensus;
import org.apache.iotdb.consensus.common.Peer;
import org.apache.iotdb.consensus.common.request.ByteBufferConsensusRequest;
@@ -345,8 +347,20 @@ public class InternalServiceImpl implements InternalService.Iface {
}
@Override
- public TSStatus createFunction(TCreateFunctionRequest req) throws TException {
- throw new NotImplementedException();
+ public TSStatus createFunction(TCreateFunctionRequest request) throws TException {
+ try {
+ UDFRegistrationService.getInstance()
+ .register(
+ request.getUdfName(),
+ request.getClassName(),
+ request.getUris(),
+ UDFExecutableManager.getInstance(),
+ true);
+ return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
+ } catch (Exception e) {
+ return new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())
+ .setMessage(e.getMessage());
+ }
}
public void handleClientExit() {}
[iotdb] 03/06: Merge branch 'master' of github.com:apache/iotdb into iotdb-3227
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 8a95d8325da9cdb8e7d2216a9f44ad9dfe0be7f9
Merge: ffffe4f723 7d354edc08
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 12:26:06 2022 +0800
Merge branch 'master' of github.com:apache/iotdb into iotdb-3227
docs/UserGuide/Reference/Config-Manual.md | 12 +-
docs/zh/UserGuide/Reference/Config-Manual.md | 10 +-
.../resources/conf/iotdb-engine.properties | 4 +-
.../tools/tsfileToolSet/validate-tsfile.bat | 62 +++
.../tools/tsfileToolSet/validate-tsfile.sh | 48 +++
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 2 +-
.../db/tools/validate/TsFileValidationTool.java | 453 +++++++++++++++++++++
.../cross/RewriteCompactionFileSelectorTest.java | 2 +-
.../iotdb/spark/tsfile/qp/common/SQLConstant.java | 26 +-
9 files changed, 591 insertions(+), 28 deletions(-)
[iotdb] 01/06: config node -> data node
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 98f928fcf2cceb51d14213328a6506e785cc680a
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 11:57:54 2022 +0800
config node -> data node
---
.../confignode/client/AsyncDataNodeClientPool.java | 16 ++++++
.../client/handlers/CreateFunctionHandler.java | 58 +++++++++++++++++++
.../iotdb/confignode/manager/UDFManager.java | 66 ++++++++++++++++++++--
.../service/thrift/impl/InternalServiceImpl.java | 6 ++
thrift/src/main/thrift/mpp.thrift | 13 +++++
5 files changed, 154 insertions(+), 5 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/client/AsyncDataNodeClientPool.java b/confignode/src/main/java/org/apache/iotdb/confignode/client/AsyncDataNodeClientPool.java
index 96d2fe5f1e..17d93b8f85 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/client/AsyncDataNodeClientPool.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/client/AsyncDataNodeClientPool.java
@@ -25,10 +25,12 @@ import org.apache.iotdb.common.rpc.thrift.THeartbeatReq;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.commons.client.IClientManager;
import org.apache.iotdb.commons.client.async.AsyncDataNodeInternalServiceClient;
+import org.apache.iotdb.confignode.client.handlers.CreateFunctionHandler;
import org.apache.iotdb.confignode.client.handlers.CreateRegionHandler;
import org.apache.iotdb.confignode.client.handlers.HeartbeatHandler;
import org.apache.iotdb.confignode.consensus.request.write.CreateRegionsReq;
import org.apache.iotdb.mpp.rpc.thrift.TCreateDataRegionReq;
+import org.apache.iotdb.mpp.rpc.thrift.TCreateFunctionRequest;
import org.apache.iotdb.mpp.rpc.thrift.TCreateSchemaRegionReq;
import org.apache.thrift.TException;
@@ -233,6 +235,20 @@ public class AsyncDataNodeClientPool {
clientManager.clear(endPoint);
}
+ /**
+ * Only used in UDFManager
+ *
+ * @param endPoint The specific DataNode
+ */
+ public void createFunction(
+ TEndPoint endPoint, TCreateFunctionRequest request, CreateFunctionHandler handler) {
+ try {
+ clientManager.borrowClient(endPoint).createFunction(request, handler);
+ } catch (Exception e) {
+ LOGGER.error("Failed to asking DataNode to create function: {}", endPoint, e);
+ }
+ }
+
// TODO: Is the ClientPool must be a singleton?
private static class ClientPoolHolder {
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/client/handlers/CreateFunctionHandler.java b/confignode/src/main/java/org/apache/iotdb/confignode/client/handlers/CreateFunctionHandler.java
new file mode 100644
index 0000000000..e740a5c6a9
--- /dev/null
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/client/handlers/CreateFunctionHandler.java
@@ -0,0 +1,58 @@
+/*
+ * 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.iotdb.confignode.client.handlers;
+
+import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+import org.apache.thrift.async.AsyncMethodCallback;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+public class CreateFunctionHandler implements AsyncMethodCallback<TSStatus> {
+
+ private final CountDownLatch countDownLatch;
+ private final List<TSStatus> dataNodeResponseStatus;
+ private final String ip;
+ private final int port;
+
+ public CreateFunctionHandler(
+ CountDownLatch countDownLatch, List<TSStatus> dataNodeResponseStatus, String ip, int port) {
+ this.countDownLatch = countDownLatch;
+ this.dataNodeResponseStatus = dataNodeResponseStatus;
+ this.ip = ip;
+ this.port = port;
+ }
+
+ @Override
+ public void onComplete(TSStatus response) {
+ countDownLatch.countDown();
+ dataNodeResponseStatus.add(response);
+ }
+
+ @Override
+ public void onError(Exception exception) {
+ countDownLatch.countDown();
+ dataNodeResponseStatus.add(
+ new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())
+ .setMessage("[" + ip + ":" + port + "] " + exception.getMessage()));
+ }
+}
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
index f2ee00745d..7a26e66c22 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
@@ -19,21 +19,30 @@
package org.apache.iotdb.confignode.manager;
+import org.apache.iotdb.common.rpc.thrift.TDataNodeInfo;
+import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.udf.service.UDFClassLoader;
import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
import org.apache.iotdb.commons.udf.service.UDFExecutableResource;
+import org.apache.iotdb.confignode.client.AsyncDataNodeClientPool;
+import org.apache.iotdb.confignode.client.handlers.CreateFunctionHandler;
import org.apache.iotdb.confignode.conf.ConfigNodeConf;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.consensus.request.write.CreateFunctionReq;
import org.apache.iotdb.confignode.persistence.UDFInfo;
+import org.apache.iotdb.mpp.rpc.thrift.TCreateFunctionRequest;
import org.apache.iotdb.rpc.TSStatusCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.stream.Collectors;
public class UDFManager {
@@ -54,6 +63,7 @@ public class UDFManager {
CONFIG_NODE_CONF.getTemporaryLibDir(), CONFIG_NODE_CONF.getUdfLibDir());
}
+ // TODO: using procedure
public TSStatus createFunction(String functionName, String className, List<String> uris) {
try {
if (uris.isEmpty()) {
@@ -62,11 +72,17 @@ public class UDFManager {
fetchExecutablesAndCheckInstantiation(className, uris);
}
- // TODO: notify data nodes
- return configManager
- .getConsensusManager()
- .write(new CreateFunctionReq(functionName, className, uris))
- .getStatus();
+ final TSStatus configNodeStatus =
+ configManager
+ .getConsensusManager()
+ .write(new CreateFunctionReq(functionName, className, uris))
+ .getStatus();
+ if (configNodeStatus.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ return configNodeStatus;
+ }
+
+ return squashDataNodeResponseStatusList(
+ createFunctionOnDataNodes(functionName, className, uris));
} catch (Exception e) {
final String errorMessage =
String.format(
@@ -98,4 +114,44 @@ public class UDFManager {
udfExecutableManager.removeFromTemporaryLibRoot(resource);
}
}
+
+ private List<TSStatus> createFunctionOnDataNodes(
+ String functionName, String className, List<String> uris) {
+ final List<TDataNodeInfo> onlineDataNodes =
+ configManager.getNodeManager().getOnlineDataNodes(-1);
+ final List<TSStatus> dataNodeResponseStatus =
+ Collections.synchronizedList(new ArrayList<>(onlineDataNodes.size()));
+ final CountDownLatch countDownLatch = new CountDownLatch(onlineDataNodes.size());
+ final TCreateFunctionRequest request =
+ new TCreateFunctionRequest(functionName, className, uris);
+
+ for (TDataNodeInfo dataNodeInfo : onlineDataNodes) {
+ final TEndPoint endPoint = dataNodeInfo.getLocation().getInternalEndPoint();
+ AsyncDataNodeClientPool.getInstance()
+ .createFunction(
+ endPoint,
+ request,
+ new CreateFunctionHandler(
+ countDownLatch, dataNodeResponseStatus, endPoint.getIp(), endPoint.getPort()));
+ }
+
+ try {
+ countDownLatch.await();
+ } catch (InterruptedException e) {
+ LOGGER.error("UDFManager was interrupted during creating functions on data nodes", e);
+ }
+
+ return dataNodeResponseStatus;
+ }
+
+ private TSStatus squashDataNodeResponseStatusList(List<TSStatus> dataNodeResponseStatusList) {
+ final List<TSStatus> failedStatus =
+ dataNodeResponseStatusList.stream()
+ .filter(status -> status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode())
+ .collect(Collectors.toList());
+ return failedStatus.isEmpty()
+ ? new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode())
+ : new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode())
+ .setMessage(failedStatus.toString());
+ }
}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
index 93e679610f..805b4846ed 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
@@ -71,6 +71,7 @@ import org.apache.iotdb.mpp.rpc.thrift.TCancelPlanFragmentReq;
import org.apache.iotdb.mpp.rpc.thrift.TCancelQueryReq;
import org.apache.iotdb.mpp.rpc.thrift.TCancelResp;
import org.apache.iotdb.mpp.rpc.thrift.TCreateDataRegionReq;
+import org.apache.iotdb.mpp.rpc.thrift.TCreateFunctionRequest;
import org.apache.iotdb.mpp.rpc.thrift.TCreateSchemaRegionReq;
import org.apache.iotdb.mpp.rpc.thrift.TFetchFragmentInstanceStateReq;
import org.apache.iotdb.mpp.rpc.thrift.TFragmentInstanceStateResp;
@@ -343,5 +344,10 @@ public class InternalServiceImpl implements InternalService.Iface {
return consensusImpl.write(consensusGroupId, fragmentInstance).getStatus();
}
+ @Override
+ public TSStatus createFunction(TCreateFunctionRequest req) throws TException {
+ throw new NotImplementedException();
+ }
+
public void handleClientExit() {}
}
diff --git a/thrift/src/main/thrift/mpp.thrift b/thrift/src/main/thrift/mpp.thrift
index dfc26e4da0..7f5800a147 100644
--- a/thrift/src/main/thrift/mpp.thrift
+++ b/thrift/src/main/thrift/mpp.thrift
@@ -135,6 +135,12 @@ struct TSchemaFetchResponse {
1: required binary serializedSchemaTree
}
+struct TCreateFunctionRequest {
+ 1: required string udfName
+ 2: required string className
+ 3: required list<string> uris
+}
+
service InternalService {
// -----------------------------------For Data Node-----------------------------------------------
@@ -210,6 +216,13 @@ service InternalService {
* @param ConfigNode will send the latest config_node_list and load balancing policies in THeartbeatReq
**/
common.THeartbeatResp getHeartBeat(common.THeartbeatReq req)
+
+ /**
+ * Config node will create a function on a list of data nodes.
+ *
+ * @param function name, function class name, and executable uris
+ **/
+ common.TSStatus createFunction(TCreateFunctionRequest req)
}
service DataBlockService {
[iotdb] 04/06: setup UDF services in the same way
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch iotdb-3227
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit f2b2ca0df6027364796f00598113d706b67e5d8e
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Tue May 24 18:06:43 2022 +0800
setup UDF services in the same way
---
.../iotdb/confignode/manager/UDFManager.java | 12 ++------
.../iotdb/confignode/persistence/UDFInfo.java | 28 ++++++++++++++----
.../apache/iotdb/commons/service/ServiceType.java | 1 +
.../commons/udf/service/UDFExecutableManager.java | 33 +++++++++++++++++++---
.../java/org/apache/iotdb/db/service/DataNode.java | 12 +++-----
.../service/thrift/impl/InternalServiceImpl.java | 2 +-
6 files changed, 60 insertions(+), 28 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
index 7a26e66c22..840c09b4d5 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/UDFManager.java
@@ -23,7 +23,6 @@ import org.apache.iotdb.common.rpc.thrift.TDataNodeInfo;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.udf.service.UDFClassLoader;
-import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
import org.apache.iotdb.commons.udf.service.UDFExecutableResource;
import org.apache.iotdb.confignode.client.AsyncDataNodeClientPool;
import org.apache.iotdb.confignode.client.handlers.CreateFunctionHandler;
@@ -37,7 +36,6 @@ import org.apache.iotdb.rpc.TSStatusCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -53,14 +51,10 @@ public class UDFManager {
private final ConfigManager configManager;
private final UDFInfo udfInfo;
- private final UDFExecutableManager udfExecutableManager;
- public UDFManager(ConfigManager configManager, UDFInfo udfInfo) throws IOException {
+ public UDFManager(ConfigManager configManager, UDFInfo udfInfo) {
this.configManager = configManager;
this.udfInfo = udfInfo;
- udfExecutableManager =
- UDFExecutableManager.setupAndGetInstance(
- CONFIG_NODE_CONF.getTemporaryLibDir(), CONFIG_NODE_CONF.getUdfLibDir());
}
// TODO: using procedure
@@ -105,13 +99,13 @@ public class UDFManager {
private void fetchExecutablesAndCheckInstantiation(String className, List<String> uris)
throws Exception {
- final UDFExecutableResource resource = udfExecutableManager.request(uris);
+ final UDFExecutableResource resource = udfInfo.getUdfExecutableManager().request(uris);
try (UDFClassLoader temporaryUdfClassLoader = new UDFClassLoader(resource.getResourceDir())) {
Class.forName(className, true, temporaryUdfClassLoader)
.getDeclaredConstructor()
.newInstance();
} finally {
- udfExecutableManager.removeFromTemporaryLibRoot(resource);
+ udfInfo.getUdfExecutableManager().removeFromTemporaryLibRoot(resource);
}
}
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
index 5c3a61d25e..4033e3d518 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.confignode.persistence;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.snapshot.SnapshotProcessor;
+import org.apache.iotdb.commons.udf.api.exception.UDFException;
import org.apache.iotdb.commons.udf.service.UDFExecutableManager;
import org.apache.iotdb.commons.udf.service.UDFRegistrationService;
import org.apache.iotdb.confignode.conf.ConfigNodeConf;
@@ -46,12 +47,19 @@ public class UDFInfo implements SnapshotProcessor {
private final UDFExecutableManager udfExecutableManager;
private final UDFRegistrationService udfRegistrationService;
- public UDFInfo() throws IOException {
- udfExecutableManager =
- UDFExecutableManager.setupAndGetInstance(
- CONFIG_NODE_CONF.getTemporaryLibDir(), CONFIG_NODE_CONF.getUdfLibDir());
- udfRegistrationService =
- UDFRegistrationService.setupAndGetInstance(CONFIG_NODE_CONF.getSystemUdfDir());
+ public UDFInfo() {
+ try {
+ udfExecutableManager =
+ UDFExecutableManager.setupAndGetInstance(
+ CONFIG_NODE_CONF.getTemporaryLibDir(), CONFIG_NODE_CONF.getUdfLibDir());
+ udfExecutableManager.start();
+
+ udfRegistrationService =
+ UDFRegistrationService.setupAndGetInstance(CONFIG_NODE_CONF.getSystemUdfDir());
+ udfRegistrationService.start();
+ } catch (Exception e) {
+ throw new UDFException(e.getMessage());
+ }
}
public TSStatus createFunction(CreateFunctionReq req) {
@@ -80,4 +88,12 @@ public class UDFInfo implements SnapshotProcessor {
@Override
public void processLoadSnapshot(File snapshotDir) throws TException, IOException {}
+
+ public UDFExecutableManager getUdfExecutableManager() {
+ return udfExecutableManager;
+ }
+
+ public UDFRegistrationService getUdfRegistrationService() {
+ return udfRegistrationService;
+ }
}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java b/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
index 1e913818cc..02ca71b26c 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/service/ServiceType.java
@@ -44,6 +44,7 @@ public enum ServiceType {
TVLIST_ALLOCATOR_SERVICE("TVList Allocator", ""),
UDF_CLASSLOADER_MANAGER_SERVICE("UDF Classloader Manager Service", ""),
UDF_REGISTRATION_SERVICE("UDF Registration Service", ""),
+ UDF_EXECUTABLE_MANAGER_SERVICE("UDF Executable Manager Service", ""),
TEMPORARY_QUERY_DATA_FILE_SERVICE("Temporary Query Data File Service", ""),
TRIGGER_REGISTRATION_SERVICE("Trigger Registration Service", ""),
CACHE_HIT_RATIO_DISPLAY_SERVICE(
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
index 5f03dbe04b..63ccc2278f 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/udf/service/UDFExecutableManager.java
@@ -19,7 +19,10 @@
package org.apache.iotdb.commons.udf.service;
+import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.commons.file.SystemFileFactory;
+import org.apache.iotdb.commons.service.IService;
+import org.apache.iotdb.commons.service.ServiceType;
import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
import org.apache.commons.io.FileUtils;
@@ -32,7 +35,7 @@ import java.net.URL;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-public class UDFExecutableManager {
+public class UDFExecutableManager implements IService {
private final String temporaryLibRoot;
private final String extLibRoot;
@@ -116,6 +119,30 @@ public class UDFExecutableManager {
return extLibRoot + File.separator + functionName + File.separator;
}
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ // IService
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ @Override
+ public void start() throws StartupException {
+ try {
+ makeDirIfNecessary(temporaryLibRoot);
+ makeDirIfNecessary(extLibRoot);
+ } catch (Exception e) {
+ throw new StartupException(e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ // nothing to do
+ }
+
+ @Override
+ public ServiceType getID() {
+ return ServiceType.UDF_EXECUTABLE_MANAGER_SERVICE;
+ }
+
/////////////////////////////////////////////////////////////////////////////////////////////////
// singleton instance holder
/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -123,10 +150,8 @@ public class UDFExecutableManager {
private static UDFExecutableManager INSTANCE = null;
public static synchronized UDFExecutableManager setupAndGetInstance(
- String temporaryLibRoot, String extLibRoot) throws IOException {
+ String temporaryLibRoot, String extLibRoot) {
if (INSTANCE == null) {
- makeDirIfNecessary(temporaryLibRoot);
- makeDirIfNecessary(extLibRoot);
INSTANCE = new UDFExecutableManager(temporaryLibRoot, extLibRoot);
}
return INSTANCE;
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
index 6629c2bd05..83e525ef8a 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -322,15 +322,11 @@ public class DataNode implements DataNodeMBean {
}
private void initUdfServices() throws StartupException {
- try {
- UDFExecutableManager.setupAndGetInstance(
- IoTDBDescriptor.getInstance().getConfig().getTemporaryLibDir(),
- IoTDBDescriptor.getInstance().getConfig().getUdfDir());
- } catch (Exception e) {
- throw new StartupException(e);
- }
-
registerManager.register(TemporaryQueryDataFileService.getInstance());
+ registerManager.register(
+ UDFExecutableManager.setupAndGetInstance(
+ IoTDBDescriptor.getInstance().getConfig().getTemporaryLibDir(),
+ IoTDBDescriptor.getInstance().getConfig().getUdfDir()));
registerManager.register(
UDFClassLoaderManager.setupAndGetInstance(
IoTDBDescriptor.getInstance().getConfig().getUdfDir()));
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
index 1c9721d091..792a92625c 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/InternalServiceImpl.java
@@ -347,7 +347,7 @@ public class InternalServiceImpl implements InternalService.Iface {
}
@Override
- public TSStatus createFunction(TCreateFunctionRequest request) throws TException {
+ public TSStatus createFunction(TCreateFunctionRequest request) {
try {
UDFRegistrationService.getInstance()
.register(