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

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

commit a55eab834ec82f53b53d505e38798597701946ec
Author: HTHou <[email protected]>
AuthorDate: Thu Apr 22 10:45:56 2021 +0800

    Fix CI failed caused by updating unnecessary vector last cache
---
 .../engine/storagegroup/StorageGroupProcessor.java | 79 +++++++++++++---------
 .../iotdb/db/qp/physical/crud/InsertRowPlan.java   | 11 ++-
 2 files changed, 52 insertions(+), 38 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 5dfead5..4d499fa 100755
--- 
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -73,6 +73,7 @@ import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.service.rpc.thrift.TSStatus;
 import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
 import org.apache.iotdb.tsfile.fileSystem.fsFactory.FSFactory;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
@@ -1028,24 +1029,32 @@ public class StorageGroupProcessor {
       return;
     }
     MeasurementMNode[] mNodes = plan.getMeasurementMNodes();
+    int columnIndex = 0;
     for (int i = 0; i < mNodes.length; i++) {
-      if (plan.getColumns()[i] == null) {
-        continue;
-      }
-      // Update cached last value with high priority
-      if (mNodes[i] != null) {
-        // in stand alone version, the seriesPath is not needed, just use 
measurementMNodes[i] to
-        // update last cache
-        IoTDB.metaManager.updateLastCache(
-            null, plan.composeLastTimeValuePair(i), true, latestFlushedTime, 
mNodes[i]);
+      // Don't update cached last value for vector type
+      if (mNodes[i] != null && mNodes[i].getSchema().getType() == 
TSDataType.VECTOR) {
+        columnIndex += 
mNodes[i].getSchema().getValueMeasurementIdList().size();
       } else {
-        // measurementMNodes[i] is null, use the path to update remote cache
-        IoTDB.metaManager.updateLastCache(
-            plan.getDeviceId().concatNode(plan.getMeasurements()[i]),
-            plan.composeLastTimeValuePair(i),
-            true,
-            latestFlushedTime,
-            null);
+        if (plan.getColumns()[i] == null) {
+          columnIndex++;
+          continue;
+        }
+        // Update cached last value with high priority
+        if (mNodes[i] != null) {
+          // in stand alone version, the seriesPath is not needed, just use 
measurementMNodes[i] to
+          // update last cache
+          IoTDB.metaManager.updateLastCache(
+              null, plan.composeLastTimeValuePair(columnIndex), true, 
latestFlushedTime, mNodes[i]);
+        } else {
+          // measurementMNodes[i] is null, use the path to update remote cache
+          IoTDB.metaManager.updateLastCache(
+              
plan.getDeviceId().concatNode(plan.getMeasurements()[columnIndex]),
+              plan.composeLastTimeValuePair(columnIndex),
+              true,
+              latestFlushedTime,
+              null);
+        }
+        columnIndex++;
       }
     }
   }
@@ -1087,23 +1096,31 @@ public class StorageGroupProcessor {
       return;
     }
     MeasurementMNode[] mNodes = plan.getMeasurementMNodes();
+    int columnIndex = 0;
     for (int i = 0; i < mNodes.length; i++) {
-      if (plan.getValues()[i] == null) {
-        continue;
-      }
-      // Update cached last value with high priority
-      if (mNodes[i] != null) {
-        // in stand alone version, the seriesPath is not needed, just use 
measurementMNodes[i] to
-        // update last cache
-        IoTDB.metaManager.updateLastCache(
-            null, plan.composeTimeValuePair(i), true, latestFlushedTime, 
mNodes[i]);
+      // Don't update cached last value for vector type
+      if (mNodes[i] != null && mNodes[i].getSchema().getType() == 
TSDataType.VECTOR) {
+        columnIndex += 
mNodes[i].getSchema().getValueMeasurementIdList().size();
       } else {
-        IoTDB.metaManager.updateLastCache(
-            plan.getDeviceId().concatNode(plan.getMeasurements()[i]),
-            plan.composeTimeValuePair(i),
-            true,
-            latestFlushedTime,
-            null);
+        if (plan.getValues()[columnIndex] == null) {
+          columnIndex++;
+          continue;
+        }
+        // Update cached last value with high priority
+        if (mNodes[i] != null) {
+          // in stand alone version, the seriesPath is not needed, just use 
measurementMNodes[i] to
+          // update last cache
+          IoTDB.metaManager.updateLastCache(
+              null, plan.composeTimeValuePair(columnIndex), true, 
latestFlushedTime, mNodes[i]);
+        } else {
+          IoTDB.metaManager.updateLastCache(
+              
plan.getDeviceId().concatNode(plan.getMeasurements()[columnIndex]),
+              plan.composeTimeValuePair(columnIndex),
+              true,
+              latestFlushedTime,
+              null);
+        }
+        columnIndex++;
       }
     }
   }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java 
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
index bd0150d..f20b385 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java
@@ -546,15 +546,12 @@ public class InsertRowPlan extends InsertPlan {
     return failedValues != null && !failedValues.isEmpty();
   }
 
-  public TimeValuePair composeTimeValuePair(int measurementIndex) {
-    if (measurementIndex >= values.length) {
+  public TimeValuePair composeTimeValuePair(int columnIndex) {
+    if (columnIndex >= values.length) {
       return null;
     }
-    Object value = values[measurementIndex];
-    return new TimeValuePair(
-        time,
-        TsPrimitiveType.getByType(
-            measurementMNodes[measurementIndex].getSchema().getType(), value));
+    Object value = values[columnIndex];
+    return new TimeValuePair(time, 
TsPrimitiveType.getByType(dataTypes[columnIndex], value));
   }
 
   @Override

Reply via email to