From db97e0ab9c4a37973cdc11e64a694f4554664a10 Mon Sep 17 00:00:00 2001 From: Dmitri Bourlatchkov Date: Thu, 10 Apr 2025 14:57:29 -0400 Subject: [PATCH] Properly track bootstrappedRealms in InMemoryPolarisMetaStoreManagerFactory Fixes #1351 --- .../persistence/InMemoryPolarisMetaStoreManagerFactory.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java b/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java index 2d51dcd539..4122285b0b 100644 --- a/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java +++ b/service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java @@ -97,13 +97,13 @@ public synchronized Supplier getOrCreateSessionSupplie private void bootstrapRealmsAndPrintCredentials(List realms) { RootCredentialsSet rootCredentialsSet = RootCredentialsSet.fromEnvironment(); this.bootstrapRealms(realms, rootCredentialsSet); - bootstrappedRealms.addAll(realms); } @Override public Map bootstrapRealms( Iterable realms, RootCredentialsSet rootCredentialsSet) { Map results = super.bootstrapRealms(realms, rootCredentialsSet); + bootstrappedRealms.addAll(results.keySet()); Map presetCredentials = rootCredentialsSet.credentials(); for (String realmId : realms) { @@ -113,6 +113,9 @@ public Map bootstrapRealms( } PrincipalSecretsResult principalSecrets = results.get(realmId); + if (principalSecrets == null) { + continue; // already bootstrapped (possible benign race) + } String msg = String.format(