mychaow commented on a change in pull request #2698:
URL: https://github.com/apache/iotdb/pull/2698#discussion_r580966049
##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -1158,23 +1158,46 @@ public TSStatus insertRecords(TSInsertRecordsReq req) {
req.getMeasurementsList().get(i).toArray(new String[0]),
req.valuesList.get(i));
TSStatus status = checkAuthority(plan, req.getSessionId());
- if (status == null) {
- status = executeNonQueryPlan(plan);
- isAllSuccessful =
- ((status.getCode() ==
TSStatusCode.SUCCESS_STATUS.getStatusCode())
- && isAllSuccessful);
+ if (status != null) {
+ insertRowsPlan.getResults().put(i, status);
+ allSuccess = false;
}
- statusList.add(status);
+ insertRowsPlan.addOneInsertRowPlan(plan, i);
} catch (Exception e) {
- isAllSuccessful = false;
- statusList.add(
- onNPEOrUnexpectedException(e, "inserting records",
TSStatusCode.INTERNAL_SERVER_ERROR));
+ allSuccess = false;
+ insertRowsPlan
+ .getResults()
+ .put(
+ i,
+ onNPEOrUnexpectedException(
+ e, "inserting records",
TSStatusCode.INTERNAL_SERVER_ERROR));
}
}
+ TSStatus tsStatus = executeNonQueryPlan(insertRowsPlan);
+
+ return judgeFinalTsStatus(
+ allSuccess, tsStatus, insertRowsPlan.getResults(),
req.deviceIds.size());
+ }
+
+ private TSStatus judgeFinalTsStatus(
+ boolean allSuccess,
+ TSStatus executeTsStatus,
+ Map<Integer, TSStatus> checkTsStatus,
+ int totalRowCount) {
+
+ if (allSuccess) {
Review comment:
Changing allSuccess to allCheckSuccess is better.
----------------------------------------------------------------
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:
[email protected]