Copilot commented on code in PR #15605:
URL: https://github.com/apache/iotdb/pull/15605#discussion_r2113142310
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/subtask/connector/PipeConnectorSubtask.java:
##########
@@ -234,6 +234,10 @@ public void discardEventsOfPipe(final String
pipeNameToDrop, int regionId) {
highPriorityLockTaskCount.incrementAndGet();
try {
+ synchronized (highPriorityLockTaskCount) {
+ highPriorityLockTaskCount.notify();
Review Comment:
Consider using notifyAll() instead of notify() if multiple threads might be
waiting, to ensure that all relevant waiting threads are awakened.
```suggestion
highPriorityLockTaskCount.notifyAll();
```
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/subtask/PipeAbstractConnectorSubtask.java:
##########
@@ -175,7 +175,14 @@ private boolean onPipeConnectionException(final Throwable
throwable) {
MAX_RETRY_TIMES,
e);
try {
- Thread.sleep(retry *
PipeConfig.getInstance().getPipeConnectorRetryIntervalMs());
+ synchronized (highPriorityLockTaskCount) {
+ // The wait operation will release the highPriorityLockTaskCount
lock, so there will be
+ // no deadlock.
+ if (highPriorityLockTaskCount.get() == 0) {
Review Comment:
Consider using a while loop instead of an if statement when waiting on
highPriorityLockTaskCount to properly handle spurious wake-ups and ensure the
condition remains valid.
```suggestion
while (highPriorityLockTaskCount.get() == 0) {
```
--
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]