swuferhong commented on code in PR #1159:
URL: https://github.com/apache/fluss/pull/1159#discussion_r2357652686


##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/statemachine/TableBucketStateMachine.java:
##########
@@ -564,29 +578,49 @@ private String stringifyBucket(TableBucket tableBucket) {
     }
 
     /**
-     * Elect a new leader for new or offline bucket, it'll always elect one 
from the live replicas
-     * in isr set.
+     * Elect a new leader for bucket, it'll always elect one from the live 
replicas in isr set.
+     *
+     * <p>The elect cases including:
+     *
+     * <ol>
+     *   <li>new or offline bucket
+     *   <li>tabletServer controlled shutdown
+     * </ol>
      */
-    private Optional<ElectionResult> leaderForOffline(
-            TableBucket tableBucket, LeaderAndIsr leaderAndIsr) {
+    private Optional<ElectionResult> electLeader(
+            TableBucket tableBucket,
+            LeaderAndIsr leaderAndIsr,
+            ReplicaLeaderElectionStrategy electionStrategy) {
         List<Integer> assignment = 
coordinatorContext.getAssignment(tableBucket);
         // filter out the live servers
         List<Integer> liveReplicas =
                 assignment.stream()
                         .filter(
                                 replica ->
-                                        
coordinatorContext.isReplicaAndServerOnline(
-                                                replica, tableBucket))
+                                        coordinatorContext.isReplicaOnline(
+                                                replica,
+                                                tableBucket,
+                                                electionStrategy == 
CONTROLLED_SHUTDOWN_ELECTION))

Review Comment:
   I have removed this check as `controlledShutdownReplicaLeaderElection` will 
ignore shutdown servers when elect leader.



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

Reply via email to