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 2020/06/09 02:46:44 UTC

[incubator-iotdb] branch jira-727 created (now 8441461)

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

haonan pushed a change to branch jira-727
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at 8441461  use same string in resource and mmanager

This branch includes the following new commits:

     new 59cf77c  device path
     new 8441461  use same string in resource and mmanager

The 2 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.



[incubator-iotdb] 02/02: use same string in resource and mmanager

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

haonan pushed a commit to branch jira-727
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 844146161bc86fc36fe8a34a8540be4c163f4310
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Jun 9 10:46:01 2020 +0800

    use same string in resource and mmanager
---
 .../apache/iotdb/db/engine/storagegroup/TsFileResource.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index e3f7206..d0c9659 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -41,6 +41,8 @@ import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
 import org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.UpgradeTsFileResourceCallBack;
 import org.apache.iotdb.db.engine.upgrade.UpgradeTask;
 import org.apache.iotdb.db.exception.PartitionViolationException;
+import org.apache.iotdb.db.metadata.MManager;
+import org.apache.iotdb.db.metadata.mnode.MNode;
 import org.apache.iotdb.db.service.UpgradeSevice;
 import org.apache.iotdb.db.utils.FilePathUtils;
 import org.apache.iotdb.db.utils.UpgradeUtils;
@@ -276,9 +278,19 @@ public class TsFileResource {
       Map<String, Integer> deviceMap = new HashMap<>();
       long[] startTimesArray = new long[size];
       long[] endTimesArray = new long[size];
+      MManager mManager = MManager.getInstance();
       for (int i = 0; i < size; i++) {
         String path = ReadWriteIOUtils.readString(inputStream);
         long time = ReadWriteIOUtils.readLong(inputStream);
+        try {
+          if (mManager != null) {
+            MNode deviceNode = mManager.getNodeByPath(path);
+            path = deviceNode.getFullPath();
+          }
+        }
+        catch (Exception e) {
+          logger.error("Cannot get deviceId {} from MManager", path, e);
+        }
         deviceMap.put(path, i);
         startTimesArray[i] = time;
       }


[incubator-iotdb] 01/02: device path

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

haonan pushed a commit to branch jira-727
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 59cf77c68b64622a0071b35d9cb101ce987613ca
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Jun 8 18:12:37 2020 +0800

    device path
---
 server/src/main/java/org/apache/iotdb/db/metadata/MManager.java    | 4 +++-
 server/src/main/java/org/apache/iotdb/db/metadata/MTree.java       | 5 +++--
 server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java | 4 ++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index b9c55a9..a6fcafe 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -135,7 +135,9 @@ public class MManager {
           public MNode loadObjectByKey(String key) throws CacheException {
             lock.readLock().lock();
             try {
-              return mtree.getNodeByPathWithStorageGroupCheck(key);
+              MNode node = mtree.getNodeByPathWithStorageGroupCheck(key);
+              node.setFullPath(key);
+              return node;
             } catch (MetadataException e) {
               throw new CacheException(e);
             } finally {
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index 254b549..f5f449a 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -157,6 +157,7 @@ public class MTree implements Serializable {
       }
       cur = cur.getChild(nodeNames[i]);
     }
+    cur.setFullPath(deviceId);
     return cur;
   }
 
@@ -805,7 +806,7 @@ public class MTree implements Serializable {
     if (!(PATH_WILDCARD).equals(nodeReg)) {
       if (node.hasChild(nodeReg)) {
         if (node.getChild(nodeReg) instanceof LeafMNode) {
-          res.add(parent + node.getName());
+          res.add(node.getFullPath());
         } else {
           findDevices(node.getChild(nodeReg), nodes, idx + 1,
               parent + node.getName() + PATH_SEPARATOR, res);
@@ -815,7 +816,7 @@ public class MTree implements Serializable {
       boolean deviceAdded = false;
       for (MNode child : node.getChildren().values()) {
         if (child instanceof LeafMNode && !deviceAdded) {
-          res.add(parent + node.getName());
+          res.add(node.getFullPath());
           deviceAdded = true;
         } else if (!(child instanceof LeafMNode)) {
           findDevices(child, nodes, idx + 1, parent + node.getName() + PATH_SEPARATOR, res);
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
index 181c309..a4f8558 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MNode.java
@@ -99,6 +99,10 @@ public abstract class MNode implements Serializable {
     return fullPath;
   }
 
+  public void setFullPath(String fullPath) {
+    this.fullPath = fullPath;
+  }
+
   String concatFullPath() {
     StringBuilder builder = new StringBuilder(name);
     MNode curr = this;