This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch clusterAlignbydevice
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/clusterAlignbydevice by this
push:
new ecf0cdb add cluster getAllMeasurementByDevicePath (#4214)
ecf0cdb is described below
commit ecf0cdbc62ba9a62f88c17a8a6ef30a5e85dbad1
Author: Marcos_Zyk <[email protected]>
AuthorDate: Fri Oct 22 10:49:19 2021 +0800
add cluster getAllMeasurementByDevicePath (#4214)
---
.../org/apache/iotdb/cluster/metadata/CMManager.java | 16 ++++++++++++++++
.../main/java/org/apache/iotdb/db/metadata/MManager.java | 9 ++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
index ecd9736..22e9fab 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
@@ -463,6 +463,22 @@ public class CMManager extends MManager {
return super.getSeriesSchema(device, measurement);
}
+ @Override
+ public List<IMeasurementSchema> getAllMeasurementByDevicePath(PartialPath
devicePath)
+ throws MetadataException {
+ try {
+ return super.getAllMeasurementByDevicePath(devicePath);
+ } catch (PathNotExistException e) {
+ // try to get schema from remote
+ List<IMeasurementSchema> results =
+
metaPuller.pullMeasurementSchemas(Collections.singletonList(devicePath));
+ if (results.isEmpty()) {
+ throw e;
+ }
+ return results;
+ }
+ }
+
/**
* Check whether the path exists.
*
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 153fcbf..14e112a 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
@@ -1305,7 +1305,7 @@ public class MManager {
// attention: this path must be a device node
public List<IMeasurementSchema> getAllMeasurementByDevicePath(PartialPath
devicePath)
- throws PathNotExistException {
+ throws MetadataException {
Set<IMeasurementSchema> res = new HashSet<>();
try {
IMNode node = mNodeCache.get(devicePath);
@@ -1329,6 +1329,13 @@ public class MManager {
return new ArrayList<>(res);
}
+ /**
+ * Get all the schema in the subTree represented by the prefixPath
+ *
+ * @param prefixPath represents the start node in MTree
+ * @return schema and its path
+ * @throws MetadataException
+ */
public Map<PartialPath, IMeasurementSchema> getAllMeasurementSchemaByPrefix(
PartialPath prefixPath) throws MetadataException {
return mtree.getAllMeasurementSchemaByPrefix(prefixPath);