You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by N Keywal <nk...@gmail.com> on 2012/01/30 10:04:46 UTC

getting the server version from a java client

Hello,

What's the recommended way for a client to get the version of the server
it's connected to?

I would like to write a (java) client that uses the "multi" function
available since 3.4.x, with a fall-back implementation if the server is a
3.3. Or at the very least to check that the server is a 3.4+ before using
"multi".

I looked at the java client API but I didn't find a way to get this info.

When the client uses "multi" when connected to a 3.3 server, it hangs (I
was hoping for something like KeeperException.UnimplementedException, but
it's not the case).

Thanks in advance for your help,

N.

Re: getting the server version from a java client

Posted by N Keywal <nk...@gmail.com>.
Let's start with the JIRA ;-)
It's ZOOKEEPER-1381

On Mon, Jan 30, 2012 at 10:03 PM, Mahadev Konar <ma...@hortonworks.com>wrote:

> Yes please. Prefer a patch with it :) but again thats not necessary!
>
>
> On Mon, Jan 30, 2012 at 12:36 PM, N Keywal <nk...@gmail.com> wrote:
> > Hi,
> >
> > Thanks for your answers. The workaround is quite smart (thanks again!),
> but
> > on the long term, I would definitively prefer a simple API call. It would
> > be less environment dependent as well.
> >
> > Do you want me to create a JIRA for it?
> >
> > Cheers,
> >
> > N.
> >
> > On Mon, Jan 30, 2012 at 7:12 PM, Patrick Hunt <ph...@apache.org> wrote:
> >
> >> +1, that would be a good api addition.
> >>
> >> On Mon, Jan 30, 2012 at 10:10 AM, Mahadev Konar <
> mahadev@hortonworks.com>
> >> wrote:
> >> > Keywal,
> >> >  Right now there isnt anyway for the client to tell which version of
> >> > server its talking to. You can probably hack something around the stat
> >> > command:
> >> >
> >> > echo stat | nc hostname clientport to get the version, but other than
> >> > that we dont have such an api. I think its probably worth having such
> >> > an api implemented.
> >> >
> >> > Here is the output of stat on my laptop:
> >> >
> >> > -----------------------
> >> > Zookeeper version: 3.4.2--1, built on 01/30/2012 17:43 GMT
> >> > Clients:
> >> >  /127.0.0.1:54951[0](queued=0,recved=1,sent=0)
> >> >
> >> > Latency min/avg/max: 0/0/0
> >> > Received: 1
> >> > Sent: 0
> >> > Outstanding: 0
> >> > Zxid: 0x500000001
> >> > Mode: follower
> >> > Node count: 7
> >> > --------------------
> >> >
> >> > thanks
> >> > mahadev
> >> >
> >> > On Mon, Jan 30, 2012 at 1:04 AM, N Keywal <nk...@gmail.com> wrote:
> >> >> Hello,
> >> >>
> >> >> What's the recommended way for a client to get the version of the
> server
> >> >> it's connected to?
> >> >>
> >> >> I would like to write a (java) client that uses the "multi" function
> >> >> available since 3.4.x, with a fall-back implementation if the server
> is
> >> a
> >> >> 3.3. Or at the very least to check that the server is a 3.4+ before
> >> using
> >> >> "multi".
> >> >>
> >> >> I looked at the java client API but I didn't find a way to get this
> >> info.
> >> >>
> >> >> When the client uses "multi" when connected to a 3.3 server, it
> hangs (I
> >> >> was hoping for something like KeeperException.UnimplementedException,
> >> but
> >> >> it's not the case).
> >> >>
> >> >> Thanks in advance for your help,
> >> >>
> >> >> N.
> >> >
> >> >
> >> >
> >> > --
> >> > Mahadev Konar
> >> > Hortonworks Inc.
> >> > http://hortonworks.com/
> >>
>
>
>
> --
> Mahadev Konar
> Hortonworks Inc.
> http://hortonworks.com/
>

Re: getting the server version from a java client

Posted by Mahadev Konar <ma...@hortonworks.com>.
Yes please. Prefer a patch with it :) but again thats not necessary!


