eolivelli commented on a change in pull request #1769: ISSUE-1757: prevent race between flush and delete from recreating index URL: https://github.com/apache/bookkeeper/pull/1769#discussion_r229191582
########## File path: bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerCacheTest.java ########## @@ -379,76 +379,110 @@ public void testSyncThreadNPE() throws IOException { } /** - * Race where a flush would fail because a garbage collection occurred at - * the wrong time. + * Test for race between delete and flush. * {@link https://issues.apache.org/jira/browse/BOOKKEEPER-604} + * {@link https://github.com/apache/bookkeeper/issues/1757} */ @Test public void testFlushDeleteRace() throws Exception { newLedgerCache(); final AtomicInteger rc = new AtomicInteger(0); - final LinkedBlockingQueue<Long> ledgerQ = new LinkedBlockingQueue<Long>(1); + final LinkedBlockingQueue<Long> ledgerQ = new LinkedBlockingQueue<>(100); final byte[] masterKey = "masterKey".getBytes(); + final long numLedgers = 1000; + final int numFlushers = 10; + final int numDeleters = 10; + final AtomicBoolean running = new AtomicBoolean(true); Thread newLedgerThread = new Thread() { public void run() { try { - for (int i = 0; i < 1000 && rc.get() == 0; i++) { + for (long i = 0; i < numLedgers && rc.get() == 0; i++) { ledgerCache.setMasterKey(i, masterKey); - ledgerQ.put((long) i); + + ledgerCache.putEntryOffset(i, 1, 0); + //ledgerCache.putEntryOffset(i, 1024, 0); + //ledgerCache.putEntryOffset(i, 4096, 0); Review comment: Nit: remove commented code? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services