You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Michi Mutsuzaki <mi...@cs.stanford.edu> on 2012/06/10 09:15:04 UTC

predefined xids in c client

Hi,

There are some predefined XIDs (like #define PING_XID -2) in
zk_adaptor.h. Why do we need them? How do they avoid colliding with
regular XIDs?

Thanks!
--Michi

Re: predefined xids in c client

Posted by Patrick Hunt <ph...@apache.org>.
On Tue, Jun 12, 2012 at 12:51 AM, Michi Mutsuzaki <mi...@cs.stanford.edu> wrote:
> Hi Pat,
>
> How does the C client ensure that the regular xids are non-negative?
> The get_xid() function in st_adaptor.c doesn't seem to handle
> overflow. I guess I'm missing something obvious...
>
> http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/st_adaptor.c?revision=1038827&view=markup

Sorry, you're right! If a session (I checked, the problem exists in
both the c and java clients) sends more then 2 billion operations the
xid will rollover. Correct. Please enter a jira for that, we should
expire the session when that happens (really in 4.0 we should change
to a long rather than an int for many of these "counters", e.g.
version)

Thanks!

Patrick

>
> On Mon, Jun 11, 2012 at 11:01 PM, Patrick Hunt <ph...@apache.org> wrote:
>> Regular xids are always non-negative.
>>
>> Patrick
>>
>> On Sun, Jun 10, 2012 at 12:15 AM, Michi Mutsuzaki <mi...@cs.stanford.edu> wrote:
>>> Hi,
>>>
>>> There are some predefined XIDs (like #define PING_XID -2) in
>>> zk_adaptor.h. Why do we need them? How do they avoid colliding with
>>> regular XIDs?
>>>
>>> Thanks!
>>> --Michi

Re: predefined xids in c client

Posted by Michi Mutsuzaki <mi...@cs.stanford.edu>.
Hi Pat,

How does the C client ensure that the regular xids are non-negative?
The get_xid() function in st_adaptor.c doesn't seem to handle
overflow. I guess I'm missing something obvious...

http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/st_adaptor.c?revision=1038827&view=markup

Thanks!
--Michi

On Mon, Jun 11, 2012 at 11:01 PM, Patrick Hunt <ph...@apache.org> wrote:
> Regular xids are always non-negative.
>
> Patrick
>
> On Sun, Jun 10, 2012 at 12:15 AM, Michi Mutsuzaki <mi...@cs.stanford.edu> wrote:
>> Hi,
>>
>> There are some predefined XIDs (like #define PING_XID -2) in
>> zk_adaptor.h. Why do we need them? How do they avoid colliding with
>> regular XIDs?
>>
>> Thanks!
>> --Michi

Re: predefined xids in c client

Posted by Patrick Hunt <ph...@apache.org>.
Regular xids are always non-negative.

Patrick

On Sun, Jun 10, 2012 at 12:15 AM, Michi Mutsuzaki <mi...@cs.stanford.edu> wrote:
> Hi,
>
> There are some predefined XIDs (like #define PING_XID -2) in
> zk_adaptor.h. Why do we need them? How do they avoid colliding with
> regular XIDs?
>
> Thanks!
> --Michi