You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/02/20 07:29:39 UTC

[GitHub] [iotdb] neuyilan commented on a change in pull request #2698: [IOTDB-1163]optimize the insertRecords session interface for cluster version

neuyilan commented on a change in pull request #2698:
URL: https://github.com/apache/iotdb/pull/2698#discussion_r579615383



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
##########
@@ -1097,6 +1101,27 @@ public void insert(InsertRowsOfOneDevicePlan insertRowsOfOneDevicePlan)
     }
   }
 
+  @Override
+  public void insert(InsertRowsPlan plan) throws QueryProcessException {
+    boolean allSuccess = true;
+    for (int i = 0; i < plan.getInsertRowPlanList().size(); i++) {
+      if (plan.getResults().containsKey(i)) {
+        allSuccess = false;
+        continue;
+      }
+      try {
+        insert(plan.getInsertRowPlanList().get(i));
+        plan.getResults().put(i, RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS));
+      } catch (QueryProcessException e) {
+        plan.getResults().put(i, RpcUtils.getStatus(e.getErrorCode(), e.getMessage()));
+        allSuccess = false;
+      }
+      if (!allSuccess) {

Review comment:
       Thanks for your review, in my opinion, I support inserting the remaining records in case of one record insertion failure. After all, we support partial insertion success. Moreover, this implementation is consistent with the previous semantics of composing each record into an InsertRowPlan.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org