This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 9785ea3  fix a flaky test case due to race condition with zk event 
(#8136)
9785ea3 is described below

commit 9785ea3d6d30b20541e9ba3001e85ac483aa429b
Author: Xiaobing <[email protected]>
AuthorDate: Fri Feb 4 17:33:38 2022 -0800

    fix a flaky test case due to race condition with zk event (#8136)
---
 .../pinot/controller/helix/core/minion/PinotTaskManager.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java
index faa3f49..c805e98 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 import org.I0Itec.zkclient.IZkChildListener;
 import org.apache.commons.collections.CollectionUtils;
@@ -137,11 +136,12 @@ public class PinotTaskManager extends 
ControllerPeriodicTask<Void> {
     }
   }
 
-  private void checkTableConfigChanges(List<String> allTableNamesWithType) {
+  private void checkTableConfigChanges(List<String> tableNamesWithType) {
     LOGGER.info("Checking task config changes in table configs");
-    // Just check on tables the current controller is leader for, and skip the 
rest.
-    List<String> tableNamesWithType =
-        
allTableNamesWithType.stream().filter(_leadControllerManager::isLeaderForTable).collect(Collectors.toList());
+    // NOTE: we avoided calling _leadControllerManager::isLeaderForTable here 
to skip tables the current
+    // controller is not leader for. Because _leadControllerManager updates 
its leadership states based
+    // on a ZK event, and that ZK event may come later than this method call, 
making current controller
+    // think it's not lead for certain tables, when it should be if the 
leadership states are fully updated.
     if (_tableTaskSchedulerUpdaterMap.isEmpty()) {
       // Initial setup
       for (String tableNameWithType : tableNamesWithType) {

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

Reply via email to