kfaraz commented on code in PR #14845:
URL: https://github.com/apache/druid/pull/14845#discussion_r1301340260


##########
server/src/main/java/org/apache/druid/server/coordinator/loading/LoadQueueTaskMaster.java:
##########
@@ -45,6 +53,8 @@ public class LoadQueueTaskMaster
   private final ZkPathsConfig zkPaths;
   private final boolean httpLoading;
 
+  private final ConcurrentHashMap<String, LoadQueuePeon> loadManagementPeons = 
new ConcurrentHashMap<>();

Review Comment:
   If leadership changes just when the `PrepareBalancerAndLoadQueues` has 
started, it is possible that some peons might be left over and not removed from 
`taskMaster` due to a race between `startPeonsForNewServers` and 
`stopAndRemoveAllPeons`. All such dangling peons would keep checking if there 
is any segment to load once every minute. There is a single thread that is 
shared by all the peons, so it doesn't really hog resources either.
   
   Just to clarify, this case exists even today and doesn't really cause any 
trouble. But yes, it would be cleaner to not have this at all. We can guard 
these methods with a lock and track the leadership status inside 
`LoadQueueTaskMaster` to avoid this altogether.



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