This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch fix_last_flush_time_deadlock
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/fix_last_flush_time_deadlock
by this push:
new 1d6bf7a9234 fix recover last flush time deadlock
1d6bf7a9234 is described below
commit 1d6bf7a92348724efc28ec06ed3eeecaa2d3af9f
Author: HTHou <[email protected]>
AuthorDate: Mon Jan 22 12:11:52 2024 +0800
fix recover last flush time deadlock
---
.../org/apache/iotdb/db/storageengine/dataregion/DataRegion.java | 8 ++------
.../iotdb/db/storageengine/dataregion/HashLastFlushTimeMap.java | 7 ++++---
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index e74c99c762c..14ddc4fc37d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -3396,13 +3396,9 @@ public class DataRegion implements IDataRegionForQuery {
}
}
+ /* Be careful, the thread that calls this method may not hold the write
lock!!*/
public void releaseFlushTimeMap(long timePartitionId) {
- writeLock("releaseFlushTimeMap");
- try {
- lastFlushTimeMap.removePartition(timePartitionId);
- } finally {
- writeUnlock();
- }
+ lastFlushTimeMap.removePartition(timePartitionId);
}
public long getMemCost() {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/HashLastFlushTimeMap.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/HashLastFlushTimeMap.java
index d8215aff763..3596cbd7fab 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/HashLastFlushTimeMap.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/HashLastFlushTimeMap.java
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
public class HashLastFlushTimeMap implements ILastFlushTimeMap {
@@ -58,7 +59,7 @@ public class HashLastFlushTimeMap implements
ILastFlushTimeMap {
* <p>It is used to separate sequence and unsequence data.
*/
private final Map<Long, Map<String, Long>>
partitionLatestFlushedTimeForEachDevice =
- new HashMap<>();
+ new ConcurrentHashMap<>();
/**
* global mapping of device -> largest timestamp of the latest memtable to *
be submitted to
@@ -68,13 +69,13 @@ public class HashLastFlushTimeMap implements
ILastFlushTimeMap {
*
* <p>It is used to update last cache.
*/
- private final Map<String, Long> globalLatestFlushedTimeForEachDevice = new
HashMap<>();
+ private final Map<String, Long> globalLatestFlushedTimeForEachDevice = new
ConcurrentHashMap<>();
/** used for recovering flush time from tsfile resource */
TsFileManager tsFileManager;
/** record memory cost of map for each partitionId */
- private final Map<Long, Long> memCostForEachPartition = new HashMap<>();
+ private final Map<Long, Long> memCostForEachPartition = new
ConcurrentHashMap<>();
public HashLastFlushTimeMap(TsFileManager tsFileManager) {
this.tsFileManager = tsFileManager;