zcoo commented on code in PR #1081:
URL: https://github.com/apache/fluss/pull/1081#discussion_r2297013686


##########
fluss-server/src/main/java/com/alibaba/fluss/server/coordinator/statemachine/ReplicaStateMachine.java:
##########
@@ -438,25 +439,21 @@ private Map<TableBucketReplica, LeaderAndIsr> 
doRemoveReplicaFromIsr(
             List<Integer> newIsr =
                     leaderAndIsr.isr().size() == 1
                             // don't remove the replica id from isr when isr 
size is 1,
-                            // if isr is empty, we can't elect leader any more
+                            // if isr is empty, we can't elect leader anymore
                             ? leaderAndIsr.isr()
                             : leaderAndIsr.isr().stream()
                                     .filter(id -> id != replicaId)
                                     .collect(Collectors.toList());
             LeaderAndIsr adjustLeaderAndIsr = 
leaderAndIsr.newLeaderAndIsr(newLeader, newIsr);
-            try {
-                zooKeeperClient.updateLeaderAndIsr(tableBucket, 
adjustLeaderAndIsr);
-            } catch (Exception e) {
-                LOG.error(
-                        "Fail to update bucket LeaderAndIsr for table bucket 
{} of table {}.",
-                        tableBucket,
-                        
coordinatorContext.getTablePathById(tableBucket.getTableId()),
-                        e);
-                continue;
-            }
-            // update leader and isr
-            coordinatorContext.putBucketLeaderAndIsr(tableBucket, 
adjustLeaderAndIsr);
             adjustedLeaderAndIsr.put(tableBucketReplica, adjustLeaderAndIsr);
+            toUpdateLeaderAndIsrList.put(tableBucket, adjustLeaderAndIsr);
+        }
+        try {
+            zooKeeperClient.batchUpdateLeaderAndIsr(toUpdateLeaderAndIsrList);
+            
toUpdateLeaderAndIsrList.forEach(coordinatorContext::putBucketLeaderAndIsr);

Review Comment:
   yes I think I miss this scene. Now it is resolved



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