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

Sijie Guo commented on BOOKKEEPER-713:
--------------------------------------

-1 on the patch. I don't think this is an issue. we should only write to 
zookeeper after initializing cookies in all local directories. since if we 
failed on writing cookie to zookeeper, we know the bookie failed before 
initialize, then it is safe to reformat local bookie. but if you reverse the 
order, it might cause cookie exists on zookeeper but missing in some local 
directories. in this case, it is hard to tell whether this bookie is failed on 
first initialization or failed due to losing a disk.

> Bookie should store the cookie in zookeeper first
> -------------------------------------------------
>
>                 Key: BOOKKEEPER-713
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-713
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: bookkeeper-server
>    Affects Versions: 4.2.2
>            Reporter: Vinay
>            Assignee: Vinay
>         Attachments: BOOKKEEPER-713.patch
>
>
> following code in {{Bookie#checkEnvironment(..)}} should store the cookie in 
> zookeeper and then to local disks for {{newEnv}}
> {code}            if (newEnv) {
>                 if (missedCookieDirs.size() > 0) {
>                     LOG.debug("Directories missing cookie file are {}", 
> missedCookieDirs);
>                     masterCookie.writeToDirectory(journalDirectory);
>                     for (File dir : allLedgerDirs) {
>                         masterCookie.writeToDirectory(dir);
>                     }
>                 }
>                 masterCookie.writeToZooKeeper(zk, conf);
>             }{code}
> Otherwise if the {{masterCookie.writeToZooKeeper(zk, conf);}} fails due to 
> some exception, then bookie cannot start again.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to