On Mon, Jan 30, 2012 at 12:36 PM, N Keywal <nk...@gmail.com> wrote:
> Hi,
>
> Thanks for your answers. The workaround is quite smart (thanks again!), but
> on the long term, I would definitively prefer a simple API call. It would
> be less environment dependent as well.
>
> Do you want me to create a JIRA for it?
>
> Cheers,
>
> N.
>
> On Mon, Jan 30, 2012 at 7:12 PM, Patrick Hunt <ph...@apache.org> wrote:
>
>> +1, that would be a good api addition.
>>
>> On Mon, Jan 30, 2012 at 10:10 AM, Mahadev Konar <ma...@hortonworks.com>
>> wrote:
>> > Keywal,
>> >  Right now there isnt anyway for the client to tell which version of
>> > server its talking to. You can probably hack something around the stat
>> > command:
>> >
>> > echo stat | nc hostname clientport to get the version, but other than
>> > that we dont have such an api. I think its probably worth having such
>> > an api implemented.
>> >
>> > Here is the output of stat on my laptop:
>> >
>> > -----------------------
>> > Zookeeper version: 3.4.2--1, built on 01/30/2012 17:43 GMT
>> > Clients:
>> >  /127.0.0.1:54951[0](queued=0,recved=1,sent=0)
>> >
>> > Latency min/avg/max: 0/0/0
>> > Received: 1
>> > Sent: 0
>> > Outstanding: 0
>> > Zxid: 0x500000001
>> > Mode: follower
>> > Node count: 7
>> > --------------------
>> >
>> > thanks
>> > mahadev
>> >
>> > On Mon, Jan 30, 2012 at 1:04 AM, N Keywal <nk...@gmail.com> wrote:
>> >> Hello,
>> >>
>> >> What's the recommended way for a client to get the version of the server
>> >> it's connected to?
>> >>
>> >> I would like to write a (java) client that uses the "multi" function
>> >> available since 3.4.x, with a fall-back implementation if the server is
>> a
>> >> 3.3. Or at the very least to check that the server is a 3.4+ before
>> using
>> >> "multi".
>> >>
>> >> I looked at the java client API but I didn't find a way to get this
>> info.
>> >>
>> >> When the client uses "multi" when connected to a 3.3 server, it hangs (I
>> >> was hoping for something like KeeperException.UnimplementedException,
>> but
>> >> it's not the case).
>> >>
>> >> Thanks in advance for your help,
>> >>
>> >> N.
>> >
>> >
>> >
>> > --
>> > Mahadev Konar
>> > Hortonworks Inc.
>> > http://hortonworks.com/
>>



-- 
Mahadev Konar
Hortonworks Inc.
http://hortonworks.com/

Re: getting the server version from a java client

Posted by N Keywal <nk...@gmail.com>.
Hi,

Thanks for your answers. The workaround is quite smart (thanks again!), but
on the long term, I would definitively prefer a simple API call. It would
be less environment dependent as well.

Do you want me to create a JIRA for it?

Cheers,

N.

On Mon, Jan 30, 2012 at 7:12 PM, Patrick Hunt <ph...@apache.org> wrote:

> +1, that would be a good api addition.
>
> On Mon, Jan 30, 2012 at 10:10 AM, Mahadev Konar <ma...@hortonworks.com>
> wrote:
> > Keywal,
> >  Right now there isnt anyway for the client to tell which version of
> > server its talking to. You can probably hack something around the stat
> > command:
> >
> > echo stat | nc hostname clientport to get the version, but other than
> > that we dont have such an api. I think its probably worth having such
> > an api implemented.
> >
> > Here is the output of stat on my laptop:
> >
> > -----------------------
> > Zookeeper version: 3.4.2--1, built on 01/30/2012 17:43 GMT
> > Clients:
> >  /127.0.0.1:54951[0](queued=0,recved=1,sent=0)
> >
> > Latency min/avg/max: 0/0/0
> > Received: 1
> > Sent: 0
> > Outstanding: 0
> > Zxid: 0x500000001
> > Mode: follower
> > Node count: 7
> > --------------------
> >
> > thanks
> > mahadev
> >
> > On Mon, Jan 30, 2012 at 1:04 AM, N Keywal <nk...@gmail.com> wrote:
> >> Hello,
> >>
> >> What's the recommended way for a client to get the version of the server
> >> it's connected to?
> >>
> >> I would like to write a (java) client that uses the "multi" function
> >> available since 3.4.x, with a fall-back implementation if the server is
> a
> >> 3.3. Or at the very least to check that the server is a 3.4+ before
> using
> >> "multi".
> >>
> >> I looked at the java client API but I didn't find a way to get this
> info.
> >>
> >> When the client uses "multi" when connected to a 3.3 server, it hangs (I
> >> was hoping for something like KeeperException.UnimplementedException,
> but
> >> it's not the case).
> >>
> >> Thanks in advance for your help,
> >>
> >> N.
> >
> >
> >
> > --
> > Mahadev Konar
> > Hortonworks Inc.
> > http://hortonworks.com/
>

Re: getting the server version from a java client

Posted by Patrick Hunt <ph...@apache.org>.
+1, that would be a good api addition.

On Mon, Jan 30, 2012 at 10:10 AM, Mahadev Konar <ma...@hortonworks.com> wrote:
> Keywal,
>  Right now there isnt anyway for the client to tell which version of
> server its talking to. You can probably hack something around the stat
> command:
>
> echo stat | nc hostname clientport to get the version, but other than
> that we dont have such an api. I think its probably worth having such
> an api implemented.
>
> Here is the output of stat on my laptop:
>
> -----------------------
> Zookeeper version: 3.4.2--1, built on 01/30/2012 17:43 GMT
> Clients:
>  /127.0.0.1:54951[0](queued=0,recved=1,sent=0)
>
> Latency min/avg/max: 0/0/0
> Received: 1
> Sent: 0
> Outstanding: 0
> Zxid: 0x500000001
> Mode: follower
> Node count: 7
> --------------------
>
> thanks
> mahadev
>
> On Mon, Jan 30, 2012 at 1:04 AM, N Keywal <nk...@gmail.com> wrote:
>> Hello,
>>
>> What's the recommended way for a client to get the version of the server
>> it's connected to?
>>
>> I would like to write a (java) client that uses the "multi" function
>> available since 3.4.x, with a fall-back implementation if the server is a
>> 3.3. Or at the very least to check that the server is a 3.4+ before using
>> "multi".
>>
>> I looked at the java client API but I didn't find a way to get this info.
>>
>> When the client uses "multi" when connected to a 3.3 server, it hangs (I
>> was hoping for something like KeeperException.UnimplementedException, but
>> it's not the case).
>>
>> Thanks in advance for your help,
>>
>> N.
>
>
>
> --
> Mahadev Konar
> Hortonworks Inc.
> http://hortonworks.com/

Re: getting the server version from a java client

Posted by Mahadev Konar <ma...@hortonworks.com>.
Keywal,
 Right now there isnt anyway for the client to tell which version of
server its talking to. You can probably hack something around the stat
command:

echo stat | nc hostname clientport to get the version, but other than
that we dont have such an api. I think its probably worth having such
an api implemented.

Here is the output of stat on my laptop:

-----------------------
Zookeeper version: 3.4.2--1, built on 01/30/2012 17:43 GMT
Clients:
 /127.0.0.1:54951[0](queued=0,recved=1,sent=0)

Latency min/avg/max: 0/0/0
Received: 1
Sent: 0
Outstanding: 0
Zxid: 0x500000001
Mode: follower
Node count: 7
--------------------

thanks
mahadev

On Mon, Jan 30, 2012 at 1:04 AM, N Keywal <nk...@gmail.com> wrote:
> Hello,
>
> What's the recommended way for a client to get the version of the server
> it's connected to?
>
> I would like to write a (java) client that uses the "multi" function
> available since 3.4.x, with a fall-back implementation if the server is a
> 3.3. Or at the very least to check that the server is a 3.4+ before using
> "multi".
>
> I looked at the java client API but I didn't find a way to get this info.
>
> When the client uses "multi" when connected to a 3.3 server, it hangs (I
> was hoping for something like KeeperException.UnimplementedException, but
> it's not the case).
>
> Thanks in advance for your help,
>
> N.



-- 
Mahadev Konar
Hortonworks Inc.
http://hortonworks.com/