Skip to content

Commit

Permalink
[fix][schema] Only handle exception when there has (#20730)
Browse files Browse the repository at this point in the history
  • Loading branch information
zymap authored Jul 6, 2023
1 parent 4bf208d commit 881a1f4
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,18 +472,20 @@ private CompletableFuture<Long> updateSchemaLocator(
.build()
, locatorEntry.version
).thenApply(ignore -> nextVersion).whenComplete((__, ex) -> {
Throwable cause = FutureUtil.unwrapCompletionException(ex);
log.warn("[{}] Failed to update schema locator with position {}", schemaId, position, cause);
if (cause instanceof AlreadyExistsException || cause instanceof BadVersionException) {
bookKeeper.asyncDeleteLedger(position.getLedgerId(), new AsyncCallback.DeleteCallback() {
@Override
public void deleteComplete(int rc, Object ctx) {
if (rc != BKException.Code.OK) {
log.warn("[{}] Failed to delete ledger {} after updating schema locator failed, rc: {}",
if (ex != null) {
Throwable cause = FutureUtil.unwrapCompletionException(ex);
log.warn("[{}] Failed to update schema locator with position {}", schemaId, position, cause);
if (cause instanceof AlreadyExistsException || cause instanceof BadVersionException) {
bookKeeper.asyncDeleteLedger(position.getLedgerId(), new AsyncCallback.DeleteCallback() {
@Override
public void deleteComplete(int rc, Object ctx) {
if (rc != BKException.Code.OK) {
log.warn("[{}] Failed to delete ledger {} after updating schema locator failed, rc: {}",
schemaId, position.getLedgerId(), rc);
}
}
}
}, null);
}, null);
}
}
});
}
Expand Down

0 comments on commit 881a1f4

Please sign in to comment.