Caideyipi commented on code in PR #11532:
URL: https://github.com/apache/iotdb/pull/11532#discussion_r1392149312
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/runtime/PipeMetaSyncer.java:
##########
@@ -104,16 +117,39 @@ private synchronized void sync() {
pipeAutoRestartRoundCounter.set(0);
}
- final TSStatus status = procedureManager.pipeMetaSync();
+ final TSStatus metaSyncStatus = procedureManager.pipeMetaSync();
if (somePipesNeedRestarting
Review Comment:
Besides, if there are "stopped" pipe, these pipe may be automatically
restarted. Yet, there will be no pipe to restart given that there are no pipes
in the cluster.
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/runtime/PipeMetaSyncer.java:
##########
@@ -104,16 +117,39 @@ private synchronized void sync() {
pipeAutoRestartRoundCounter.set(0);
}
- final TSStatus status = procedureManager.pipeMetaSync();
+ final TSStatus metaSyncStatus = procedureManager.pipeMetaSync();
if (somePipesNeedRestarting
- && status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
- handleSuccessfulRestartWithLock();
- procedureManager.pipeHandleMetaChange(true, false);
+ && metaSyncStatus.getCode() ==
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ final boolean isRestartSuccessful = handleSuccessfulRestartWithLock();
+ final TSStatus handleMetaChangeStatus =
+ procedureManager.pipeHandleMetaChangeWithBlock(true, false);
+ if (!configManager.getPipeManager().getPipeTaskCoordinator().hasAnyPipe()
+ && isRestartSuccessful
+ && handleMetaChangeStatus.getCode() ==
TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+ LOGGER.info(
+ "set isLastEmptyPipeSyncSuccessful to true, skip next round of
sync if no pipe");
+ isLastEmptyPipeSyncSuccessful = true;
Review Comment:
The user behaviour may cause "ABA" problem, such as "empty sync, create,
start, drop(partially succeed on some DN)", and the subsequent syncs may be
skipped, then the failed DN may never know the drop command and will keep
sending data forever.
I think a meta sync cannot be skipped if there are user manual commands
after last empty sync.
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/runtime/PipeMetaSyncer.java:
##########
@@ -104,16 +117,39 @@ private synchronized void sync() {
pipeAutoRestartRoundCounter.set(0);
}
- final TSStatus status = procedureManager.pipeMetaSync();
+ final TSStatus metaSyncStatus = procedureManager.pipeMetaSync();
if (somePipesNeedRestarting
Review Comment:
The "SUCCESS_STATUS" may be compacted to a single "if", and the "!" may be
an "else".
--
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]