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 2021/01/06 14:33:20 UTC

[iotdb] branch rel/0.11 updated: fix compaction recover path bug (#2426)

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

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


The following commit(s) were added to refs/heads/rel/0.11 by this push:
     new 4249a4b  fix compaction recover path bug (#2426)
4249a4b is described below

commit 4249a4b83544ff8f8c5734a4e39e5ddadeb2f672
Author: zhanglingzhe0820 <44...@qq.com>
AuthorDate: Wed Jan 6 22:33:01 2021 +0800

    fix compaction recover path bug (#2426)
---
 .../engine/compaction/level/LevelCompactionTsFileManagement.java  | 8 +++++---
 .../apache/iotdb/db/engine/compaction/utils/CompactionLogger.java | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
index 2f279d3..5c4a168 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/level/LevelCompactionTsFileManagement.java
@@ -572,7 +572,7 @@ public class LevelCompactionTsFileManagement extends TsFileManagement {
    * if level < maxLevel-1, the file need compaction else, the file can be merged later
    */
   private File createNewTsFileName(File sourceFile, int level) {
-    String path = sourceFile.getAbsolutePath();
+    String path = sourceFile.getPath();
     String prefixPath = path.substring(0, path.lastIndexOf(FILE_NAME_SEPARATOR) + 1);
     return new File(prefixPath + level + TSFILE_SUFFIX);
   }
@@ -617,7 +617,8 @@ public class LevelCompactionTsFileManagement extends TsFileManagement {
           .values()) {
         for (SortedSet<TsFileResource> tsFileResources : tsFileResourcesWithLevel) {
           for (TsFileResource tsFileResource : tsFileResources) {
-            if (tsFileResource.getTsFile().getAbsolutePath().equals(filePath)) {
+            if (Files
+                .isSameFile(tsFileResource.getTsFile().toPath(), new File(filePath).toPath())) {
               return tsFileResource;
             }
           }
@@ -628,7 +629,8 @@ public class LevelCompactionTsFileManagement extends TsFileManagement {
           .values()) {
         for (List<TsFileResource> tsFileResources : tsFileResourcesWithLevel) {
           for (TsFileResource tsFileResource : tsFileResources) {
-            if (tsFileResource.getTsFile().getAbsolutePath().equals(filePath)) {
+            if (Files
+                .isSameFile(tsFileResource.getTsFile().toPath(), new File(filePath).toPath())) {
               return tsFileResource;
             }
           }
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/compaction/utils/CompactionLogger.java b/server/src/main/java/org/apache/iotdb/db/engine/compaction/utils/CompactionLogger.java
index 1145d98..2bae260 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/compaction/utils/CompactionLogger.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/compaction/utils/CompactionLogger.java
@@ -56,7 +56,7 @@ public class CompactionLogger {
   public void logFile(String prefix, File file) throws IOException {
     logStream.write(prefix);
     logStream.newLine();
-    logStream.write(file.getAbsolutePath());
+    logStream.write(file.getPath());
     logStream.newLine();
     logStream.flush();
   }