Skip to content

Commit 18fdb01

Browse files
authored
Properly track bootstrappedRealms in InMemoryPolarisMetaStoreManagerFactory (#1352)
Fixes #1351
1 parent 3f42a7a commit 18fdb01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

service/common/src/main/java/org/apache/polaris/service/persistence/InMemoryPolarisMetaStoreManagerFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ public synchronized Supplier<TransactionalPersistence> getOrCreateSessionSupplie
9797
private void bootstrapRealmsAndPrintCredentials(List<String> realms) {
9898
RootCredentialsSet rootCredentialsSet = RootCredentialsSet.fromEnvironment();
9999
this.bootstrapRealms(realms, rootCredentialsSet);
100-
bootstrappedRealms.addAll(realms);
101100
}
102101

103102
@Override
104103
public Map<String, PrincipalSecretsResult> bootstrapRealms(
105104
Iterable<String> realms, RootCredentialsSet rootCredentialsSet) {
106105
Map<String, PrincipalSecretsResult> results = super.bootstrapRealms(realms, rootCredentialsSet);
106+
bootstrappedRealms.addAll(results.keySet());
107107

108108
Map<String, RootCredentials> presetCredentials = rootCredentialsSet.credentials();
109109
for (String realmId : realms) {
@@ -113,6 +113,9 @@ public Map<String, PrincipalSecretsResult> bootstrapRealms(
113113
}
114114

115115
PrincipalSecretsResult principalSecrets = results.get(realmId);
116+
if (principalSecrets == null) {
117+
continue; // already bootstrapped (possible benign race)
118+
}
116119

117120
String msg =
118121
String.format(

0 commit comments

Comments
 (0)