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 ae361db739ce9..6b4075b94def0 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 @@ -269,7 +269,8 @@ private CompletableFuture putSchema(String schemaId, byte[] data, byte[] h createNewSchema(schemaId, data, hash) .thenAccept(future::complete) .exceptionally(ex -> { - if (ex.getCause() instanceof NodeExistsException) { + if (ex.getCause() instanceof NodeExistsException || + ex.getCause() instanceof KeeperException.BadVersionException) { // There was a race condition on the schema creation. Since it has now been created, // retry the whole operation so that we have a chance to recover without bubbling error // back to producer/consumer