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/08/27 16:04:24 UTC

[GitHub] [iotdb] HeimingZ opened a new pull request, #7148: [IOTDB-4241] Support set system mode in new cluster

HeimingZ opened a new pull request, #7148:
URL: https://github.com/apache/iotdb/pull/7148

   1. Support set system mode in new cluster.
   2. Change command from `SET SYSTEM TO (READONLY|WRITABLE)` to `SET SYSTEM TO (READONLY|RUNNING|ERROR) (ON (LOCAL | CLUSTER))?`.
   3. Change allow_read_only_when_errors_occur to handle_system_error.


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


[GitHub] [iotdb] HeimingZ commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HeimingZ commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956844941


##########
integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSetSystemReadOnlyWritableIT.java:
##########
@@ -170,7 +170,7 @@ public void setReadOnlyAndWritableTest() throws InterruptedException {
     }
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
-      statement.execute("SET SYSTEM TO WRITABLE");
+      statement.execute("SET SYSTEM TO RUNNING");

Review Comment:
   Updated.



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


[GitHub] [iotdb] HTHou commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HTHou commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956850031


##########
docs/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -69,11 +69,12 @@ IoTDB> CLEAR CACHE ON CLUSTER
 
 ## SET STSTEM TO READONLY / WRITABLE

Review Comment:
   And Chinese doc



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


[GitHub] [iotdb] HTHou commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HTHou commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956830643


##########
integration/src/test/java/org/apache/iotdb/db/integration/IoTDBSetSystemReadOnlyWritableIT.java:
##########
@@ -170,7 +170,7 @@ public void setReadOnlyAndWritableTest() throws InterruptedException {
     }
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
-      statement.execute("SET SYSTEM TO WRITABLE");
+      statement.execute("SET SYSTEM TO RUNNING");

Review Comment:
   Should we update the UserGuide?



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


[GitHub] [iotdb] HeimingZ commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HeimingZ commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956855243


##########
docs/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -69,11 +69,12 @@ IoTDB> CLEAR CACHE ON CLUSTER
 
 ## SET STSTEM TO READONLY / WRITABLE

Review Comment:
   Fixed.



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


[GitHub] [iotdb] qiaojialin merged pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
qiaojialin merged PR #7148:
URL: https://github.com/apache/iotdb/pull/7148


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


[GitHub] [iotdb] HTHou commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HTHou commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956831561


##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -362,6 +363,29 @@ public SettableFuture<ConfigTaskResult> loadConfiguration(boolean isCluster) {
     return future;
   }
 
+  @Override
+  public SettableFuture<ConfigTaskResult> setSystemStatus(boolean isCluster, NodeStatus status) {

Review Comment:
   Is it necessary to use `isCluster` in `ClusterConfigTaskExecutor`? 



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


[GitHub] [iotdb] HeimingZ commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HeimingZ commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956845090


##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -362,6 +363,29 @@ public SettableFuture<ConfigTaskResult> loadConfiguration(boolean isCluster) {
     return future;
   }
 
