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


##########
fe/fe-core/src/main/java/org/apache/doris/ha/BDBHA.java:
##########
@@ -153,6 +153,9 @@ public List<InetSocketAddress> getElectableNodes(boolean 
leaderIncluded) {
     @Override
     public InetSocketAddress getLeader() {
         ReplicationGroupAdmin replicationGroupAdmin = 
environment.getReplicationGroupAdmin();
+        if (replicationGroupAdmin == null) {
+            return null;

Review Comment:
   `getLeader()` now returns null when `getReplicationGroupAdmin()` is null, 
but several call sites assume a non-null return and dereference it (e.g. 
`StatisticsUtil.isMaster()` calls `getLeader().equals(...)`). To avoid 
introducing new NPEs, either keep the previous “throw” behavior but with a 
clearer exception (so existing try/catch paths handle it), or update the 
contract/callers to null-check consistently before use.
   ```suggestion
               throw new IllegalStateException("ReplicationGroupAdmin is not 
initialized");
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -255,6 +253,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:
   In the error path you notify waiters by setting `finished=true` and 
`logId=-1`, but the caller side (e.g. `logEditWithQueue()` / 
`EditLogItem.await()`) will treat this as a normal completion and continue 
executing follow-up logic with an invalid logId until the JVM actually halts. 
Consider propagating a fatal signal instead (e.g., store the throwable on the 
request and have await/logEditWithQueue throw an Error when completion is due 
to failure), so callers don’t proceed with partially persisted state during 
shutdown hooks / delayed exit.
   ```suggestion
   
   ```



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