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 2018/05/10 16:58:44 UTC

[GitHub] dlg99 opened a new issue #1400: createLedger() may fail if called immediatly after bookie startup

dlg99 opened a new issue #1400: createLedger() may fail if called immediatly after bookie startup
URL: https://github.com/apache/bookkeeper/issues/1400
 
 
   **BUG REPORT**
   
   [testLedgerCreateAfterBookieStartup.txt](https://github.com/apache/bookkeeper/files/1992491/testLedgerCreateAfterBookieStartup.txt)
   
   Caught this as a flapper in a separate (new) test suite.
   createLedger() may fail with "org.apache.bookkeeper.client.BKException$BKNotEnoughBookiesException: Not enough non-faulty bookies available" if executed immediately after bookie restart.
   
   It does not seem to be a production risk as the test uses single bookie and simple sleep(100ms) after bookie startup takes care of this problem.
   OTOH I tried this test on internal (older) branch and the test passes so clearly there is a regression somewhere. 
   
   Narrowed down it reproduces like this (also patch attached):
   
   ```java
       @Test
       public void testLedgerCreateAfterBookieStartup() throws Exception {
           // only one bookie started initially
   
           for (int n = 0; n < 30; n++) {
               int bkId = 0;
               BookieServer bks = bs.get(bkId);
               bks.shutdown();
               bks = new BookieServer(bsConfs.get(bkId));
               bks.start();
               bs.set(bkId, bks);
   
               // all passes with this sleep:
               //Thread.sleep(100);
   
               // Create ledgers
               LedgerHandle[] lhs = new LedgerHandle[10];
               for (int i = 0; i < 10; i++) {
                   LOG.info("Iteration {}, creating ledger", n);
                   lhs[i] = bkc.createLedger(1, 1, BookKeeper.DigestType.CRC32, "z".getBytes());
                   LOG.info("Iteration {}, created ledger ID: {}", n, lhs[i].getId());
                   lhs[i].addEntry("zzz".getBytes());
               }
           }
       }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services