+  @Override
+  public SettableFuture<ConfigTaskResult> setSystemStatus(boolean isCluster, NodeStatus status) {

Review Comment:
   Rename isCluster to onCluster.



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


[GitHub] [iotdb] HTHou commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
HTHou commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956848980


##########
docs/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -69,11 +69,12 @@ IoTDB> CLEAR CACHE ON CLUSTER
 
 ## SET STSTEM TO READONLY / WRITABLE

Review Comment:
   ```suggestion
   ## SET STSTEM TO READONLY / RUNNING / ERROR
   ```



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


[GitHub] [iotdb] qiaojialin commented on a diff in pull request #7148: [IOTDB-4241] Support set system mode in new cluster

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on code in PR #7148:
URL: https://github.com/apache/iotdb/pull/7148#discussion_r956860557


##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java:
##########
@@ -2429,12 +2415,28 @@ public Statement visitLoadConfiguration(IoTDBSqlParser.LoadConfigurationContext
       throw new SemanticException(
           "LOAD CONFIGURATION ON CLUSTER is not supported in standalone mode");
     }
-    if (ctx.LOCAL() != null) {
-      loadConfigurationStatement.setCluster(false);
+    loadConfigurationStatement.setOnCluster(ctx.LOCAL() == null);
+    return loadConfigurationStatement;
+  }
+
+  // Set System Status
+
+  @Override
+  public Statement visitSetSystemStatus(IoTDBSqlParser.SetSystemStatusContext ctx) {
+    SetSystemStatusStatement setSystemStatusStatement = new SetSystemStatusStatement();
+    if (ctx.CLUSTER() != null && !IoTDBDescriptor.getInstance().getConfig().isClusterMode()) {
+      throw new SemanticException(
+          "SET SYSTEM STATUS ON CLUSTER is not supported in standalone mode");
+    }
+    setSystemStatusStatement.setOnCluster(ctx.LOCAL() == null);
+    if (ctx.RUNNING() != null) {
+      setSystemStatusStatement.setStatus(NodeStatus.Running);
+    } else if (ctx.READONLY() != null) {
+      setSystemStatusStatement.setStatus(NodeStatus.ReadOnly);
     } else {
-      loadConfigurationStatement.setCluster(true);
+      setSystemStatusStatement.setStatus(NodeStatus.Error);

Review Comment:
   check if  ctx.ERROR() != null



##########
server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java:
##########
@@ -2239,12 +2240,12 @@ public Operator visitSettle(IoTDBSqlParser.SettleContext ctx) {
 
   @Override
   public Operator visitSetSystemStatus(IoTDBSqlParser.SetSystemStatusContext ctx) {
-    if (ctx.READONLY() != null) {
-      // Set system to ReadOnly
-      return new SetSystemModeOperator(SQLConstant.TOK_SET_SYSTEM_MODE, true);
+    if (ctx.RUNNING() != null) {
+      return new SetSystemModeOperator(SQLConstant.TOK_SET_SYSTEM_MODE, NodeStatus.Running);
+    } else if (ctx.READONLY() != null) {
+      return new SetSystemModeOperator(SQLConstant.TOK_SET_SYSTEM_MODE, NodeStatus.ReadOnly);
     } else {
-      // Set system to Writable
-      return new SetSystemModeOperator(SQLConstant.TOK_SET_SYSTEM_MODE, false);
+      return new SetSystemModeOperator(SQLConstant.TOK_SET_SYSTEM_MODE, NodeStatus.Error);

Review Comment:
   Only ctx.ERROR() != null  will set System to ERROR. otherwise, throw exception here.



##########
server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java:
##########
@@ -1566,17 +1569,21 @@ public NodeStatus getNodeStatus() {
   public void setNodeStatus(NodeStatus newStatus) {
     if (newStatus == NodeStatus.ReadOnly) {
       logger.error(
-          "Change system mode to read-only! Only query statements are permitted!",
+          "Change system status to read-only! Only query statements are permitted!",
           new RuntimeException("System mode is set to READ_ONLY"));
     } else if (newStatus == NodeStatus.Error) {

Review Comment:
   move this logic to HandleSystemErrorStrategy



##########
docs/zh/UserGuide/Maintenance-Tools/Maintenance-Command.md:
##########
@@ -66,13 +66,15 @@ IoTDB> CLEAR CACHE ON LOCAL
 IoTDB> CLEAR CACHE ON CLUSTER
 ```
 
-## SET STSTEM TO READONLY / WRITABLE
 
-手动设置系统为只读或者可写入模式。
+## SET SYSTEM TO READONLY / RUNNING / ERROR
+
+手动设置系统为正常运行、只读、错误状态。在集群模式下,我们提供了设置本节点状态、设置整个集群状态的命令。

Review Comment:
   默认为对整个集群生效。



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