Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.0
    • Component/s: None
    • Labels:
      None

      Description

      A number of times when I start a bookie with a clean state, it fails to start and I get the following exceptions:

      2012-04-06 10:54:42,201 - ERROR [main:Bookie@348] - Error accessing cookie on disks
      java.io.FileNotFoundException: *path*/current/VERSION (No such file or directory)
              at java.io.FileOutputStream.open(Native Method)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
              at org.apache.bookkeeper.bookie.Cookie.writeToDirectory(Cookie.java:114)
              at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:337)
              at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:401)
              at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:75)
              at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:294)
      2012-04-06 10:54:42,203 - ERROR [main:BookieServer@308] - Exception running bookie server :
      org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: java.io.FileNotFoundException: *path*/current/VERSION (No such file or directory)
              at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:349)
              at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:401)
              at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:75)
              at org.apache.bookkeeper.proto.BookieServer.main(BookieServer.java:294)
      Caused by: java.io.FileNotFoundException: *path*/current/VERSION (No such file or directory)
              at java.io.FileOutputStream.open(Native Method)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
              at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
              at org.apache.bookkeeper.bookie.Cookie.writeToDirectory(Cookie.java:114)
              at org.apache.bookkeeper.bookie.Bookie.checkEnvironment(Bookie.java:337)
      
      
      1. BK-211.diff
        4 kB
        Sijie Guo

        Activity

        Hide
        Hudson added a comment -

        Integrated in bookkeeper-trunk #451 (See https://builds.apache.org/job/bookkeeper-trunk/451/)
        BOOKKEEPER-211: Bookie fails to to start (sijie) (Revision 1311564)

        Result = SUCCESS
        sijie :
        Files :

        • /zookeeper/bookkeeper/trunk/CHANGES.txt
        • /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
        • /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java
        Show
        Hudson added a comment - Integrated in bookkeeper-trunk #451 (See https://builds.apache.org/job/bookkeeper-trunk/451/ ) BOOKKEEPER-211 : Bookie fails to to start (sijie) (Revision 1311564) Result = SUCCESS sijie : Files : /zookeeper/bookkeeper/trunk/CHANGES.txt /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieTest.java
        Hide
        Sijie Guo added a comment -

        committed as r1311564. thanks Flavio for reviewing.

        Show
        Sijie Guo added a comment - committed as r1311564. thanks Flavio for reviewing.
        Hide
        Flavio Junqueira added a comment -

        +1, it looks good to me, Sijie, thanks!

        Show
        Flavio Junqueira added a comment - +1, it looks good to me, Sijie, thanks!
        Hide
        Sijie Guo added a comment -

        attach a patch to fix the issue, including a test case.

        Show
        Sijie Guo added a comment - attach a patch to fix the issue, including a test case.
        Hide
        Sijie Guo added a comment -

        oh, this issue seems that we don't create current directory on ledger directories.

                    try {
                        checkDirectoryStructure(journalDirectory);
        
                        Cookie journalCookie = Cookie.readFromDirectory(journalDirectory);
                        journalCookie.verify(masterCookie);
                        for (File dir : ledgerDirectories) {
                            checkDirectoryStructure(dir);
                            Cookie c = Cookie.readFromDirectory(dir);
                            c.verify(masterCookie);
                        }    
                    } catch (FileNotFoundException fnf) {
                        if (!newEnv){
                            LOG.error("Cookie exists in zookeeper, but not in all local directories", fnf);
                            throw new BookieException.InvalidCookieException();
                        }    
        
                        masterCookie.writeToDirectory(journalDirectory);
                        for (File dir : ledgerDirectories) {
                            masterCookie.writeToDirectory(dir);
                        }
                        masterCookie.writeToZooKeeper(zk, conf);
                    }
        

        in a clean state, the FileNotFoundException is thrown when checking cookie file in journal directory. so there is no chance to checkDirectory on ledger directories, the current directory would not be created.

        the fix would be simple, would attach a patch later.

        Show
        Sijie Guo added a comment - oh, this issue seems that we don't create current directory on ledger directories. try { checkDirectoryStructure(journalDirectory); Cookie journalCookie = Cookie.readFromDirectory(journalDirectory); journalCookie.verify(masterCookie); for (File dir : ledgerDirectories) { checkDirectoryStructure(dir); Cookie c = Cookie.readFromDirectory(dir); c.verify(masterCookie); } } catch (FileNotFoundException fnf) { if (!newEnv){ LOG.error( "Cookie exists in zookeeper, but not in all local directories" , fnf); throw new BookieException.InvalidCookieException(); } masterCookie.writeToDirectory(journalDirectory); for (File dir : ledgerDirectories) { masterCookie.writeToDirectory(dir); } masterCookie.writeToZooKeeper(zk, conf); } in a clean state, the FileNotFoundException is thrown when checking cookie file in journal directory. so there is no chance to checkDirectory on ledger directories, the current directory would not be created. the fix would be simple, would attach a patch later.

          People

          • Assignee:
            Sijie Guo
            Reporter:
            Flavio Junqueira
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development