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

Flavio Junqueira edited comment on BOOKKEEPER-294 at 6/15/12 7:39 AM:
----------------------------------------------------------------------

I'm not convinced that we need a separate lock mechanism for directories. Why 
can't we use the zookeeper lock to imply that the directories are locked? In my 
view, the zookeeper lock implies that a bookie with a given identity is 
available and there is some process responsible for that identity. That 
includes the directories it is using. 

bq. A better sequence to start the bookie is first start bookie, start 
NIOServer and register bookie.

If my rationale is correct, I think we can achieve this, without a race, by 
making this simple change in BookieServer:

{code}
public void start() throws IOException {
        nioServerFactory = new NIOServerFactory(conf, this);

        this.bookie.start();

        nioServerFactory.start();
        running = true;
        deathWatcher = new DeathWatcher(conf);
        deathWatcher.start();

        // register jmx
        registerJMX();
    }
{code}

I simply swapped the first two statements. My rationale is: we create the 
socket and start/register the bookie. We may receive a request before starting 
the NIOServerFactory, but the socket is there already. 
                
      was (Author: fpj):
    I'm not convinced that we need a separate lock mechanism for directories. 
Why can't we use the zookeeper lock to imply that the directories are locked? 
In my view, the zookeeper lock implies that a bookie with a given identity is 
available and there is some process responsible for that identity. That 
includes the directories it is using. 

bq. A better sequence to start the bookie is first start bookie, start 
NIOServer and register bookie.

If my rationale is correct, I think we can achieve this, without a race, by 
making this simple change in BookieServer:

{code}
public void start() throws IOException {
        nioServerFactory = new NIOServerFactory(conf, this);

        this.bookie.start();

        nioServerFactory.start();
        running = true;
        deathWatcher = new DeathWatcher(conf);
        deathWatcher.start();

        // register jmx
        registerJMX();
    }
{code}

I simply swapped the first two statements. My rational is: we create the socket 
and start/register the bookie. We may receive a request before starting the 
NIOServerFactory, but the socket is there already. 
                  
> Not able to start the bookkeeper before the ZK session timeout.
> ---------------------------------------------------------------
>
>                 Key: BOOKKEEPER-294
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-294
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: bookkeeper-server
>    Affects Versions: 4.1.0
>            Reporter: Gopinathan A
>            Assignee: Rakesh R
>             Fix For: 4.2.0, 4.1.1
>
>         Attachments: BOOKKEEPER-294.1.patch, BOOKKEEPER-294.2.patch, 
> BOOKKEEPER-294.3.patch, BOOKKEEPER-294.4.patch, BOOKKEEPER-294.patch, 
> BOOKKEEPER-294.patch
>
>
> Not able to start the bookkeeper before the ZK session timeout.
> Here i killed the bookie and started again.
> {noformat}
> 2012-06-12 20:00:25,220 - INFO  [main:LedgerCache@65] - openFileLimit is 900, 
> pageSize is 8192, pageLimit is 456781
> 2012-06-12 20:00:25,238 - ERROR [main:Bookie@453] - ZK exception registering 
> ephemeral Znode for Bookie!
> org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = 
> NodeExists for /ledgers/available/10.18.40.216:3181
>       at org.apache.zookeeper.KeeperException.create(KeeperException.java:119)
>       at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
>       at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:778)
>       at org.apache.bookkeeper.bookie.Bookie.registerBookie(Bookie.java:450)
>       at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:348)
>       at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:64)
>       at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:249)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to