You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xu...@apache.org on 2022/01/10 03:03:25 UTC

[iotdb] branch fix_ttl_dead_lock_xkf created (now b573de7)

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

xuekaifeng pushed a change to branch fix_ttl_dead_lock_xkf
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at b573de7  fix dead lock

This branch includes the following new commits:

     new b573de7  fix dead lock

The 1 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.


[iotdb] 01/01: fix dead lock

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b573de7e3fa446fe413de620ce2432e53926932e
Author: 151250176 <15...@smail.nju.edu.cn>
AuthorDate: Mon Jan 10 11:01:49 2022 +0800

    fix dead lock
---
 .../engine/storagegroup/VirtualStorageGroupProcessor.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
index df72353..296830c 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
@@ -2925,8 +2925,17 @@ public class VirtualStorageGroupProcessor {
   }
 
   public void setDataTTL(long dataTTL) {
-    this.dataTTL = dataTTL;
-    checkFilesTTL();
+    // Check files ttl will lock tsfile resource firstly and then lock tsfile.
+    // This lock order is conflict with tsfile creation in insert method, so we get a potential dead
+    // lock
+    // Add this write lock to avoid dead lock above.
+    writeLock("setDataTTL");
+    try {
+      this.dataTTL = dataTTL;
+      checkFilesTTL();
+    } finally {
+      writeUnlock();
+    }
   }
 
   public List<TsFileResource> getSequenceFileTreeSet() {