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

tanxinyu 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 47b7e82  [IOTDB-2143] fix wrong precision in cluster mode (#4570)
47b7e82 is described below

commit 47b7e82a8bd68f3128ebda48de283acd3feaf5e5
Author: Zhong Wang <[email protected]>
AuthorDate: Wed Dec 22 00:30:36 2021 +0800

    [IOTDB-2143] fix wrong precision in cluster mode (#4570)
    
    * [IOTDB-2143] fix wrong precision in cluster mode
    
    * Resolve the comments
---
 .../apache/iotdb/cluster/metadata/CMManager.java   | 14 ++++++++++--
 .../iotdb/cluster/query/LocalQueryExecutor.java    | 26 +++++++++++++++++-----
 2 files changed, 33 insertions(+), 7 deletions(-)

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 ab81bd4..d0d6a93 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
@@ -1188,7 +1188,13 @@ public class CMManager extends MManager {
     return paths;
   }
 
-  /** Similar to method getAllTimeseriesPath(), but return Path with alias 
alias. */
+  /**
+   * Similar to method getAllTimeseriesPath(), but return Path with alias.
+   *
+   * <p>Please note that for a returned measurement path, the name, alias and 
datatype are
+   * guaranteed to be accurate, while the compression type, encoding and other 
fields are not. See
+   * {@link GetAllPathsResult}
+   */
   @Override
   public Pair<List<MeasurementPath>, Integer> getMeasurementPathsWithAlias(
       PartialPath pathPattern, int limit, int offset) throws MetadataException 
{
@@ -1213,7 +1219,11 @@ public class CMManager extends MManager {
   }
 
   /**
-   * Get all paths after removing wildcards in the path
+   * Get all paths after removing wildcards in the path.
+   *
+   * <p>Please note that for a returned measurement path, the name, alias and 
datatype are
+   * guaranteed to be accurate, while the compression type, encoding and other 
fields are not. See
+   * {@link GetAllPathsResult}.
    *
    * @param originPath a path potentially with wildcard
    * @return all paths after removing wildcards in the path
diff --git 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/LocalQueryExecutor.java 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/LocalQueryExecutor.java
index dd6ec9f..72eb83e 100644
--- 
a/cluster/src/main/java/org/apache/iotdb/cluster/query/LocalQueryExecutor.java
+++ 
b/cluster/src/main/java/org/apache/iotdb/cluster/query/LocalQueryExecutor.java
@@ -209,7 +209,8 @@ public class LocalQueryExecutor {
    * @param request
    */
   public long querySingleSeries(SingleSeriesQueryRequest request)
-      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException, IOException {
+      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException, IOException,
+          MetadataException {
     logger.debug(
         "{}: {} is querying {}, queryId: {}",
         name,
@@ -220,6 +221,10 @@ public class LocalQueryExecutor {
 
     MeasurementPath path =
         getAssembledPathFromRequest(request.getPath(), (byte) 
request.getDataTypeOrdinal());
+    // The request is routed to this node since this node contains the data and
+    // metadata of the designated timeseries. Because of which, the following 
metadata access will
+    // not trigger an RPC.
+    path.setMeasurementSchema(IoTDB.metaManager.getSeriesSchema(path));
     TSDataType dataType = TSDataType.values()[request.getDataTypeOrdinal()];
     Filter timeFilter = null;
     Filter valueFilter = null;
@@ -288,7 +293,8 @@ public class LocalQueryExecutor {
    * @param request
    */
   public long queryMultSeries(MultSeriesQueryRequest request)
-      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException, IOException {
+      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException, IOException,
+          MetadataException {
     logger.debug(
         "{}: {} is querying {}, queryId: {}",
         name,
@@ -300,9 +306,14 @@ public class LocalQueryExecutor {
     List<MeasurementPath> paths = Lists.newArrayList();
     List<TSDataType> dataTypes = Lists.newArrayList();
     for (int i = 0; i < request.getPath().size(); i++) {
-      paths.add(
+      MeasurementPath path =
           getAssembledPathFromRequest(
-              request.getPath().get(i), 
request.getDataTypeOrdinal().get(i).byteValue()));
+              request.getPath().get(i), 
request.getDataTypeOrdinal().get(i).byteValue());
+      // The request is routed to this node since this node contains the data 
and
+      // metadata of the designated timeseries. Because of which, the 
following metadata access will
+      // not trigger an RPC.
+      path.setMeasurementSchema(IoTDB.metaManager.getSeriesSchema(path));
+      paths.add(path);
       dataTypes.add(TSDataType.values()[request.getDataTypeOrdinal().get(i)]);
     }
     Filter timeFilter = null;
@@ -532,7 +543,8 @@ public class LocalQueryExecutor {
    * be returned.
    */
   public long querySingleSeriesByTimestamp(SingleSeriesQueryRequest request)
-      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException {
+      throws CheckConsistencyException, QueryProcessException, 
StorageEngineException,
+          MetadataException {
     logger.debug(
         "{}: {} is querying {} by timestamp, queryId: {}",
         name,
@@ -543,6 +555,10 @@ public class LocalQueryExecutor {
 
     MeasurementPath path =
         getAssembledPathFromRequest(request.getPath(), (byte) 
request.getDataTypeOrdinal());
+    // The request is routed to this node since this node contains the data and
+    // metadata of the designated timeseries. Because of which, the following 
metadata access will
+    // not trigger an RPC.
+    path.setMeasurementSchema(IoTDB.metaManager.getSeriesSchema(path));
     TSDataType dataType = TSDataType.values()[request.dataTypeOrdinal];
     Set<String> deviceMeasurements = request.getDeviceMeasurements();
 

Reply via email to