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/02/18 20:10:00 UTC

[GitHub] eolivelli commented on a change in pull request #1163: Issue 1162 - Test for unsetSuccessAndSendWriteRequest with LedgerHand?

eolivelli commented on a change in pull request #1163: Issue 1162 - Test for unsetSuccessAndSendWriteRequest with LedgerHand?
URL: https://github.com/apache/bookkeeper/pull/1163#discussion_r168963708
 
 

 ##########
 File path: bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
 ##########
 @@ -710,6 +711,83 @@ public void testLedgerCreateAdvWithAsyncWritesWithBookieFailures() throws Except
         lh2.close();
     }
 
+    /**
+     * LedgerHandleAdv out of order writers with ensemble changes.
+     * Verify that entry that was written to old ensemble will be
+     * written to new enseble too after ensemble change.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testLedgerHandleAdvOutOfOrderWriteAndFrocedEnsembleChange() throws Exception {
+        // Create a ledger
+        long ledgerId = 0xABCDEF;
+        SyncObj syncObj1 = new SyncObj();
+        ByteBuffer entry;
+        lh = bkc.createLedgerAdv(ledgerId, 3, 3, 3, digestType, ledgerPassword, null);
+        entry = ByteBuffer.allocate(4);
+        // Add entries 0-4
+        for (int i = 0; i < 5; i++) {
+            entry.rewind();
+            entry.putInt(rng.nextInt(maxInt));
+            lh.addEntry(i, entry.array());
+        }
+
+        // Add 10 as Async Entry, which goes to first ensemble
+        ByteBuffer entry1 = ByteBuffer.allocate(4);
+        entry1.putInt(rng.nextInt(maxInt));
+        lh.asyncAddEntry(10, entry1.array(), 0, entry1.capacity(), this, syncObj1);
+
+        Thread.sleep(5000);// wait 5 sec so entry-11 goes to the bookies and gets response.
 
 Review comment:
   You can use powemock Whitebox getInternalState in orde to access internal without exposing new method

----------------------------------------------------------------
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