You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/04/15 02:40:07 UTC
[iotdb] branch DeadLockLog created (now fedecdd)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch DeadLockLog
in repository https://gitbox.apache.org/repos/asf/iotdb.git.
at fedecdd add lock log
This branch includes the following new commits:
new fedecdd add lock log
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: add lock log
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch DeadLockLog
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit fedecdd9a9f5149b864418e319fe461cc164cd1b
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Thu Apr 15 10:39:22 2021 +0800
add lock log
---
.../engine/storagegroup/StorageGroupProcessor.java | 29 +++++++++++++++++++---
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 9c9db9f..a77b762 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -124,6 +124,7 @@ public class StorageGroupProcessor {
public static final String MERGING_MODIFICATION_FILE_NAME = "merge.mods";
private static final String FAIL_TO_UPGRADE_FOLDER = "Failed to move {} to upgrade folder";
private static final Logger DEBUG_LOGGER = LoggerFactory.getLogger("QUERY_DEBUG");
+ private static final Logger LOCK_LOGGER = LoggerFactory.getLogger("LOCK_LOGGER");
private final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
@@ -1445,7 +1446,7 @@ public class StorageGroupProcessor {
QueryFileManager filePathsManager,
Filter timeFilter)
throws QueryProcessException {
- insertLock.readLock().lock();
+ readLock();
try {
List<TsFileResource> seqResources =
getFileResourceListForQuery(
@@ -1477,16 +1478,36 @@ public class StorageGroupProcessor {
} catch (MetadataException e) {
throw new QueryProcessException(e);
} finally {
- insertLock.readLock().unlock();
+ readUnlock();
+ }
+ }
+
+ public void readLock() {
+ insertLock.writeLock().lock();
+ if (config.isDebugOn()) {
+ LOCK_LOGGER.info("{} insert read lock is held by {}", storageGroupName, Thread.currentThread().getName());
+ }
+ }
+
+ public void readUnlock() {
+ insertLock.writeLock().unlock();
+ if (config.isDebugOn()) {
+ LOCK_LOGGER.info("{} insert read lock is unlocked by {}", storageGroupName, Thread.currentThread().getName());
}
}
public void writeLock() {
insertLock.writeLock().lock();
+ if (config.isDebugOn()) {
+ LOCK_LOGGER.info("{} insert write lock is held by {}", storageGroupName, Thread.currentThread().getName());
+ }
}
public void writeUnlock() {
insertLock.writeLock().unlock();
+ if (config.isDebugOn()) {
+ LOCK_LOGGER.info("{} insert write lock is unlocked by {}", storageGroupName, Thread.currentThread().getName());
+ }
}
/**
@@ -2634,7 +2655,7 @@ public class StorageGroupProcessor {
public void removePartitions(TimePartitionFilter filter) {
// this requires blocking all other activities
tsFileManagement.writeLock();
- insertLock.writeLock().lock();
+ writeLock();
try {
// abort ongoing merges
MergeManager.getINSTANCE().abortMerge(storageGroupName);
@@ -2647,7 +2668,7 @@ public class StorageGroupProcessor {
removePartitions(filter, tsFileManagement.getIterator(false));
} finally {
- insertLock.writeLock().unlock();
+ writeUnlock();
tsFileManagement.writeUnlock();
}
}