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

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


The following commit(s) were added to refs/heads/master by this push:
     new 04d9a4a540 [IOTDB-4501]fix FileAlreadyExistsException when taking 
snapshot (#7408)
04d9a4a540 is described below

commit 04d9a4a540de729fd3370ac95cec3c11d4f0b275
Author: Yifu Zhou <[email protected]>
AuthorDate: Sat Sep 24 09:44:29 2022 +0800

    [IOTDB-4501]fix FileAlreadyExistsException when taking snapshot (#7408)
    
    [IOTDB-4501]fix FileAlreadyExistsException when taking snapshot (#7408)
---
 .../main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java 
b/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java
index d90eb08a9e..4b1f98aa4e 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/engine/snapshot/SnapshotTaker.java
@@ -178,7 +178,7 @@ public class SnapshotTaker {
     if (!source.exists()) {
       LOGGER.error("Hard link source file {} doesn't exist", source);
     }
-
+    Files.deleteIfExists(target.toPath());
     Files.createLink(target.getAbsoluteFile().toPath(), 
source.getAbsoluteFile().toPath());
     snapshotLogger.logFile(source.getAbsolutePath(), target.getAbsolutePath());
   }

Reply via email to