You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/09/23 11:01:58 UTC

[GitHub] [bookkeeper] HashZhang opened a new issue #2416: bookie format redundant clean ledgerDirs and indexDirs

HashZhang opened a new issue #2416:
URL: https://github.com/apache/bookkeeper/issues/2416


   https://github.com/apache/bookkeeper/blob/ddfeaf9a11fc82cb3b1225a5754285435f2f7fab/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java#L1563
   
   I think it maybe a mistake and should put outside the loop of clean journalDirs, as shown below:
   
   ```
           for (File journalDir : conf.getJournalDirs()) {
               String[] journalDirFiles =
                       journalDir.exists() && journalDir.isDirectory() ? journalDir.list() : null;
               if (journalDirFiles != null && journalDirFiles.length != 0) {
                   try {
                       boolean confirm = false;
                       if (!isInteractive) {
                         
                           confirm = force;
                       } else {
                           confirm = IOUtils
                                   .confirmPrompt("Are you sure to format Bookie data..?");
                       }
                      
                       if (!confirm) {
                           LOG.error("Bookie format aborted!!");
                           return false;
                       }
                   } catch (IOException e) {
                       LOG.error("Error during bookie format", e);
                       return false;
                   }
               }
               if (!cleanDir(journalDir)) {
                   LOG.error("Formatting journal directory failed");
                   return false;
               }
               
           }
   
           File[] ledgerDirs = conf.getLedgerDirs();
           for (File dir : ledgerDirs) {
               if (!cleanDir(dir)) {
                   LOG.error("Formatting ledger directory " + dir + " failed");
                   return false;
               }
           }
   
           // Clean up index directories if they are separate from the ledger dirs
           File[] indexDirs = conf.getIndexDirs();
           if (null != indexDirs) {
               for (File dir : indexDirs) {
                   if (!cleanDir(dir)) {
                       LOG.error("Formatting ledger directory " + dir + " failed");
                       return false;
                   }
               }
           }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] sijie closed issue #2416: bookie format redundant clean ledgerDirs and indexDirs

Posted by GitBox <gi...@apache.org>.
sijie closed issue #2416:
URL: https://github.com/apache/bookkeeper/issues/2416


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] sijie closed issue #2416: bookie format redundant clean ledgerDirs and indexDirs

Posted by GitBox <gi...@apache.org>.
sijie closed issue #2416:
URL: https://github.com/apache/bookkeeper/issues/2416


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli commented on issue #2416: bookie format redundant clean ledgerDirs and indexDirs

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2416:
URL: https://github.com/apache/bookkeeper/issues/2416#issuecomment-697299201


   @HashZhang 
   you are right
   can you please send a PR ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org