You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2024/09/04 03:37:34 UTC

(iotdb) branch fixNoSuchFileException created (now c91ba7444b8)

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

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


      at c91ba7444b8 Fix error log when drop database or migrate region

This branch includes the following new commits:

     new c91ba7444b8 Fix error log when drop database or migrate region

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 error log when drop database or migrate region

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

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

commit c91ba7444b8171ccccf1c04807587f4dd2164610
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Sep 4 11:37:16 2024 +0800

    Fix error log when drop database or migrate region
---
 .../dataregion/tsfile/timeindex/FileTimeIndexCacheRecorder.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/timeindex/FileTimeIndexCacheRecorder.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/timeindex/FileTimeIndexCacheRecorder.java
index d6eb597922e..e744085f8f0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/timeindex/FileTimeIndexCacheRecorder.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/timeindex/FileTimeIndexCacheRecorder.java
@@ -42,7 +42,7 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-import static org.apache.iotdb.commons.utils.FileUtils.deleteDirectoryAndEmptyParent;
+import static org.apache.iotdb.commons.utils.FileUtils.deleteFileOrDirectory;
 import static org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource.getFileTimeIndexSerializedSize;
 
 public class FileTimeIndexCacheRecorder {
@@ -193,10 +193,11 @@ public class FileTimeIndexCacheRecorder {
   }
 
   public void removeFileTimeIndexCache(int dataRegionId) {
-    for (FileTimeIndexCacheWriter writer : writerMap.values()) {
+    FileTimeIndexCacheWriter writer = writerMap.get(dataRegionId);
+    if (writer != null) {
       try {
         writer.close();
-        deleteDirectoryAndEmptyParent(writer.getLogFile());
+        deleteFileOrDirectory(writer.getLogFile(), true);
       } catch (IOException e) {
         LOGGER.warn("Meet error when close FileTimeIndexCache: {}", e.getMessage());
       }