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

Shalin Shekhar Mangar commented on SOLR-9440:
---------------------------------------------

{quote}
I'm wondering if we need some synchronization here, with 
registerCollectionStateWatcher and also to make sure the 
watchedCollectionStates.remove and lazyCollectionStates.put is done atomically
{quote}

Hmm good point. I don't think we need synchronization here but we need to 
ensure that the result, once visible, is consistent. So this is a trick that 
the ZkStateReader uses -- It adds all collections to the lazyCollectionStates 
map and never removes them unless the collection is deleted. But it gives 
priority to watchedCollectionStates over the lazy ones. This ensures that 
during constructState, the collection is always available in the cluster state 
even if it is removed from the watchedCollectionStates. Actually the 
lazyCollectionStates.put is not necessary but it is there just for safety.

bq. Is this only for testing purposes?

Oops, yes, thanks for catching. I'll revert it.

> ZkStateReader on a client can cache collection state and never refresh it
> -------------------------------------------------------------------------
>
>                 Key: SOLR-9440
>                 URL: https://issues.apache.org/jira/browse/SOLR-9440
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrCloud
>            Reporter: Shalin Shekhar Mangar
>            Assignee: Shalin Shekhar Mangar
>            Priority: Major
>             Fix For: 6.7, 7.0, master (8.0)
>
>         Attachments: SOLR-9440.patch, SOLR-9440.patch
>
>
> I saw this while writing a test case for SOLR-9438. The collection1 
> collection which was in stateFormat=2 was somehow caching the 
> CloudSolrClient's ZkStateReader such that the returned cluster state 
> contained the collection state. However this collection was neither watched 
> nor lazy so any call to waitForRecoveriesToFinish would see stale state and 
> loop until timeout.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to