This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new c5009f3ad61 Fix dead lock when take snapshot for Trigger and UDF
c5009f3ad61 is described below

commit c5009f3ad617f53e490e99cec4f64bae6974bb2b
Author: Weihao Li <[email protected]>
AuthorDate: Tue Jul 8 08:48:31 2025 +0800

    Fix dead lock when take snapshot for Trigger and UDF
---
 .../confignode/it/IoTDBConfigNodeSnapshot2IT.java  | 47 ++++++++++++++++++++++
 .../confignode/it/IoTDBConfigNodeSnapshotIT.java   |  5 +--
 .../iotdb/confignode/persistence/TriggerInfo.java  |  3 --
 .../iotdb/confignode/persistence/UDFInfo.java      |  3 --
 4 files changed, 49 insertions(+), 9 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshot2IT.java
 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshot2IT.java
new file mode 100644
index 00000000000..c156adbe259
--- /dev/null
+++ 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshot2IT.java
@@ -0,0 +1,47 @@
+/*
+ * 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.it;
+
+import org.apache.iotdb.consensus.ConsensusFactory;
+import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.framework.IoTDBTestRunner;
+import org.apache.iotdb.itbase.category.ClusterIT;
+
+import org.junit.Before;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+@RunWith(IoTDBTestRunner.class)
+@Category({ClusterIT.class})
+public class IoTDBConfigNodeSnapshot2IT extends IoTDBConfigNodeSnapshotIT {
+  @Before
+  public void setUp() throws Exception {
+    // set setConfigNodeRatisSnapshotTriggerThreshold to 1
+    EnvFactory.getEnv()
+        .getConfig()
+        .getCommonConfig()
+        .setConfigNodeConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS)
+        .setConfigNodeRatisSnapshotTriggerThreshold(1)
+        .setTimePartitionInterval(testTimePartitionInterval);
+
+    // Init 2C2D cluster environment
+    EnvFactory.getEnv().initClusterEnvironment(2, 2);
+  }
+}
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
index 54599cfc809..1c8b7c5fb29 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
@@ -83,8 +83,7 @@ import static org.junit.Assert.assertTrue;
 @RunWith(IoTDBTestRunner.class)
 @Category({ClusterIT.class})
 public class IoTDBConfigNodeSnapshotIT {
-  private static final int testRatisSnapshotTriggerThreshold = 100;
-  private static final long testTimePartitionInterval = 86400;
+  protected final long testTimePartitionInterval = 86400;
 
   @Before
   public void setUp() throws Exception {
@@ -92,7 +91,7 @@ public class IoTDBConfigNodeSnapshotIT {
         .getConfig()
         .getCommonConfig()
         .setConfigNodeConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS)
-        
.setConfigNodeRatisSnapshotTriggerThreshold(testRatisSnapshotTriggerThreshold)
+        .setConfigNodeRatisSnapshotTriggerThreshold(100)
         .setTimePartitionInterval(testTimePartitionInterval);
 
     // Init 2C2D cluster environment
diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/TriggerInfo.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/TriggerInfo.java
index e324c6a7c4d..065ae826fb8 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/TriggerInfo.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/TriggerInfo.java
@@ -247,7 +247,6 @@ public class TriggerInfo implements SnapshotProcessor {
       return false;
     }
 
-    acquireTriggerTableLock();
     try (FileOutputStream fileOutputStream = new 
FileOutputStream(snapshotFile)) {
 
       serializeExistedJarToMD5(fileOutputStream);
@@ -257,8 +256,6 @@ public class TriggerInfo implements SnapshotProcessor {
       // fsync
       fileOutputStream.getFD().sync();
       return true;
-    } finally {
-      releaseTriggerTableLock();
     }
   }
 
diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
index 1ae4b5b9640..002813038cf 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java
@@ -209,7 +209,6 @@ public class UDFInfo implements SnapshotProcessor {
       return false;
     }
 
-    acquireUDFTableLock();
     try (FileOutputStream fileOutputStream = new 
FileOutputStream(snapshotFile)) {
 
       serializeExistedJarToMD5(fileOutputStream);
@@ -220,8 +219,6 @@ public class UDFInfo implements SnapshotProcessor {
       fileOutputStream.getFD().sync();
 
       return true;
-    } finally {
-      releaseUDFTableLock();
     }
   }
 

Reply via email to