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 <[email protected]>
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 {}
 }

Reply via email to