[ 
https://issues.apache.org/jira/browse/SOLR-9264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15356595#comment-15356595
 ] 

Hrishikesh Gadre commented on SOLR-9264:
----------------------------------------

[~ shalinmangar] Thanks for the updated patch. 

It seems to me that the logic based on AtomicBoolean is probably not sufficient 
if the callback is invoked multiple times *sequentially* for the same 
collection since this variable is in the local scope. Is it a possibility? I 
think instead of AtomicBoolean we should use a concurrent hashmap (outside the 
scope of the lambda expression). This map should be pre-populated with the 
collection names before registering the callback. We can even reuse the 
collectionsWithLocalReplica variable for this purpose (i.e. instead of Set, we 
will use ConcurrentHashMap type).

Inside the callback we can use the remove method in a similar fashion to 
compareAndSet.

i.e. instead of  counted.compareAndSet(false, true)
do  collectionsWithLocalReplica.remove(collectionName) != null

What do you think?


> Optimize ZkController.publishAndWaitForDownStates
> -------------------------------------------------
>
>                 Key: SOLR-9264
>                 URL: https://issues.apache.org/jira/browse/SOLR-9264
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrCloud
>            Reporter: Shalin Shekhar Mangar
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 6.2, master (7.0)
>
>         Attachments: SOLR-9264.patch, SOLR-9264.patch
>
>
> ZkController.publishAndWaitForDownStates keeps looping over all collections 
> in the cluster state to ensure that every replica hosted on the current node 
> has been marked as down. This is wasteful when you have a large number of 
> collections because each access to a non-watched collection gets data from 
> ZK. Instead, we can watch the interesting collections (i.e. which have 
> replicas hosted locally) and wait till we see the required state.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to