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

 ##########
 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:
   What is this expected error?
   Can we add an assertion about this exception?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to