You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2024/01/10 11:07:00 UTC
(iotdb) 01/02: Fix PipePeriodicalJobExecutor$1:68 - Periodical job PipeTsFileResourceManager#ttlCheck() failed
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch fix-pipe-file-read
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 5b580a6bf35b2419b8af6094a0d141aa4dfeab93
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Wed Jan 10 17:51:39 2024 +0800
Fix PipePeriodicalJobExecutor$1:68 - Periodical job PipeTsFileResourceManager#ttlCheck() failed
---
.../resource/tsfile/PipeTsFileResourceManager.java | 38 ++++++++++----------
.../pipe/resource/wal/PipeWALResourceManager.java | 40 ++++++++++++----------
2 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java
index 65d4ea60e18..6e23dba8bc7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java
@@ -59,27 +59,29 @@ public class PipeTsFileResourceManager {
private void ttlCheck() {
final Iterator<Map.Entry<String, PipeTsFileResource>> iterator =
hardlinkOrCopiedFileToPipeTsFileResourceMap.entrySet().iterator();
- while (iterator.hasNext()) {
- final Map.Entry<String, PipeTsFileResource> entry = iterator.next();
+ try {
+ while (iterator.hasNext()) {
+ final Map.Entry<String, PipeTsFileResource> entry = iterator.next();
- lock.lock();
- try {
- if (entry.getValue().closeIfOutOfTimeToLive()) {
- iterator.remove();
- } else {
- LOGGER.info(
- "Pipe file (file name: {}) is still referenced {} times",
- entry.getKey(),
- entry.getValue().getReferenceCount());
+ lock.lock();
+ try {
+ if (entry.getValue().closeIfOutOfTimeToLive()) {
+ iterator.remove();
+ } else {
+ LOGGER.info(
+ "Pipe file (file name: {}) is still referenced {} times",
+ entry.getKey(),
+ entry.getValue().getReferenceCount());
+ }
+ } catch (IOException e) {
+ LOGGER.warn("failed to close PipeTsFileResource when checking TTL: ", e);
+ } finally {
+ lock.unlock();
}
- } catch (ConcurrentModificationException e) {
- LOGGER.info(
- "Concurrent modification issues happened, skipping the file in this round of ttl check");
- } catch (IOException e) {
- LOGGER.warn("failed to close PipeTsFileResource when checking TTL: ", e);
- } finally {
- lock.unlock();
}
+ } catch (ConcurrentModificationException e) {
+ LOGGER.info(
+ "Concurrent modification issues happened, skipping the file in this round of ttl check");
}
}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResourceManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResourceManager.java
index 0c34edda8a3..40353d4ac1c 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResourceManager.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/PipeWALResourceManager.java
@@ -61,27 +61,29 @@ public abstract class PipeWALResourceManager {
private void ttlCheck() {
final Iterator<Map.Entry<Long, PipeWALResource>> iterator =
memtableIdToPipeWALResourceMap.entrySet().iterator();
- while (iterator.hasNext()) {
- final Map.Entry<Long, PipeWALResource> entry = iterator.next();
- final ReentrantLock lock =
- memtableIdSegmentLocks[(int) (entry.getKey() % SEGMENT_LOCK_COUNT)];
-
- lock.lock();
- try {
- if (entry.getValue().invalidateIfPossible()) {
- iterator.remove();
- } else if (LOGGER.isDebugEnabled()) {
- LOGGER.debug(
- "WAL (memtableId {}) is still referenced {} times",
- entry.getKey(),
- entry.getValue().getReferenceCount());
+ try {
+ while (iterator.hasNext()) {
+ final Map.Entry<Long, PipeWALResource> entry = iterator.next();
+ final ReentrantLock lock =
+ memtableIdSegmentLocks[(int) (entry.getKey() % SEGMENT_LOCK_COUNT)];
+
+ lock.lock();
+ try {
+ if (entry.getValue().invalidateIfPossible()) {
+ iterator.remove();
+ } else if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(
+ "WAL (memtableId {}) is still referenced {} times",
+ entry.getKey(),
+ entry.getValue().getReferenceCount());
+ }
+ } finally {
+ lock.unlock();
}
- } catch (ConcurrentModificationException e) {
- LOGGER.info(
- "Concurrent modification issues happened, skipping the WAL in this round of ttl check");
- } finally {
- lock.unlock();
}
+ } catch (ConcurrentModificationException e) {
+ LOGGER.info(
+ "Concurrent modification issues happened, skipping the WAL in this round of ttl check");
}
}