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/12/14 22:52:50 UTC

[GitHub] athanatos commented on a change in pull request #1887: Issue#1886 Handle double bookie failures

athanatos commented on a change in pull request #1887: Issue#1886 Handle double bookie failures
URL: https://github.com/apache/bookkeeper/pull/1887#discussion_r241914188
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##########
 @@ -2222,9 +2223,22 @@ private boolean updateMetadataIfPossible(LedgerMetadata metadata, LedgerMetadata
             metadata.setVersion(newMeta.getVersion());
             // merge ensemble infos from new meta except last ensemble
             // since they might be modified by recovery tool.
+
             metadata.mergeEnsembles(newMeta.getEnsembles());
-            writeLedgerConfig(new ChangeEnsembleCb(ensembleInfo, curBlockAddCompletions,
-                    ensembleChangeIdx));
+            if (!areFailedBookiesReplaced(metadata, ensembleInfo)) {
+                // If the in-memory data contains the failed bookie, someone else
+                // merged the metadata and reinstated old copy. Let's attempt to
+                // replace the bookie again.
+                try {
+                    ensembleInfo = replaceBookieInMetadata(ensembleInfo.failedBookies, numEnsembleChanges.get());
+                } catch (BKException.BKNotEnoughBookiesException e) {
+                    LOG.error("Could not get additional bookie to remake ensemble, closing ledger: {}", ledgerId);
+                    handleUnrecoverableErrorDuringAdd(e.getCode());
 
 Review comment:
   I think if we return false here ReReadLedgerMetadataCb will already handle calling handleUnrecoverableErrorDuringAdd, so doing it here results in it being called twice.

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