poorbarcode commented on code in PR #4462:
URL: https://github.com/apache/bookkeeper/pull/4462#discussion_r1668873892
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/HandleFactoryImpl.java:
##########
@@ -64,8 +79,22 @@ public LedgerDescriptor getReadOnlyHandle(final long
ledgerId) throws IOExceptio
return handle;
}
+ private void markIfConflictWritingOccurs(long ledgerId) {
+ LedgerDescriptor ledgerDescriptor = ledgers.get(ledgerId);
+ try {
+ if (ledgerDescriptor != null && ledgerDescriptor.isFenced()) {
+ recentlyFencedAndDeletedLedgers.put(ledgerId, true);
+ }
+ } catch (IOException | BookieException ex) {
+ // The ledger is in limbo state.
+ recentlyFencedAndDeletedLedgers.put(ledgerId, true);
+ }
+ }
+
@Override
public void ledgerDeleted(long ledgerId) {
+ markIfConflictWritingOccurs(ledgerId);
Review Comment:
> It depends on the garbage collection triggered. If the gc is not
triggered, we also should fail the case, because the ledger metadata has
already been deleted, correct?
- Before garbage collection: the variable `fenced` of the result of
`LedgerHandleFactory.getHandle( ledgerId )` is `fenced`, so the BK client will
get a `ledger fenced` error.
- After garbage collection: the ledger will be marked as `fenced & deleted`,
so the BK client will also get a `ledger fenced` error.
So the current change is fine
--
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]