You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2015/03/24 17:26:35 UTC

CloudSolrClient.connect() fails if there's no /live_nodes node in ZK

Hi

If I init a CloudSolrClient on a fresh new cluster, no Solr nodes up yet,
and I call .connect(), I get an error that ZkStateReader can't read
/live_nodes (as this node doesn't yet exist).

I do this from a unit test, and I know I don't need to call .connect()
(it's documented as optional), but wanted to ask -- is it wrong for
ZkStateReader.createClusterStateWatchersAndUpdate() to ensure /live_nodes
exists before it calls getChildren() and registers a watcher on it?

The reason why I call .connect() is because I want to get a hold of the
ZkStateReader and use it in the unit test, to query the cluster state.
Perhaps I shouldn't?

Shai

Re: CloudSolrClient.connect() fails if there's no /live_nodes node in ZK

Posted by Shai Erera <se...@gmail.com>.
Thanks Shalin. Indeed, I looked at the Solr 5.0 source code and saw that
there are some nodes created, so I thought it would make sense to create
/live_nodes too.

But I see that the client no longer creates any node, and also that
ZkController offers a createClusterZkNodes() which will certainly help in
unit tests.

I'll wait for 5.1 with that. Thanks!

Shai

On Tue, Mar 24, 2015 at 6:32 PM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> Yeah, see SOLR-4044 for more details. In that issue the client code was
> modified to throw a more useful exception if the cluster is not ready and
> it can also take an optional timeout parameter to wait for essential zk
> nodes to be created by the cluster.
>
> One suggestion was to have the client create those nodes automatically but
> the general consensus was that clients should be read-only w.r.t. ZooKeeper.
>
> On Tue, Mar 24, 2015 at 9:26 AM, Shai Erera <se...@gmail.com> wrote:
>
>> Hi
>>
>> If I init a CloudSolrClient on a fresh new cluster, no Solr nodes up yet,
>> and I call .connect(), I get an error that ZkStateReader can't read
>> /live_nodes (as this node doesn't yet exist).
>>
>> I do this from a unit test, and I know I don't need to call .connect()
>> (it's documented as optional), but wanted to ask -- is it wrong for
>> ZkStateReader.createClusterStateWatchersAndUpdate() to ensure /live_nodes
>> exists before it calls getChildren() and registers a watcher on it?
>>
>> The reason why I call .connect() is because I want to get a hold of the
>> ZkStateReader and use it in the unit test, to query the cluster state.
>> Perhaps I shouldn't?
>>
>> Shai
>>
>>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: CloudSolrClient.connect() fails if there's no /live_nodes node in ZK

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Yeah, see SOLR-4044 for more details. In that issue the client code was
modified to throw a more useful exception if the cluster is not ready and
it can also take an optional timeout parameter to wait for essential zk
nodes to be created by the cluster.

One suggestion was to have the client create those nodes automatically but
the general consensus was that clients should be read-only w.r.t. ZooKeeper.

On Tue, Mar 24, 2015 at 9:26 AM, Shai Erera <se...@gmail.com> wrote:

> Hi
>
> If I init a CloudSolrClient on a fresh new cluster, no Solr nodes up yet,
> and I call .connect(), I get an error that ZkStateReader can't read
> /live_nodes (as this node doesn't yet exist).
>
> I do this from a unit test, and I know I don't need to call .connect()
> (it's documented as optional), but wanted to ask -- is it wrong for
> ZkStateReader.createClusterStateWatchersAndUpdate() to ensure /live_nodes
> exists before it calls getChildren() and registers a watcher on it?
>
> The reason why I call .connect() is because I want to get a hold of the
> ZkStateReader and use it in the unit test, to query the cluster state.
> Perhaps I shouldn't?
>
> Shai
>
>


-- 
Regards,
Shalin Shekhar Mangar.