This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 249ec54 do not cache fullPath in LeafMNode
249ec54 is described below
commit 249ec54a1839dcfaec37766d2fc8ec0795071043
Author: qiaojialin <[email protected]>
AuthorDate: Sat May 23 21:46:02 2020 +0800
do not cache fullPath in LeafMNode
---
.../java/org/apache/iotdb/db/metadata/mnode/LeafMNode.java | 4 ++++
.../main/java/org/apache/iotdb/db/metadata/mnode/MNode.java | 12 ++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/LeafMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/LeafMNode.java
index af1c517..bb64a10 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/LeafMNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/LeafMNode.java
@@ -117,6 +117,10 @@ public class LeafMNode extends MNode {
}
}
+ public String getFullPath() {
+ return concatFullPath();
+ }
+
public void resetCache() {
cachedLastValuePair = null;
}
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 d65f575..181c309 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
@@ -35,12 +35,12 @@ public abstract class MNode implements Serializable {
/**
* Name of the MNode
*/
- private String name;
+ protected String name;
protected MNode parent;
/**
- * from root to this node, only be set when used once
+ * from root to this node, only be set when used once for InternalMNode
*/
protected String fullPath;
@@ -95,14 +95,18 @@ public abstract class MNode implements Serializable {
if (fullPath != null) {
return fullPath;
}
+ fullPath = concatFullPath();
+ return fullPath;
+ }
+
+ String concatFullPath() {
StringBuilder builder = new StringBuilder(name);
MNode curr = this;
while (curr.getParent() != null) {
curr = curr.getParent();
builder.insert(0, IoTDBConstant.PATH_SEPARATOR).insert(0, curr.name);
}
- fullPath = builder.toString();
- return fullPath;
+ return builder.toString();
}
@Override