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 2022/04/10 03:55:49 UTC

[GitHub] [iotdb] MarcosZyk commented on a diff in pull request #5403: [IOTDB-2803] Implement create timeseries metadata operation through consensus layer in MPP framework

MarcosZyk commented on code in PR #5403:
URL: https://github.com/apache/iotdb/pull/5403#discussion_r846708587


##########
server/src/main/java/org/apache/iotdb/db/consensus/statemachine/SchemaRegionStateMachine.java:
##########
@@ -47,7 +66,28 @@ public void stop() {}
   @Override
   protected TSStatus write(FragmentInstance fragmentInstance) {
     logger.info("Execute write plan in SchemaRegionStateMachine");
-    return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
+
+    // Take create Timeseries as an example
+    PlanNode planNode = fragmentInstance.getFragment().getRoot();
+    // TODO transfer to physicalplan as a tentative plan
+    PhysicalPlan physicalPlan = planNode.transferToPhysicalPlan();
+    return write(physicalPlan);
+  }
+
+  protected TSStatus write(PhysicalPlan plan) {
+    boolean isSuccessful;
+    try {
+      isSuccessful = executor.processNonQuery(plan);
+    } catch (QueryProcessException e) {
+      logger.error("{}: query process Error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
+      return RpcUtils.getStatus(e.getErrorCode(), e.getMessage());

Review Comment:
   Should we invoke the interfaces provided by SchemaRegion directly?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

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