Copilot commented on code in PR #62062:
URL: https://github.com/apache/doris/pull/62062#discussion_r3028455437


##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -255,6 +255,14 @@ private void flushEditLog() {
                 }
             }
         } catch (Throwable t) {
+            // Notify all pending items so producer threads don't hang if 
System.exit is delayed
+            for (EditLogItem req : batch) {
+                synchronized (req.lock) {
+                    req.finished = true;
+                    req.logId = -1;

Review Comment:
   Using a raw sentinel value (`-1`) for `logId` makes the failure semantics 
implicit and easy to mis-handle elsewhere. Prefer a named constant (e.g., 
`INVALID_LOG_ID`) or an explicit failure field/result so callers have a clear, 
self-documenting way to detect this fatal failure path.



##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -255,6 +255,14 @@ private void flushEditLog() {
                 }
             }
         } catch (Throwable t) {
+            // Notify all pending items so producer threads don't hang if 
System.exit is delayed
+            for (EditLogItem req : batch) {
+                synchronized (req.lock) {
+                    req.finished = true;
+                    req.logId = -1;
+                    req.lock.notifyAll();
+                }
+            }

Review Comment:
   This only notifies items present in `batch`. If there are pending 
`EditLogItem`s still enqueued (not yet moved into `batch`) when the `Throwable` 
occurs, their producer threads can still remain blocked indefinitely until the 
process actually exits. To fully match the stated goal of notifying *all 
pending* requests, consider also draining/notifying any remaining queued 
requests (under the same queue/monitor used by `logEditWithQueue()`/flush) 
before calling `System.exit`, or centralize this into a helper that marks and 
notifies both the current batch and any outstanding queue entries.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to