You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Takashi Ohnishi <on...@lab.ntt.co.jp> on 2013/10/03 12:16:30 UTC

Implicit restriction of snapCount

Hello.

When I did testing ZooKeeper 3.4.5, I found an implicit and slight
restriction of snapCount.

If snapCount is set to 1, ZooKeeper Server can start but it fails with the
below error:

2013-10-02 18:09:07,600 [myid:1] - ERROR
[SyncThread:1:SyncRequestProcessor@151] - Severe unrecoverable error,
exiting
java.lang.IllegalArgumentException: n must be positive
        at java.util.Random.nextInt(Random.java:300)
        at
org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.ja
va:93)

In source code,  it maybe be supposed that snapCount must be 2 or more:
     91             // we do this in an attempt to ensure that not all of
the servers
     92             // in the ensemble take a snapshot at the same time
     93             int randRoll = r.nextInt(snapCount/2);

I think this supposition is not bad because snapCount = 1 is not realistic
setting...
But, it may be better to mention this restriction in documentation or add a
validation in the source code.
How about?

Regards,

++++++++++++
Takashi Ohnishi



RE: Implicit restriction of snapCount

Posted by Takashi Ohnishi <on...@lab.ntt.co.jp>.
Hello, Patrick.

Thanks for your reply!

I created a jira chicket.
https://issues.apache.org/jira/browse/ZOOKEEPER-1781

And I will try to make a patch.

Regards,

++++++++++++
Takashi Ohnishi 

> -----Original Message-----
> From: Patrick Hunt [mailto:phunt@apache.org]
> Sent: Friday, October 04, 2013 1:11 AM
> To: UserZooKeeper
> Subject: Re: Implicit restriction of snapCount
> 
> Sounds reasonable. Please enter a jira where we can discuss the issue and
> how to resolve. It would also be great if you are interested to provide
> a patch!
> https://issues.apache.org/jira/browse/ZOOKEEPER
> 
> Thanks!
> 
> Patrick
> 
> On Thu, Oct 3, 2013 at 3:16 AM, Takashi Ohnishi
> <on...@lab.ntt.co.jp> wrote:
> > Hello.
> >
> > When I did testing ZooKeeper 3.4.5, I found an implicit and slight
> > restriction of snapCount.
> >
> > If snapCount is set to 1, ZooKeeper Server can start but it fails with
> > the below error:
> >
> > 2013-10-02 18:09:07,600 [myid:1] - ERROR
> > [SyncThread:1:SyncRequestProcessor@151] - Severe unrecoverable error,
> > exiting
> > java.lang.IllegalArgumentException: n must be positive
> >         at java.util.Random.nextInt(Random.java:300)
> >         at
> >
> org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProces
> > sor.ja
> > va:93)
> >
> > In source code,  it maybe be supposed that snapCount must be 2 or more:
> >      91             // we do this in an attempt to ensure that not all
> of
> > the servers
> >      92             // in the ensemble take a snapshot at the same time
> >      93             int randRoll = r.nextInt(snapCount/2);
> >
> > I think this supposition is not bad because snapCount = 1 is not
> > realistic setting...
> > But, it may be better to mention this restriction in documentation or
> > add a validation in the source code.
> > How about?
> >
> > Regards,
> >
> > ++++++++++++
> > Takashi Ohnishi
> >
> >


Re: Implicit restriction of snapCount

Posted by Patrick Hunt <ph...@apache.org>.
Sounds reasonable. Please enter a jira where we can discuss the issue
and how to resolve. It would also be great if you are interested to
provide a patch!
https://issues.apache.org/jira/browse/ZOOKEEPER

Thanks!

Patrick

On Thu, Oct 3, 2013 at 3:16 AM, Takashi Ohnishi
<on...@lab.ntt.co.jp> wrote:
> Hello.
>
> When I did testing ZooKeeper 3.4.5, I found an implicit and slight
> restriction of snapCount.
>
> If snapCount is set to 1, ZooKeeper Server can start but it fails with the
> below error:
>
> 2013-10-02 18:09:07,600 [myid:1] - ERROR
> [SyncThread:1:SyncRequestProcessor@151] - Severe unrecoverable error,
> exiting
> java.lang.IllegalArgumentException: n must be positive
>         at java.util.Random.nextInt(Random.java:300)
>         at
> org.apache.zookeeper.server.SyncRequestProcessor.run(SyncRequestProcessor.ja
> va:93)
>
> In source code,  it maybe be supposed that snapCount must be 2 or more:
>      91             // we do this in an attempt to ensure that not all of
> the servers
>      92             // in the ensemble take a snapshot at the same time
>      93             int randRoll = r.nextInt(snapCount/2);
>
> I think this supposition is not bad because snapCount = 1 is not realistic
> setting...
> But, it may be better to mention this restriction in documentation or add a
> validation in the source code.
> How about?
>
> Regards,
>
> ++++++++++++
> Takashi Ohnishi
>
>