This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 58526816b7d [To dev/1.3] Fix dead lock when take snapshot for Trigger
and UDF
58526816b7d is described below
commit 58526816b7d0ad47e23522f137cda94027cfea23
Author: Weihao Li <[email protected]>
AuthorDate: Tue Jul 8 09:03:23 2025 +0800
[To dev/1.3] Fix dead lock when take snapshot for Trigger and UDF
(cherry picked from commit c5009f3ad617f53e490e99cec4f64bae6974bb2b)
---
.../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 af7cb37669d..9ff58305bf5 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
@@ -78,8 +78,7 @@ import static org.junit.Assert.assertEquals;
@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 {
@@ -87,7 +86,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 51f997192a9..1c7682dd35b 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
@@ -194,7 +194,6 @@ public class UDFInfo implements SnapshotProcessor {
return false;
}
- acquireUDFTableLock();
try (FileOutputStream fileOutputStream = new
FileOutputStream(snapshotFile)) {
serializeExistedJarToMD5(fileOutputStream);
@@ -205,8 +204,6 @@ public class UDFInfo implements SnapshotProcessor {
fileOutputStream.getFD().sync();
return true;
- } finally {
- releaseUDFTableLock();
}
}