zhaohaidao commented on code in PR #3620:
URL: https://github.com/apache/bookkeeper/pull/3620#discussion_r1016147594
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingAddOp.java:
##########
@@ -266,6 +266,10 @@ public void run() {
// We are about to send. Check if we need to make an ensemble change
// because of delayed write errors
lh.maybeHandleDelayedWriteBookieFailure();
+ // This op maybe recycled during bookie failures
+ if (maybeRecycled()) {
Review Comment:
>
That's right. maybeHandleDelayedWriteBookieFailure will replace failed
bookie with healthy one. However if NotEnoughBookieException is throwed.
maybeHandleDelayedWriteBookieFailure will recycle this pending add op.
You can see this recycle logic in followed code logic
`
@Override
void handleBookieFailure(final Map<Integer, BookieId> failedBookies) {
// handleBookieFailure should always run in the ordered executor
thread for this
// ledger, so this synchronized should be unnecessary, but putting
it here now
// just in case (can be removed when we validate threads)
synchronized (metadataLock) {
...
try {
List<BookieId> newEnsemble =
EnsembleUtils.replaceBookiesInEnsemble(
clientCtx.getBookieWatcher(), metadata,
currentEnsemble, failedBookies, logContext);
...
} catch (BKException.BKNotEnoughBookiesException e) {
LOG.error("Could not get additional bookie to remake
ensemble, closing ledger: {}", ledgerId);
handleUnrecoverableErrorDuringAdd(e.getCode());
return;
}
`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]