You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/04/25 12:22:44 UTC

[iotdb] branch master updated: [IOTDB-5183] Use default snapshot installation path for confignode & schema region

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

jackietien 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 e1103a96d6 [IOTDB-5183] Use default snapshot installation path for confignode & schema region
e1103a96d6 is described below

commit e1103a96d66bb840f8fad558ad8c991aeac9fc4a
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Tue Apr 25 20:22:37 2023 +0800

    [IOTDB-5183] Use default snapshot installation path for confignode & schema region
---
 .../java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java
index 9f9d281110..f19faedf2e 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java
@@ -124,7 +124,13 @@ public class SnapshotStorage implements StateMachineStorage {
       }
       FileInfo fileInfo = null;
       try {
-        fileInfo = new FileInfo(file.toRealPath(), null);
+        if (getSnapshotDir() == null) {
+          // for regions that place the snapshot in default sm folder, use relative path
+          fileInfo = new FileInfo(file, null);
+        } else {
+          // for regions that have a separate snapshot installation path, use absolute path
+          fileInfo = new FileInfo(file.toRealPath(), null);
+        }
       } catch (IOException e) {
         logger.warn("{} cannot resolve real path of {} due to {}", this, file, e);
         return null;