You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by he...@apache.org on 2023/05/15 07:39:30 UTC

[iotdb] branch tiered_storage updated: fix os path format

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

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


The following commit(s) were added to refs/heads/tiered_storage by this push:
     new fa5c374b2fe fix os path format
fa5c374b2fe is described below

commit fa5c374b2fe1525056348fc6ed213b63b4730daf
Author: HeimingZ <zh...@qq.com>
AuthorDate: Mon May 15 15:39:13 2023 +0800

    fix os path format
---
 .../org/apache/iotdb/tsfile/common/conf/TSFileConfig.java    |  6 ------
 .../src/main/java/org/apache/iotdb/tsfile/utils/FSUtils.java | 12 +++++-------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileConfig.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileConfig.java
index 041a67858fe..4dd967556c8 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileConfig.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/common/conf/TSFileConfig.java
@@ -159,8 +159,6 @@ public class TSFileConfig implements Serializable {
 
   private int patternMatchingThreshold = 1000000;
 
-  private String osBucket = "iotdb";
-
   /** customizedProperties, this should be empty by default. */
   private Properties customizedProperties = new Properties();
 
@@ -481,8 +479,4 @@ public class TSFileConfig implements Serializable {
   public String getSprintzPredictScheme() {
     return "fire";
   }
-
-  public String getOSBucket() {
-    return osBucket;
-  }
 }
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/FSUtils.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/FSUtils.java
index ef5a07cf447..0c9f80a591e 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/FSUtils.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/FSUtils.java
@@ -18,8 +18,6 @@
  */
 package org.apache.iotdb.tsfile.utils;
 
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.fileSystem.FSPath;
 import org.apache.iotdb.tsfile.fileSystem.FSType;
 
@@ -31,7 +29,6 @@ import java.io.IOException;
 
 public class FSUtils {
   private static final Logger logger = LoggerFactory.getLogger(FSUtils.class);
-  private static final TSFileConfig conf = TSFileDescriptor.getInstance().getConfig();
   private static final FSType[] fsTypes = {FSType.OBJECT_STORAGE, FSType.HDFS};
   public static final String[] fsPrefix = {"os://", "hdfs://"};
   private static final String[] fsFileClassName = {
@@ -98,18 +95,19 @@ public class FSUtils {
     return new FSPath(type, path);
   }
 
-  public static FSPath parseLocalTsFile2OSFile(File lcoalFile) throws IOException {
+  public static FSPath parseLocalTsFile2OSFile(File lcoalFile, String bucket, String dataNodeId)
+      throws IOException {
     String canonicalPath = lcoalFile.getCanonicalPath();
-    int startIdx = canonicalPath.lastIndexOf("sequence");
+    int startIdx = canonicalPath.lastIndexOf("unsequence");
     if (startIdx < 0) {
-      startIdx = canonicalPath.lastIndexOf("unsequence");
+      startIdx = canonicalPath.lastIndexOf("sequence");
     }
     if (startIdx < 0) {
       throw new IllegalArgumentException(canonicalPath + "isn't a TsFile path.");
     }
     return new FSPath(
         FSType.OBJECT_STORAGE,
-        fsPrefix[0] + conf.getOSBucket() + "/" + canonicalPath.substring(startIdx));
+        fsPrefix[0] + bucket + "/" + dataNodeId + "/" + canonicalPath.substring(startIdx));
   }
 
   public static boolean isLocal(String fsPath) {