diff --git a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java index 1ed465c5c7da0..920b022905ea2 100644 --- a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java +++ b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java @@ -186,7 +186,13 @@ private void checkLayout() throws ReplicationException.CompatibilityException { if (!store.exists(layoutPath).join()) { LedgerRereplicationLayoutFormat.Builder builder = LedgerRereplicationLayoutFormat.newBuilder(); builder.setType(LAYOUT).setVersion(LAYOUT_VERSION); - store.put(layoutPath, builder.build().toString().getBytes(UTF_8), Optional.of(-1L)).join(); + try { + store.put(layoutPath, builder.build().toString().getBytes(UTF_8), Optional.of(-1L)).get(); + } catch (ExecutionException | InterruptedException e) { + if (!(e.getCause() instanceof MetadataStoreException.BadVersionException)) { + throw new RuntimeException(e); + } + } } else { byte[] layoutData = store.get(layoutPath).join().get().getValue();