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/03/09 23:00:45 UTC

[GitHub] [bookkeeper] rdhabalia commented on a change in pull request #2281: [bookie-ledger-recovery] Fix bookie recovery stuck even with enough ack-quorum response

rdhabalia commented on a change in pull request #2281: [bookie-ledger-recovery] Fix bookie recovery stuck even with enough ack-quorum response
URL: https://github.com/apache/bookkeeper/pull/2281#discussion_r390007211
 
 

 ##########
 File path: bookkeeper-server/src/test/java/org/apache/bookkeeper/client/ParallelLedgerRecoveryTest.java
 ##########
 @@ -693,4 +695,55 @@ public void readLastConfirmedDataComplete(int rc, DigestManager.RecoveryData dat
         readBk.close();
     }
 
+    /**
+     * Validate ledger can recover with response:  (Qw - Qa)+1.
+     * @throws Exception
+     */
+    @Test
+    public void testRecoveryWithUnavailableBookie() throws Exception {
+
+        byte[] passwd = "recovery-when-closing-ledger-handle".getBytes(UTF_8);
+
+        int ensembleSize = 2;
+        int writeQuorumSize = 2;
+        int ackQuormSize = 2;
+        ClientConfiguration newConf = new ClientConfiguration();
+        newConf.addConfiguration(baseClientConf);
+        final BookKeeper newBk0 = new BookKeeper(newConf);
+        final LedgerHandle lh0 = newBk0.createLedger(ensembleSize, writeQuorumSize, ackQuormSize, digestType, passwd);
+        final BookKeeper readBk = new BookKeeper(newConf);
+        final LedgerHandle readLh = readBk.openLedgerNoRecovery(lh0.getId(), digestType, passwd);
+
+        MutableInt responseCode = new MutableInt(100);
+        CountDownLatch responseLatch = new CountDownLatch(1);
+        ReadLastConfirmedOp readLCOp = new ReadLastConfirmedOp(readLh, bkc.getBookieClient(),
+                readLh.getLedgerMetadata().getAllEnsembles().lastEntry().getValue(),
+                new ReadLastConfirmedOp.LastConfirmedDataCallback() {
+                    @Override
+                    public void readLastConfirmedDataComplete(int rc, DigestManager.RecoveryData data) {
+                        responseCode.setValue(rc);
+                        responseLatch.countDown();
+                    }
+                });
+
+        // complete first successful write.
+        byte[] lac = new byte[DigestManager.METADATA_LENGTH * 2];
+        try {
+            readLCOp.readEntryComplete(BKException.Code.OK, 0, 0, Unpooled.wrappedBuffer(lac, 0, lac.length), 0);
+        } catch (Exception e) {
+            // Ok
 
 Review comment:
   actually it was failing due to digest verification because of mock data but I have fixed it after spending some time understanding it correctly. 

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


With regards,
Apache Git Services