Skip to content

Commit

Permalink
add exception catch in insert
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojialin committed Apr 6, 2020
1 parent 2acc37f commit b4390ba
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
Expand Up @@ -1074,22 +1074,26 @@ public TSExecuteBatchStatementResp testInsertRowInBatch(TSInsertInBatchReq req)

@Override
public TSStatus insert(TSInsertReq req) {
if (!checkLogin(req.getSessionId())) {
logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
}
try {
if (!checkLogin(req.getSessionId())) {
logger.info(INFO_NOT_LOGIN, IoTDBConstant.GLOBAL_DB_NAME);
return RpcUtils.getStatus(TSStatusCode.NOT_LOGIN_ERROR);
}

InsertPlan plan = new InsertPlan();
plan.setDeviceId(req.getDeviceId());
plan.setTime(req.getTimestamp());
plan.setMeasurements(req.getMeasurements().toArray(new String[0]));
plan.setValues(req.getValues().toArray(new String[0]));
InsertPlan plan = new InsertPlan();
plan.setDeviceId(req.getDeviceId());
plan.setTime(req.getTimestamp());
plan.setMeasurements(req.getMeasurements().toArray(new String[0]));
plan.setValues(req.getValues().toArray(new String[0]));

TSStatus status = checkAuthority(plan, req.getSessionId());
if (status != null) {
return status;
TSStatus status = checkAuthority(plan, req.getSessionId());
if (status != null) {
return status;
}
return executePlan(plan);
} catch (Exception e) {
logger.error("meet error when insert", e);
}
return executePlan(plan);
}

@Override
Expand Down

0 comments on commit b4390ba

Please sign in to comment.