From 2ad970b5480888ec452878b5f51d7f1e118fef92 Mon Sep 17 00:00:00 2001 From: Christopher Lambert <1204398+XN137@users.noreply.github.com> Date: Wed, 9 Jul 2025 10:42:11 +0200 Subject: [PATCH] Make StorageCredentialCache safe for mutli-realm usage --- .../jdbc/JdbcMetaStoreManagerFactory.java | 3 +- .../LocalPolarisMetaStoreManagerFactory.java | 3 +- .../storage/cache/StorageCredentialCache.java | 18 ++-- .../cache/StorageCredentialCacheEntry.java | 9 +- .../cache/StorageCredentialCacheKey.java | 35 +++----- .../cache/StorageCredentialCacheTest.java | 90 +++++++++---------- .../quarkus/config/QuarkusProducers.java | 4 +- .../quarkus/catalog/IcebergCatalogTest.java | 2 +- .../catalog/IcebergCatalogViewTest.java | 2 +- .../PolarisGenericTableCatalogTest.java | 2 +- .../quarkus/catalog/PolicyCatalogTest.java | 2 +- 11 files changed, 83 insertions(+), 87 deletions(-) diff --git a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java index 7f4368c364..adf58a495c 100644 --- a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java +++ b/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java @@ -224,8 +224,7 @@ public synchronized StorageCredentialCache getOrCreateStorageCredentialCache( RealmContext realmContext) { if (!storageCredentialCacheMap.containsKey(realmContext.getRealmIdentifier())) { storageCredentialCacheMap.put( - realmContext.getRealmIdentifier(), - new StorageCredentialCache(realmContext, configurationStore)); + realmContext.getRealmIdentifier(), new StorageCredentialCache(configurationStore)); } return storageCredentialCacheMap.get(realmContext.getRealmIdentifier()); diff --git a/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java b/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java index 747991636a..014308999c 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/persistence/LocalPolarisMetaStoreManagerFactory.java @@ -182,8 +182,7 @@ public synchronized StorageCredentialCache getOrCreateStorageCredentialCache( RealmContext realmContext) { if (!storageCredentialCacheMap.containsKey(realmContext.getRealmIdentifier())) { storageCredentialCacheMap.put( - realmContext.getRealmIdentifier(), - new StorageCredentialCache(realmContext, configurationStore)); + realmContext.getRealmIdentifier(), new StorageCredentialCache(configurationStore)); } return storageCredentialCacheMap.get(realmContext.getRealmIdentifier()); diff --git a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCache.java b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCache.java index 36f666db04..8a3aac5d6e 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCache.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCache.java @@ -50,13 +50,10 @@ public class StorageCredentialCache { private static final long CACHE_MAX_NUMBER_OF_ENTRIES = 10_000L; private final LoadingCache cache; - private final RealmContext realmContext; private final PolarisConfigurationStore configurationStore; /** Initialize the creds cache */ - public StorageCredentialCache( - RealmContext realmContext, PolarisConfigurationStore configurationStore) { - this.realmContext = realmContext; + public StorageCredentialCache(PolarisConfigurationStore configurationStore) { this.configurationStore = configurationStore; cache = Caffeine.newBuilder() @@ -69,7 +66,7 @@ public StorageCredentialCache( 0, Math.min( (entry.getExpirationTime() - System.currentTimeMillis()) / 2, - this.maxCacheDurationMs())); + entry.getMaxCacheDurationMs())); return Duration.ofMillis(expireAfterMillis); })) .build( @@ -80,7 +77,7 @@ public StorageCredentialCache( } /** How long credentials should remain in the cache. */ - private long maxCacheDurationMs() { + private long maxCacheDurationMs(RealmContext realmContext) { var cacheDurationSeconds = configurationStore.getConfiguration( realmContext, FeatureConfiguration.STORAGE_CREDENTIAL_CACHE_DURATION_SECONDS); @@ -123,18 +120,18 @@ public AccessConfig getOrGenerateSubScopeCreds( } StorageCredentialCacheKey key = new StorageCredentialCacheKey( + callCtx.getRealmContext().getRealmIdentifier(), polarisEntity, allowListOperation, allowedReadLocations, - allowedWriteLocations, - callCtx); + allowedWriteLocations); LOGGER.atDebug().addKeyValue("key", key).log("subscopedCredsCache"); Function loader = k -> { LOGGER.atDebug().log("StorageCredentialCache::load"); ScopedCredentialsResult scopedCredentialsResult = credentialVendor.getSubscopedCredsForEntity( - k.getCallContext(), + callCtx, k.getCatalogId(), k.getEntityId(), polarisEntity.getType(), @@ -142,7 +139,8 @@ public AccessConfig getOrGenerateSubScopeCreds( k.getAllowedReadLocations(), k.getAllowedWriteLocations()); if (scopedCredentialsResult.isSuccess()) { - return new StorageCredentialCacheEntry(scopedCredentialsResult); + long maxCacheDurationMs = maxCacheDurationMs(callCtx.getRealmContext()); + return new StorageCredentialCacheEntry(scopedCredentialsResult, maxCacheDurationMs); } LOGGER .atDebug() diff --git a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheEntry.java b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheEntry.java index 51fa85a42c..cef5907f20 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheEntry.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheEntry.java @@ -32,12 +32,19 @@ public class StorageCredentialCacheEntry { public final EnumMap credsMap; private final ScopedCredentialsResult scopedCredentialsResult; + private final long maxCacheDurationMs; - public StorageCredentialCacheEntry(ScopedCredentialsResult scopedCredentialsResult) { + public StorageCredentialCacheEntry( + ScopedCredentialsResult scopedCredentialsResult, long maxCacheDurationMs) { this.scopedCredentialsResult = scopedCredentialsResult; + this.maxCacheDurationMs = maxCacheDurationMs; this.credsMap = scopedCredentialsResult.getCredentials(); } + public long getMaxCacheDurationMs() { + return maxCacheDurationMs; + } + /** Get the expiration time in millisecond for the cached entry */ public long getExpirationTime() { if (credsMap.containsKey(StorageAccessProperty.GCS_ACCESS_TOKEN_EXPIRES_AT)) { diff --git a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheKey.java b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheKey.java index 48d83ef16d..26c2115d9f 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheKey.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheKey.java @@ -18,16 +18,14 @@ */ package org.apache.polaris.core.storage.cache; -import jakarta.annotation.Nullable; import java.util.Objects; import java.util.Set; -import org.apache.polaris.core.PolarisCallContext; -import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.entity.PolarisEntity; import org.apache.polaris.core.entity.PolarisEntityConstants; public class StorageCredentialCacheKey { + private final String realmId; private final long catalogId; /** The serialized string of the storage config. */ @@ -44,18 +42,13 @@ public class StorageCredentialCacheKey { private final Set allowedWriteLocations; - /** - * The callContext is passed to be used to fetch subscoped creds, but is not used to hash/equals - * as part of the cache key. - */ - private @Nullable PolarisCallContext callContext; - public StorageCredentialCacheKey( + String realmId, PolarisEntity entity, boolean allowedListAction, Set allowedReadLocations, - Set allowedWriteLocations, - @Nullable PolarisCallContext callContext) { + Set allowedWriteLocations) { + this.realmId = realmId; this.catalogId = entity.getCatalogId(); this.storageConfigSerializedStr = entity @@ -65,10 +58,10 @@ public StorageCredentialCacheKey( this.allowedListAction = allowedListAction; this.allowedReadLocations = allowedReadLocations; this.allowedWriteLocations = allowedWriteLocations; - this.callContext = callContext; - if (this.callContext == null) { - this.callContext = CallContext.getCurrentContext().getPolarisCallContext(); - } + } + + public String getRealmId() { + return realmId; } public long getCatalogId() { @@ -95,16 +88,13 @@ public Set getAllowedWriteLocations() { return allowedWriteLocations; } - public @Nullable PolarisCallContext getCallContext() { - return callContext; - } - @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StorageCredentialCacheKey cacheKey = (StorageCredentialCacheKey) o; - return catalogId == cacheKey.getCatalogId() + return Objects.equals(realmId, cacheKey.getRealmId()) + && catalogId == cacheKey.getCatalogId() && Objects.equals(storageConfigSerializedStr, cacheKey.getStorageConfigSerializedStr()) && allowedListAction == cacheKey.allowedListAction && Objects.equals(allowedReadLocations, cacheKey.allowedReadLocations) @@ -114,6 +104,7 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + realmId, catalogId, storageConfigSerializedStr, allowedListAction, @@ -124,7 +115,9 @@ public int hashCode() { @Override public String toString() { return "StorageCredentialCacheKey{" - + "catalogId=" + + "realmId=" + + realmId + + ", catalogId=" + catalogId + ", storageConfigSerializedStr='" + storageConfigSerializedStr diff --git a/polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java b/polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java index 85776bd23e..01687aa561 100644 --- a/polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java +++ b/polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheTest.java @@ -25,9 +25,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EnumMap; -import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.iceberg.exceptions.UnprocessableEntityException; import org.apache.polaris.core.PolarisCallContext; import org.apache.polaris.core.PolarisDefaultDiagServiceImpl; @@ -76,7 +76,7 @@ public StorageCredentialCacheTest() { } private StorageCredentialCache newStorageCredentialCache() { - return new StorageCredentialCache(callCtx.getRealmContext(), callCtx.getConfigurationStore()); + return new StorageCredentialCache(callCtx.getConfigurationStore()); } @Test @@ -106,8 +106,8 @@ public void testBadResult() { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path")))) + Set.of("s3://bucket1/path"), + Set.of("s3://bucket3/path"))) .isInstanceOf(UnprocessableEntityException.class) .hasMessage("Failed to get subscoped credentials: extra_error_info"); } @@ -140,8 +140,8 @@ public void testCacheHit() { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(1); // subscope for the same entity and same allowed locations, will hit the cache @@ -150,8 +150,8 @@ public void testCacheHit() { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(1); } @@ -178,11 +178,11 @@ public void testCacheEvict() throws InterruptedException { PolarisEntity polarisEntity = new PolarisEntity(baseEntity); StorageCredentialCacheKey cacheKey = new StorageCredentialCacheKey( + callCtx.getRealmContext().getRealmIdentifier(), polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path")), - callCtx); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); // the entry will be evicted immediately because the token is expired storageCredentialCache.getOrGenerateSubScopeCreds( @@ -190,8 +190,8 @@ public void testCacheEvict() throws InterruptedException { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getIfPresent(cacheKey)).isNull(); storageCredentialCache.getOrGenerateSubScopeCreds( @@ -199,8 +199,8 @@ public void testCacheEvict() throws InterruptedException { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getIfPresent(cacheKey)).isNull(); storageCredentialCache.getOrGenerateSubScopeCreds( @@ -208,8 +208,8 @@ public void testCacheEvict() throws InterruptedException { callCtx, polarisEntity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getIfPresent(cacheKey)).isNull(); } @@ -239,8 +239,8 @@ public void testCacheGenerateNewEntries() { callCtx, entity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(++cacheSize); } // update the entity's storage config, since StorageConfig changed, cache will generate new @@ -258,8 +258,8 @@ public void testCacheGenerateNewEntries() { callCtx, PolarisEntity.of(updateEntity), /* allowedListAction= */ true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(++cacheSize); } // allowedListAction changed to different value FALSE, will generate new entry @@ -269,8 +269,8 @@ public void testCacheGenerateNewEntries() { callCtx, entity, /* allowedListAction= */ false, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(++cacheSize); } // different allowedWriteLocations, will generate new entry @@ -280,8 +280,8 @@ public void testCacheGenerateNewEntries() { callCtx, entity, /* allowedListAction= */ false, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://differentbucket/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://differentbucket/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(++cacheSize); } // different allowedReadLocations, will generate new try @@ -298,8 +298,8 @@ public void testCacheGenerateNewEntries() { callCtx, PolarisEntity.of(updateEntity), /* allowedListAction= */ false, - new HashSet<>(Arrays.asList("s3://differentbucket/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket/path"))); + Set.of("s3://differentbucket/path", "s3://bucket2/path"), + Set.of("s3://bucket/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(++cacheSize); } } @@ -329,8 +329,8 @@ public void testCacheNotAffectedBy() { callCtx, entity, true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); } Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(entityList.size()); @@ -341,8 +341,8 @@ public void testCacheNotAffectedBy() { callCtx, new PolarisEntity(new PolarisBaseEntity.Builder(entity).id(1234).build()), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(entityList.size()); } @@ -353,8 +353,8 @@ public void testCacheNotAffectedBy() { callCtx, new PolarisEntity(new PolarisBaseEntity.Builder(entity).entityVersion(5).build()), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(entityList.size()); } // order of the allowedReadLocations does not affect the cache @@ -364,8 +364,8 @@ public void testCacheNotAffectedBy() { callCtx, new PolarisEntity(new PolarisBaseEntity.Builder(entity).entityVersion(5).build()), true, - new HashSet<>(Arrays.asList("s3://bucket2/path", "s3://bucket1/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket2/path", "s3://bucket1/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(entityList.size()); } @@ -376,8 +376,8 @@ public void testCacheNotAffectedBy() { callCtx, new PolarisEntity(new PolarisBaseEntity.Builder(entity).entityVersion(5).build()), true, - new HashSet<>(Arrays.asList("s3://bucket2/path", "s3://bucket1/path")), - new HashSet<>(Arrays.asList("s3://bucket4/path", "s3://bucket3/path"))); + Set.of("s3://bucket2/path", "s3://bucket1/path"), + Set.of("s3://bucket4/path", "s3://bucket3/path")); Assertions.assertThat(storageCredentialCache.getEstimatedSize()).isEqualTo(entityList.size()); } } @@ -497,8 +497,8 @@ public void testAzureCredentialFormatting() { callCtx, entityList.get(0), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))) + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")) .credentials(); Assertions.assertThat(noSuffixResult.size()).isEqualTo(2); Assertions.assertThat(noSuffixResult).containsKey("adls.sas-token.some_account"); @@ -510,8 +510,8 @@ public void testAzureCredentialFormatting() { callCtx, entityList.get(1), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))) + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")) .credentials(); Assertions.assertThat(adlsSuffixResult.size()).isEqualTo(3); Assertions.assertThat(adlsSuffixResult).containsKey("adls.sas-token.some_account"); @@ -525,8 +525,8 @@ public void testAzureCredentialFormatting() { callCtx, entityList.get(2), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))) + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")) .credentials(); Assertions.assertThat(blobSuffixResult.size()).isEqualTo(3); Assertions.assertThat(blobSuffixResult).containsKey("adls.sas-token.some_account"); @@ -563,8 +563,8 @@ public void testExtraProperties() { callCtx, entityList.get(0), true, - new HashSet<>(Arrays.asList("s3://bucket1/path", "s3://bucket2/path")), - new HashSet<>(Arrays.asList("s3://bucket3/path", "s3://bucket4/path"))); + Set.of("s3://bucket1/path", "s3://bucket2/path"), + Set.of("s3://bucket3/path", "s3://bucket4/path")); Assertions.assertThat(config.credentials()) .containsExactly(Map.entry("s3.secret-access-key", "super-secret-123")); Assertions.assertThat(config.extraProperties()) diff --git a/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java b/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java index 8b8588514b..74caae1133 100644 --- a/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java +++ b/runtime/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java @@ -100,8 +100,8 @@ public Clock clock() { @Produces @ApplicationScoped public StorageCredentialCache storageCredentialCache( - RealmContext realmContext, PolarisConfigurationStore configurationStore) { - return new StorageCredentialCache(realmContext, configurationStore); + PolarisConfigurationStore configurationStore) { + return new StorageCredentialCache(configurationStore); } @Produces diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java index a5f4f90800..fa14d3318b 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java @@ -292,7 +292,7 @@ public void before(TestInfo testInfo) { entityManager = new PolarisEntityManager( metaStoreManager, - new StorageCredentialCache(realmContext, configurationStore), + new StorageCredentialCache(configurationStore), createEntityCache(metaStoreManager)); PrincipalEntity rootEntity = diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java index b1c2d5aef5..4d4fa50537 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogViewTest.java @@ -179,7 +179,7 @@ public void before(TestInfo testInfo) { PolarisEntityManager entityManager = new PolarisEntityManager( metaStoreManager, - new StorageCredentialCache(realmContext, configurationStore), + new StorageCredentialCache(configurationStore), new InMemoryEntityCache(realmContext, configurationStore, metaStoreManager)); CallContext.setCurrentContext(polarisContext); diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java index 6fcd4f4782..c4b743bd0f 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolarisGenericTableCatalogTest.java @@ -171,7 +171,7 @@ public void before(TestInfo testInfo) { entityManager = new PolarisEntityManager( metaStoreManager, - new StorageCredentialCache(realmContext, configurationStore), + new StorageCredentialCache(configurationStore), new InMemoryEntityCache(realmContext, configurationStore, metaStoreManager)); PrincipalEntity rootEntity = diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java index 5b75dff833..d7811e9aba 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/PolicyCatalogTest.java @@ -197,7 +197,7 @@ public void before(TestInfo testInfo) { entityManager = new PolarisEntityManager( metaStoreManager, - new StorageCredentialCache(realmContext, configurationStore), + new StorageCredentialCache(configurationStore), new InMemoryEntityCache(realmContext, configurationStore, metaStoreManager)); callContext = polarisContext;