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


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/runtime/PipeMetaSyncer.java:
##########
@@ -104,16 +123,42 @@ private synchronized void sync() {
       pipeAutoRestartRoundCounter.set(0);
     }
 
-    final TSStatus status = procedureManager.pipeMetaSync();
-
-    if (somePipesNeedRestarting
-        && status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      handleSuccessfulRestartWithLock();
-      procedureManager.pipeHandleMetaChange(true, false);
-    }
+    final TSStatus metaSyncStatus = procedureManager.pipeMetaSync();
+
+    if (metaSyncStatus.getCode() == 
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+      boolean canSkipNextSync = false;
+
+      if (somePipesNeedRestarting) {
+        final boolean isRestartSuccessful = handleSuccessfulRestartWithLock();
+        final TSStatus handleMetaChangeStatus =
+            procedureManager.pipeHandleMetaChangeWithBlock(true, false);
+        if 
(!configManager.getPipeManager().getPipeTaskCoordinator().hasAnyPipe()
+            && isRestartSuccessful
+            && handleMetaChangeStatus.getCode() == 
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+          canSkipNextSync = true;
+        }
+      } else {
+        if 
(!configManager.getPipeManager().getPipeTaskCoordinator().hasAnyPipe()) {
+          canSkipNextSync = true;
+        }
+      }
 
-    if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      procedureManager.pipeHandleMetaChange(true, true);
+      // When the sync operation succeeded while there was no pipe in CN, we 
need to set the
+      // isLastEmptyPipeSyncSuccessful variable and record the version of 
PipeTaskInfo at that time.
+      if (canSkipNextSync) {
+        LOGGER.info("Skip next round of sync if no pipe and no modification on 
PipeTaskInfo.");

Review Comment:
   Actually, it skips all rounds of syncs until one pipe is created, not just 
the next round



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