Skip to content

Commit ea25d95

Browse files
committed
Update DataNodeShutdownHook.java
1 parent 23563e5 commit ea25d95

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeShutdownHook.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,16 @@ public void run() {
127127
if (PipeDataNodeAgent.task().getPipeCount() != 0) {
128128
for (Map.Entry<String, PipeDataNodeRemainingEventAndTimeOperator> entry :
129129
PipeDataNodeSinglePipeMetrics.getInstance().remainingEventAndTimeOperatorMap.entrySet()) {
130-
while (entry.getValue().getRemainingNonHeartbeatEvents() > 0) {
130+
boolean timeout = false;
131+
while (true) {
132+
if (entry.getValue().getRemainingNonHeartbeatEvents() > 0) {
133+
logger.info(
134+
"Successfully waited for pipe {} to finish.", entry.getValue().getPipeName());
135+
break;
136+
}
131137
if (System.currentTimeMillis() - startTime
132138
> PipeConfig.getInstance().getPipeMaxWaitFinishTime()) {
139+
timeout = true;
133140
break;
134141
}
135142
try {
@@ -139,6 +146,10 @@ public void run() {
139146
logger.info("Interrupted when waiting for pipe to finish");
140147
}
141148
}
149+
if (timeout) {
150+
logger.info("Timed out when waiting for pipes to finish, will break");
151+
break;
152+
}
142153
}
143154
}
144155
// Persist progress index before shutdown to accurate recovery after restart

0 commit comments

Comments
 (0)