Caideyipi commented on code in PR #12355:
URL: https://github.com/apache/iotdb/pull/12355#discussion_r1615509875


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -1669,7 +1671,9 @@ public SettableFuture<ConfigTaskResult> 
createPipe(CreatePipeStatement createPip
     SettableFuture<ConfigTaskResult> future = SettableFuture.create();
 
     // Validate pipe name
-    if 
(createPipeStatement.getPipeName().startsWith(PipeStaticMeta.SYSTEM_PIPE_PREFIX))
 {
+    if (!(DataRegionConsensusImpl.getInstance() instanceof PipeConsensus

Review Comment:
   This is the normal path of pipe creation, thus it cannot be restricted to 
"PipeConsensus". If you want to let the consensus pipe pass, you can call the 
"configNodeClient" directly or just prohibit the subscription pipe. The former 
one is more recommended because it can avoid users from manully creating 
consensus pipes.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -1669,7 +1671,9 @@ public SettableFuture<ConfigTaskResult> 
createPipe(CreatePipeStatement createPip
     SettableFuture<ConfigTaskResult> future = SettableFuture.create();
 
     // Validate pipe name
-    if 
(createPipeStatement.getPipeName().startsWith(PipeStaticMeta.SYSTEM_PIPE_PREFIX))
 {
+    if (!(DataRegionConsensusImpl.getInstance() instanceof PipeConsensus

Review Comment:
   ……



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/ConsensusPipeDataNodeRuntimeAgentGuardian.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.pipe.consensus;
+
+import org.apache.iotdb.consensus.pipe.consensuspipe.ConsensusPipeGuardian;
+import org.apache.iotdb.db.pipe.agent.PipeAgent;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConsensusPipeDataNodeRuntimeAgentGuardian implements 
ConsensusPipeGuardian {
+  private static final Logger LOGGER =
+      LoggerFactory.getLogger(ConsensusPipeDataNodeRuntimeAgentGuardian.class);
+  private boolean registered = false;
+  private String id;
+
+  @Override
+  public synchronized void start(String id, Runnable guardJob, long 
intervalInSeconds) {
+    if (!registered) {
+      LOGGER.info(
+          "Registering periodical job {} with interval in seconds {}.", id, 
intervalInSeconds);
+
+      this.registered = true;
+      this.id = id;
+      PipeAgent.runtime().registerPeriodicalJob(id, guardJob, 
intervalInSeconds);
+    }
+  }
+
+  @Override
+  public synchronized void stop() {
+    LOGGER.info("Try to stop periodical job {}, but it will not stop.", id);
+    // TODO: add deregister in PipePeriodicalJobExecutor

Review Comment:
   Complete it before merge



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to