36 lines
2.3 KiB
Diff
36 lines
2.3 KiB
Diff
|
|
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
|
||
|
|
index fe1e60d201..b98a111455 100644
|
||
|
|
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
|
||
|
|
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java
|
||
|
|
@@ -470,18 +470,20 @@ public class BookkeeperSchemaStorage implements SchemaStorage {
|
||
|
|
concat(locator.getIndexList(), newArrayList(info))
|
||
|
|
).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);
|
||
|
|
+ }
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|