This is an automated email from the ASF dual-hosted git repository. emaynard pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push: new 886d1116d Remove PolarisEntityManager.getCredentialCache (#2133) 886d1116d is described below commit 886d1116da3bb09d8cc9278af907abc733e36681 Author: Christopher Lambert <xn...@gmx.de> AuthorDate: Tue Jul 22 01:25:31 2025 +0200 Remove PolarisEntityManager.getCredentialCache (#2133) `PolarisEntityManager` itself is not using the `StorageCredentialCache` but just hands it out via `getCredentialCache`. the only caller of `getCredentialCache` is `FileIOUtil.refreshAccessConfig`, which in in turn is only called by `DefaultFileIOFactory` and `IcebergCatalog`. note that in a follow-up we will likely be able to remove `PolarisEntityManager` usage completely from `IcebergCatalog`. additional cleanups: - use `StorageCredentialCache` injection in tests (but we need to invalidate all entries on test start) - remove unused `UserSecretsManagerFactory` from `PolarisCallContextCatalogFactory` --- .../core/persistence/PolarisEntityManager.java | 13 +--------- .../core/storage/cache/StorageCredentialCache.java | 5 ++++ .../quarkus/admin/PolarisAuthzTestBase.java | 9 +++++-- .../admin/PolarisS3InteroperabilityTest.java | 2 +- .../catalog/AbstractIcebergCatalogTest.java | 30 ++++++++-------------- .../catalog/AbstractIcebergCatalogViewTest.java | 25 ++++++++---------- .../AbstractPolarisGenericTableCatalogTest.java | 27 ++++++++----------- .../quarkus/catalog/AbstractPolicyCatalogTest.java | 27 ++++++++----------- .../catalog/IcebergCatalogHandlerAuthzTest.java | 4 +-- .../service/catalog/iceberg/IcebergCatalog.java | 8 +++--- .../service/catalog/io/DefaultFileIOFactory.java | 13 ++++------ .../polaris/service/catalog/io/FileIOUtil.java | 20 +++++++-------- .../catalog/io/WasbTranslatingFileIOFactory.java | 6 ++--- .../service/config/RealmEntityManagerFactory.java | 7 +---- .../catalog/PolarisCallContextCatalogFactory.java | 9 ++++--- .../service/catalog/io/FileIOFactoryTest.java | 5 ++-- .../org/apache/polaris/service/TestServices.java | 11 ++++---- .../service/catalog/io/MeasuredFileIOFactory.java | 6 ++--- 18 files changed, 98 insertions(+), 129 deletions(-) diff --git a/polaris-core/src/main/java/org/apache/polaris/core/persistence/PolarisEntityManager.java b/polaris-core/src/main/java/org/apache/polaris/core/persistence/PolarisEntityManager.java index 033730cb9..01342be2e 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/persistence/PolarisEntityManager.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/persistence/PolarisEntityManager.java @@ -32,7 +32,6 @@ import org.apache.polaris.core.entity.PolarisPrivilege; import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.persistence.resolver.PolarisResolutionManifest; import org.apache.polaris.core.persistence.resolver.Resolver; -import org.apache.polaris.core.storage.cache.StorageCredentialCache; /** * Wraps logic of handling name-caching and entity-caching against a concrete underlying entity @@ -43,22 +42,16 @@ public class PolarisEntityManager { private final PolarisMetaStoreManager metaStoreManager; private final EntityCache entityCache; - private final StorageCredentialCache credentialCache; - // Lazily instantiated only a single time per entity manager. private ResolvedPolarisEntity implicitResolvedRootContainerEntity = null; /** * @param metaStoreManager the metastore manager for the current realm - * @param credentialCache the storage credential cache for the current realm * @param entityCache the entity cache to use (it may be {@code null}). */ public PolarisEntityManager( - @Nonnull PolarisMetaStoreManager metaStoreManager, - @Nonnull StorageCredentialCache credentialCache, - @Nullable EntityCache entityCache) { + @Nonnull PolarisMetaStoreManager metaStoreManager, @Nullable EntityCache entityCache) { this.metaStoreManager = metaStoreManager; - this.credentialCache = credentialCache; this.entityCache = entityCache; } @@ -133,8 +126,4 @@ public class PolarisEntityManager { } return implicitResolvedRootContainerEntity; } - - public StorageCredentialCache getCredentialCache() { - return credentialCache; - } } 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 44b41afb3..49dc858d3 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 @@ -169,4 +169,9 @@ public class StorageCredentialCache { public long getEstimatedSize() { return this.cache.estimatedSize(); } + + @VisibleForTesting + public void invalidateAll() { + this.cache.invalidateAll(); + } } diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java index c86cefe6e..53698728c 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java @@ -75,6 +75,7 @@ import org.apache.polaris.core.persistence.resolver.PolarisResolutionManifest; import org.apache.polaris.core.policy.PredefinedPolicyTypes; import org.apache.polaris.core.secrets.UserSecretsManager; import org.apache.polaris.core.secrets.UserSecretsManagerFactory; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; import org.apache.polaris.service.admin.PolarisAdminService; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; import org.apache.polaris.service.catalog.generic.PolarisGenericTableCatalog; @@ -191,6 +192,7 @@ public abstract class PolarisAuthzTestBase { @Inject protected PolarisEventListener polarisEventListener; @Inject protected CatalogHandlerUtils catalogHandlerUtils; @Inject protected PolarisConfigurationStore configurationStore; + @Inject protected StorageCredentialCache storageCredentialCache; protected IcebergCatalog baseCatalog; protected PolarisGenericTableCatalog genericTableCatalog; @@ -220,6 +222,8 @@ public abstract class PolarisAuthzTestBase { @BeforeEach public void before(TestInfo testInfo) { + storageCredentialCache.invalidateAll(); + RealmContext realmContext = testInfo::getDisplayName; QuarkusMock.installMockForType(realmContext, RealmContext.class); metaStoreManager = managerFactory.getOrCreateMetaStoreManager(realmContext); @@ -463,6 +467,7 @@ public abstract class PolarisAuthzTestBase { callContext, entityManager, securityContext, CATALOG_NAME); this.baseCatalog = new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManager, callContext, @@ -492,16 +497,16 @@ public abstract class PolarisAuthzTestBase { @Inject public TestPolarisCallContextCatalogFactory( + StorageCredentialCache storageCredentialCache, RealmEntityManagerFactory entityManagerFactory, MetaStoreManagerFactory metaStoreManagerFactory, - UserSecretsManagerFactory userSecretsManagerFactory, TaskExecutor taskExecutor, FileIOFactory fileIOFactory, PolarisEventListener polarisEventListener) { super( + storageCredentialCache, entityManagerFactory, metaStoreManagerFactory, - userSecretsManagerFactory, taskExecutor, fileIOFactory, polarisEventListener); diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisS3InteroperabilityTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisS3InteroperabilityTest.java index ff9dbb6c3..1467d54b4 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisS3InteroperabilityTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisS3InteroperabilityTest.java @@ -73,7 +73,7 @@ public class PolarisS3InteroperabilityTest { public PolarisS3InteroperabilityTest() { TestServices.FileIOFactorySupplier fileIOFactorySupplier = - (entityManagerFactory, metaStoreManagerFactory) -> + (storageCredentialCache, metaStoreManagerFactory) -> (FileIOFactory) (callContext, ioImplClassName, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java index c153a2518..463ef4daf 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogTest.java @@ -125,7 +125,6 @@ import org.apache.polaris.core.storage.StorageAccessProperty; import org.apache.polaris.core.storage.aws.AwsCredentialsStorageIntegration; import org.apache.polaris.core.storage.aws.AwsStorageConfigurationInfo; import org.apache.polaris.core.storage.cache.StorageCredentialCache; -import org.apache.polaris.core.storage.cache.StorageCredentialCacheConfig; import org.apache.polaris.service.admin.PolarisAdminService; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; import org.apache.polaris.service.catalog.iceberg.CatalogHandlerUtils; @@ -134,7 +133,6 @@ import org.apache.polaris.service.catalog.io.DefaultFileIOFactory; import org.apache.polaris.service.catalog.io.ExceptionMappingFileIO; import org.apache.polaris.service.catalog.io.FileIOFactory; import org.apache.polaris.service.catalog.io.MeasuredFileIOFactory; -import org.apache.polaris.service.config.RealmEntityManagerFactory; import org.apache.polaris.service.config.ReservedProperties; import org.apache.polaris.service.events.AfterTableCommitedEvent; import org.apache.polaris.service.events.AfterTableRefreshedEvent; @@ -225,7 +223,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat @Inject MetaStoreManagerFactory metaStoreManagerFactory; @Inject PolarisConfigurationStore configurationStore; - @Inject StorageCredentialCacheConfig storageCredentialCacheConfig; + @Inject StorageCredentialCache storageCredentialCache; @Inject PolarisStorageIntegrationProvider storageIntegrationProvider; @Inject UserSecretsManagerFactory userSecretsManagerFactory; @Inject PolarisDiagnostics diagServices; @@ -237,8 +235,6 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat private UserSecretsManager userSecretsManager; private PolarisCallContext polarisContext; private PolarisAdminService adminService; - private StorageCredentialCache storageCredentialCache; - private RealmEntityManagerFactory realmEntityManagerFactory; private PolarisEntityManager entityManager; private FileIOFactory fileIOFactory; private InMemoryFileIO fileIO; @@ -263,6 +259,8 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { + storageCredentialCache.invalidateAll(); + realmName = "realm_%s_%s" .formatted( @@ -281,13 +279,8 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat configurationStore, Clock.systemDefaultZone()); - storageCredentialCache = new StorageCredentialCache(storageCredentialCacheConfig); - - entityManager = - new PolarisEntityManager( - metaStoreManager, - storageCredentialCache, - createEntityCache(polarisContext.getRealmConfig(), metaStoreManager)); + EntityCache entityCache = createEntityCache(polarisContext.getRealmConfig(), metaStoreManager); + entityManager = new PolarisEntityManager(metaStoreManager, entityCache); // LocalPolarisMetaStoreManagerFactory.bootstrapServiceAndCreatePolarisPrincipalForRealm sets // the CallContext.setCurrentContext() but never clears it, whereas the NoSQL one resets it. @@ -352,11 +345,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat .build() .asCatalog())); - realmEntityManagerFactory = - new RealmEntityManagerFactory( - metaStoreManagerFactory, configurationStore, storageCredentialCache); - this.fileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + this.fileIOFactory = new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); StsClient stsClient = Mockito.mock(StsClient.class); when(stsClient.assumeRole(isA(AssumeRoleRequest.class))) @@ -447,6 +436,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat polarisContext, entityManager, securityContext, catalogName); TaskExecutor taskExecutor = Mockito.mock(TaskExecutor.class); return new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManager, polarisContext, @@ -996,7 +986,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat final String tableLocation = "s3://externally-owned-bucket/validate_table/"; final String tableMetadataLocation = tableLocation + "metadata/"; FileIOFactory fileIOFactory = - spy(new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory)); + spy(new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory)); IcebergCatalog catalog = newIcebergCatalog(catalog().name(), metaStoreManager, fileIOFactory); catalog.initialize( CATALOG_NAME, @@ -1849,7 +1839,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat .containsEntry(StorageAccessProperty.AWS_TOKEN, SESSION_TOKEN); FileIO fileIO = new TaskFileIOSupplier( - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory)) + new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory)) .apply(taskEntity, polarisContext); Assertions.assertThat(fileIO).isNotNull().isInstanceOf(ExceptionMappingFileIO.class); Assertions.assertThat(((ExceptionMappingFileIO) fileIO).getInnerIo()) @@ -1976,7 +1966,7 @@ public abstract class AbstractIcebergCatalogTest extends CatalogTests<IcebergCat @Test public void testFileIOWrapper() { MeasuredFileIOFactory measured = - new MeasuredFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + new MeasuredFileIOFactory(storageCredentialCache, metaStoreManagerFactory); IcebergCatalog catalog = newIcebergCatalog(CATALOG_NAME, metaStoreManager, measured); catalog.initialize( CATALOG_NAME, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java index 8d55d288a..2a0408e8b 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractIcebergCatalogViewTest.java @@ -55,16 +55,15 @@ import org.apache.polaris.core.entity.PrincipalEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; +import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.secrets.UserSecretsManager; import org.apache.polaris.core.secrets.UserSecretsManagerFactory; import org.apache.polaris.core.storage.cache.StorageCredentialCache; -import org.apache.polaris.core.storage.cache.StorageCredentialCacheConfig; import org.apache.polaris.service.admin.PolarisAdminService; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; import org.apache.polaris.service.catalog.iceberg.IcebergCatalog; import org.apache.polaris.service.catalog.io.DefaultFileIOFactory; import org.apache.polaris.service.catalog.io.FileIOFactory; -import org.apache.polaris.service.config.RealmEntityManagerFactory; import org.apache.polaris.service.config.ReservedProperties; import org.apache.polaris.service.events.AfterViewCommitedEvent; import org.apache.polaris.service.events.AfterViewRefreshedEvent; @@ -115,7 +114,7 @@ public abstract class AbstractIcebergCatalogViewTest extends ViewCatalogTests<Ic @Inject MetaStoreManagerFactory metaStoreManagerFactory; @Inject UserSecretsManagerFactory userSecretsManagerFactory; @Inject PolarisConfigurationStore configurationStore; - @Inject StorageCredentialCacheConfig storageCredentialCacheConfig; + @Inject StorageCredentialCache storageCredentialCache; @Inject PolarisDiagnostics diagServices; @Inject PolarisEventListener polarisEventListener; @@ -147,6 +146,8 @@ public abstract class AbstractIcebergCatalogViewTest extends ViewCatalogTests<Ic @BeforeEach public void before(TestInfo testInfo) { + storageCredentialCache.invalidateAll(); + realmName = "realm_%s_%s" .formatted( @@ -165,14 +166,10 @@ public abstract class AbstractIcebergCatalogViewTest extends ViewCatalogTests<Ic configurationStore, Clock.systemDefaultZone()); - StorageCredentialCache storageCredentialCache = - new StorageCredentialCache(storageCredentialCacheConfig); - PolarisEntityManager entityManager = - new PolarisEntityManager( - metaStoreManager, - storageCredentialCache, - metaStoreManagerFactory.getOrCreateEntityCache( - polarisContext.getRealmContext(), polarisContext.getRealmConfig())); + EntityCache entityCache = + metaStoreManagerFactory.getOrCreateEntityCache( + polarisContext.getRealmContext(), polarisContext.getRealmConfig()); + PolarisEntityManager entityManager = new PolarisEntityManager(metaStoreManager, entityCache); CallContext.setCurrentContext(polarisContext); @@ -226,15 +223,13 @@ public abstract class AbstractIcebergCatalogViewTest extends ViewCatalogTests<Ic PolarisPassthroughResolutionView passthroughView = new PolarisPassthroughResolutionView( polarisContext, entityManager, securityContext, CATALOG_NAME); - RealmEntityManagerFactory realmEntityManagerFactory = - new RealmEntityManagerFactory( - metaStoreManagerFactory, configurationStore, storageCredentialCache); FileIOFactory fileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); testPolarisEventListener = (TestPolarisEventListener) polarisEventListener; this.catalog = new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManager, polarisContext, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java index ade4768f4..473fa2ed7 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolarisGenericTableCatalogTest.java @@ -56,6 +56,7 @@ import org.apache.polaris.core.entity.table.GenericTableEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; +import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.secrets.UserSecretsManager; import org.apache.polaris.core.secrets.UserSecretsManagerFactory; import org.apache.polaris.core.storage.PolarisStorageIntegration; @@ -63,14 +64,12 @@ import org.apache.polaris.core.storage.PolarisStorageIntegrationProvider; import org.apache.polaris.core.storage.aws.AwsCredentialsStorageIntegration; import org.apache.polaris.core.storage.aws.AwsStorageConfigurationInfo; import org.apache.polaris.core.storage.cache.StorageCredentialCache; -import org.apache.polaris.core.storage.cache.StorageCredentialCacheConfig; import org.apache.polaris.service.admin.PolarisAdminService; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; import org.apache.polaris.service.catalog.generic.PolarisGenericTableCatalog; import org.apache.polaris.service.catalog.iceberg.IcebergCatalog; import org.apache.polaris.service.catalog.io.DefaultFileIOFactory; import org.apache.polaris.service.catalog.io.FileIOFactory; -import org.apache.polaris.service.config.RealmEntityManagerFactory; import org.apache.polaris.service.config.ReservedProperties; import org.apache.polaris.service.events.NoOpPolarisEventListener; import org.apache.polaris.service.storage.PolarisStorageIntegrationProviderImpl; @@ -102,7 +101,7 @@ public abstract class AbstractPolarisGenericTableCatalogTest { @Inject MetaStoreManagerFactory metaStoreManagerFactory; @Inject UserSecretsManagerFactory userSecretsManagerFactory; @Inject PolarisConfigurationStore configurationStore; - @Inject StorageCredentialCacheConfig storageCredentialCacheConfig; + @Inject StorageCredentialCache storageCredentialCache; @Inject PolarisStorageIntegrationProvider storageIntegrationProvider; @Inject PolarisDiagnostics diagServices; @@ -138,6 +137,8 @@ public abstract class AbstractPolarisGenericTableCatalogTest { @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { + storageCredentialCache.invalidateAll(); + realmName = "realm_%s_%s" .formatted( @@ -155,14 +156,11 @@ public abstract class AbstractPolarisGenericTableCatalogTest { diagServices, configurationStore, Clock.systemDefaultZone()); - StorageCredentialCache storageCredentialCache = - new StorageCredentialCache(storageCredentialCacheConfig); - entityManager = - new PolarisEntityManager( - metaStoreManager, - storageCredentialCache, - metaStoreManagerFactory.getOrCreateEntityCache( - realmContext, polarisContext.getRealmConfig())); + + EntityCache entityCache = + metaStoreManagerFactory.getOrCreateEntityCache( + realmContext, polarisContext.getRealmConfig()); + entityManager = new PolarisEntityManager(metaStoreManager, entityCache); PrincipalEntity rootEntity = new PrincipalEntity( @@ -226,11 +224,7 @@ public abstract class AbstractPolarisGenericTableCatalogTest { new PolarisPassthroughResolutionView( polarisContext, entityManager, securityContext, CATALOG_NAME); TaskExecutor taskExecutor = Mockito.mock(); - RealmEntityManagerFactory realmEntityManagerFactory = - new RealmEntityManagerFactory( - metaStoreManagerFactory, configurationStore, storageCredentialCache); - this.fileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + this.fileIOFactory = new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); StsClient stsClient = Mockito.mock(StsClient.class); when(stsClient.assumeRole(isA(AssumeRoleRequest.class))) @@ -254,6 +248,7 @@ public abstract class AbstractPolarisGenericTableCatalogTest { this.genericTableCatalog.initialize(CATALOG_NAME, Map.of()); this.icebergCatalog = new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManager, polarisContext, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java index 42c91225f..66c2b53d5 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/AbstractPolicyCatalogTest.java @@ -64,6 +64,7 @@ import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisMetaStoreManager; import org.apache.polaris.core.persistence.PolicyMappingAlreadyExistsException; +import org.apache.polaris.core.persistence.cache.EntityCache; import org.apache.polaris.core.policy.PredefinedPolicyTypes; import org.apache.polaris.core.policy.exceptions.NoSuchPolicyException; import org.apache.polaris.core.policy.exceptions.PolicyInUseException; @@ -76,14 +77,12 @@ import org.apache.polaris.core.storage.PolarisStorageIntegrationProvider; import org.apache.polaris.core.storage.aws.AwsCredentialsStorageIntegration; import org.apache.polaris.core.storage.aws.AwsStorageConfigurationInfo; import org.apache.polaris.core.storage.cache.StorageCredentialCache; -import org.apache.polaris.core.storage.cache.StorageCredentialCacheConfig; import org.apache.polaris.service.admin.PolarisAdminService; import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView; import org.apache.polaris.service.catalog.iceberg.IcebergCatalog; import org.apache.polaris.service.catalog.io.DefaultFileIOFactory; import org.apache.polaris.service.catalog.io.FileIOFactory; import org.apache.polaris.service.catalog.policy.PolicyCatalog; -import org.apache.polaris.service.config.RealmEntityManagerFactory; import org.apache.polaris.service.config.ReservedProperties; import org.apache.polaris.service.events.NoOpPolarisEventListener; import org.apache.polaris.service.storage.PolarisStorageIntegrationProviderImpl; @@ -129,7 +128,7 @@ public abstract class AbstractPolicyCatalogTest { @Inject MetaStoreManagerFactory metaStoreManagerFactory; @Inject UserSecretsManagerFactory userSecretsManagerFactory; @Inject PolarisConfigurationStore configurationStore; - @Inject StorageCredentialCacheConfig storageCredentialCacheConfig; + @Inject StorageCredentialCache storageCredentialCache; @Inject PolarisStorageIntegrationProvider storageIntegrationProvider; @Inject PolarisDiagnostics diagServices; @@ -161,6 +160,8 @@ public abstract class AbstractPolicyCatalogTest { @BeforeEach @SuppressWarnings("unchecked") public void before(TestInfo testInfo) { + storageCredentialCache.invalidateAll(); + realmName = "realm_%s_%s" .formatted( @@ -178,14 +179,11 @@ public abstract class AbstractPolicyCatalogTest { diagServices, configurationStore, Clock.systemDefaultZone()); - StorageCredentialCache storageCredentialCache = - new StorageCredentialCache(storageCredentialCacheConfig); - entityManager = - new PolarisEntityManager( - metaStoreManager, - storageCredentialCache, - metaStoreManagerFactory.getOrCreateEntityCache( - realmContext, polarisContext.getRealmConfig())); + + EntityCache entityCache = + metaStoreManagerFactory.getOrCreateEntityCache( + realmContext, polarisContext.getRealmConfig()); + entityManager = new PolarisEntityManager(metaStoreManager, entityCache); callContext = polarisContext; @@ -249,11 +247,7 @@ public abstract class AbstractPolicyCatalogTest { new PolarisPassthroughResolutionView( callContext, entityManager, securityContext, CATALOG_NAME); TaskExecutor taskExecutor = Mockito.mock(); - RealmEntityManagerFactory realmEntityManagerFactory = - new RealmEntityManagerFactory( - metaStoreManagerFactory, configurationStore, storageCredentialCache); - this.fileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + this.fileIOFactory = new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); StsClient stsClient = Mockito.mock(StsClient.class); when(stsClient.assumeRole(isA(AssumeRoleRequest.class))) @@ -275,6 +269,7 @@ public abstract class AbstractPolicyCatalogTest { this.policyCatalog = new PolicyCatalog(metaStoreManager, callContext, passthroughView); this.icebergCatalog = new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManager, callContext, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogHandlerAuthzTest.java b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogHandlerAuthzTest.java index ccfe67da6..e275a8f9b 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogHandlerAuthzTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogHandlerAuthzTest.java @@ -1788,11 +1788,11 @@ public class IcebergCatalogHandlerAuthzTest extends PolarisAuthzTestBase { PolarisCallContextCatalogFactory factory = new PolarisCallContextCatalogFactory( + storageCredentialCache, realmEntityManagerFactory, managerFactory, - userSecretsManagerFactory, Mockito.mock(), - new DefaultFileIOFactory(realmEntityManagerFactory, managerFactory), + new DefaultFileIOFactory(storageCredentialCache, managerFactory), polarisEventListener) { @Override public Catalog createCallContextCatalog( diff --git a/service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java b/service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java index 031c3882f..5cc43e2be 100644 --- a/service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java +++ b/service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java @@ -125,6 +125,7 @@ import org.apache.polaris.core.storage.PolarisStorageActions; import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo; import org.apache.polaris.core.storage.PolarisStorageIntegration; import org.apache.polaris.core.storage.StorageLocation; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; import org.apache.polaris.service.catalog.SupportsNotifications; import org.apache.polaris.service.catalog.common.LocationUtils; import org.apache.polaris.service.catalog.io.FileIOFactory; @@ -167,6 +168,7 @@ public class IcebergCatalog extends BaseMetastoreViewCatalog }; private final PolarisEntityManager entityManager; + private final StorageCredentialCache storageCredentialCache; private final CallContext callContext; private final PolarisResolutionManifestCatalogView resolvedEntityView; private final CatalogEntity catalogEntity; @@ -188,14 +190,13 @@ public class IcebergCatalog extends BaseMetastoreViewCatalog private PolarisMetaStoreManager metaStoreManager; /** - * @param entityManager provides handle to underlying PolarisMetaStoreManager with which to - * perform mutations on entities. * @param callContext the current CallContext * @param resolvedEntityView accessor to resolved entity paths that have been pre-vetted to ensure * this catalog instance only interacts with authorized resolved paths. * @param taskExecutor Executor we use to register cleanup task handlers */ public IcebergCatalog( + StorageCredentialCache storageCredentialCache, PolarisEntityManager entityManager, PolarisMetaStoreManager metaStoreManager, CallContext callContext, @@ -205,6 +206,7 @@ public class IcebergCatalog extends BaseMetastoreViewCatalog FileIOFactory fileIOFactory, PolarisEventListener polarisEventListener) { this.entityManager = entityManager; + this.storageCredentialCache = storageCredentialCache; this.callContext = callContext; this.resolvedEntityView = resolvedEntityView; this.catalogEntity = @@ -864,7 +866,7 @@ public class IcebergCatalog extends BaseMetastoreViewCatalog } return FileIOUtil.refreshAccessConfig( callContext, - entityManager, + storageCredentialCache, getCredentialVendor(), tableIdentifier, getLocationsAllowedToBeAccessed(tableMetadata), diff --git a/service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java b/service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java index bf4b05a69..9f530d4e7 100644 --- a/service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java +++ b/service/common/src/main/java/org/apache/polaris/service/catalog/io/DefaultFileIOFactory.java @@ -35,12 +35,11 @@ import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.context.RealmContext; import org.apache.polaris.core.entity.PolarisEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; -import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper; import org.apache.polaris.core.storage.AccessConfig; import org.apache.polaris.core.storage.PolarisCredentialVendor; import org.apache.polaris.core.storage.PolarisStorageActions; -import org.apache.polaris.service.config.RealmEntityManagerFactory; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; /** * A default FileIO factory implementation for creating Iceberg {@link FileIO} instances with @@ -54,14 +53,14 @@ import org.apache.polaris.service.config.RealmEntityManagerFactory; @Identifier("default") public class DefaultFileIOFactory implements FileIOFactory { - private final RealmEntityManagerFactory realmEntityManagerFactory; + private final StorageCredentialCache storageCredentialCache; private final MetaStoreManagerFactory metaStoreManagerFactory; @Inject public DefaultFileIOFactory( - RealmEntityManagerFactory realmEntityManagerFactory, + StorageCredentialCache storageCredentialCache, MetaStoreManagerFactory metaStoreManagerFactory) { - this.realmEntityManagerFactory = realmEntityManagerFactory; + this.storageCredentialCache = storageCredentialCache; this.metaStoreManagerFactory = metaStoreManagerFactory; } @@ -75,8 +74,6 @@ public class DefaultFileIOFactory implements FileIOFactory { @Nonnull Set<PolarisStorageActions> storageActions, @Nonnull PolarisResolvedPathWrapper resolvedEntityPath) { RealmContext realmContext = callContext.getRealmContext(); - PolarisEntityManager entityManager = - realmEntityManagerFactory.getOrCreateEntityManager(realmContext); PolarisCredentialVendor credentialVendor = metaStoreManagerFactory.getOrCreateMetaStoreManager(realmContext); @@ -89,7 +86,7 @@ public class DefaultFileIOFactory implements FileIOFactory { storageInfo -> FileIOUtil.refreshAccessConfig( callContext, - entityManager, + storageCredentialCache, credentialVendor, identifier, tableLocations, diff --git a/service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOUtil.java b/service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOUtil.java index fcedcfe35..c5ef12d78 100644 --- a/service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOUtil.java +++ b/service/common/src/main/java/org/apache/polaris/service/catalog/io/FileIOUtil.java @@ -25,11 +25,11 @@ import org.apache.polaris.core.config.FeatureConfiguration; import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.entity.PolarisEntity; import org.apache.polaris.core.entity.PolarisEntityConstants; -import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper; import org.apache.polaris.core.storage.AccessConfig; import org.apache.polaris.core.storage.PolarisCredentialVendor; import org.apache.polaris.core.storage.PolarisStorageActions; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; import org.apache.polaris.service.catalog.iceberg.IcebergCatalog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +76,7 @@ public class FileIOUtil { */ public static AccessConfig refreshAccessConfig( CallContext callContext, - PolarisEntityManager entityManager, + StorageCredentialCache storageCredentialCache, PolarisCredentialVendor credentialVendor, TableIdentifier tableIdentifier, Set<String> tableLocations, @@ -105,15 +105,13 @@ public class FileIOUtil { ? tableLocations : Set.of(); AccessConfig accessConfig = - entityManager - .getCredentialCache() - .getOrGenerateSubScopeCreds( - credentialVendor, - callContext.getPolarisCallContext(), - entity, - allowList, - tableLocations, - writeLocations); + storageCredentialCache.getOrGenerateSubScopeCreds( + credentialVendor, + callContext.getPolarisCallContext(), + entity, + allowList, + tableLocations, + writeLocations); LOGGER .atDebug() .addKeyValue("tableIdentifier", tableIdentifier) diff --git a/service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java b/service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java index 0fa94ae30..048e19bb4 100644 --- a/service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java +++ b/service/common/src/main/java/org/apache/polaris/service/catalog/io/WasbTranslatingFileIOFactory.java @@ -30,7 +30,7 @@ import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper; import org.apache.polaris.core.storage.PolarisStorageActions; -import org.apache.polaris.service.config.RealmEntityManagerFactory; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; /** A {@link FileIOFactory} that translates WASB paths to ABFS ones */ @ApplicationScoped @@ -41,10 +41,10 @@ public class WasbTranslatingFileIOFactory implements FileIOFactory { @Inject public WasbTranslatingFileIOFactory( - RealmEntityManagerFactory realmEntityManagerFactory, + StorageCredentialCache storageCredentialCache, MetaStoreManagerFactory metaStoreManagerFactory) { defaultFileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); } @Override diff --git a/service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java b/service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java index af372f682..c7af1fa10 100644 --- a/service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java +++ b/service/common/src/main/java/org/apache/polaris/service/config/RealmEntityManagerFactory.java @@ -28,7 +28,6 @@ import org.apache.polaris.core.config.RealmConfigImpl; import org.apache.polaris.core.context.RealmContext; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; -import org.apache.polaris.core.storage.cache.StorageCredentialCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +39,6 @@ public class RealmEntityManagerFactory { private final MetaStoreManagerFactory metaStoreManagerFactory; private final PolarisConfigurationStore configurationStore; - private final StorageCredentialCache storageCredentialCache; // Key: realmIdentifier private final Map<String, PolarisEntityManager> cachedEntityManagers = new ConcurrentHashMap<>(); @@ -48,11 +46,9 @@ public class RealmEntityManagerFactory { @Inject public RealmEntityManagerFactory( MetaStoreManagerFactory metaStoreManagerFactory, - PolarisConfigurationStore configurationStore, - StorageCredentialCache storageCredentialCache) { + PolarisConfigurationStore configurationStore) { this.metaStoreManagerFactory = metaStoreManagerFactory; this.configurationStore = configurationStore; - this.storageCredentialCache = storageCredentialCache; } public PolarisEntityManager getOrCreateEntityManager(RealmContext context) { @@ -67,7 +63,6 @@ public class RealmEntityManagerFactory { RealmConfig realmConfig = new RealmConfigImpl(configurationStore, context); return new PolarisEntityManager( metaStoreManagerFactory.getOrCreateMetaStoreManager(context), - storageCredentialCache, metaStoreManagerFactory.getOrCreateEntityCache(context, realmConfig)); }); } diff --git a/service/common/src/main/java/org/apache/polaris/service/context/catalog/PolarisCallContextCatalogFactory.java b/service/common/src/main/java/org/apache/polaris/service/context/catalog/PolarisCallContextCatalogFactory.java index 60c505d42..dd3c04ea8 100644 --- a/service/common/src/main/java/org/apache/polaris/service/context/catalog/PolarisCallContextCatalogFactory.java +++ b/service/common/src/main/java/org/apache/polaris/service/context/catalog/PolarisCallContextCatalogFactory.java @@ -32,7 +32,7 @@ import org.apache.polaris.core.entity.PolarisBaseEntity; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisEntityManager; import org.apache.polaris.core.persistence.resolver.PolarisResolutionManifest; -import org.apache.polaris.core.secrets.UserSecretsManagerFactory; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; import org.apache.polaris.service.catalog.iceberg.IcebergCatalog; import org.apache.polaris.service.catalog.io.FileIOFactory; import org.apache.polaris.service.config.RealmEntityManagerFactory; @@ -49,21 +49,21 @@ public class PolarisCallContextCatalogFactory implements CallContextCatalogFacto private final RealmEntityManagerFactory entityManagerFactory; private final TaskExecutor taskExecutor; private final FileIOFactory fileIOFactory; + private final StorageCredentialCache storageCredentialCache; private final MetaStoreManagerFactory metaStoreManagerFactory; - private final UserSecretsManagerFactory userSecretsManagerFactory; private final PolarisEventListener polarisEventListener; @Inject public PolarisCallContextCatalogFactory( + StorageCredentialCache storageCredentialCache, RealmEntityManagerFactory entityManagerFactory, MetaStoreManagerFactory metaStoreManagerFactory, - UserSecretsManagerFactory userSecretsManagerFactory, TaskExecutor taskExecutor, FileIOFactory fileIOFactory, PolarisEventListener polarisEventListener) { this.entityManagerFactory = entityManagerFactory; + this.storageCredentialCache = storageCredentialCache; this.metaStoreManagerFactory = metaStoreManagerFactory; - this.userSecretsManagerFactory = userSecretsManagerFactory; this.taskExecutor = taskExecutor; this.fileIOFactory = fileIOFactory; this.polarisEventListener = polarisEventListener; @@ -88,6 +88,7 @@ public class PolarisCallContextCatalogFactory implements CallContextCatalogFacto IcebergCatalog catalogInstance = new IcebergCatalog( + storageCredentialCache, entityManager, metaStoreManagerFactory.getOrCreateMetaStoreManager(context.getRealmContext()), context, diff --git a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java index 34a9531d2..e0570794b 100644 --- a/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java +++ b/service/common/src/test/java/org/apache/polaris/service/catalog/io/FileIOFactoryTest.java @@ -104,9 +104,9 @@ public class FileIOFactoryTest { // Spy FileIOFactory and check if the credentials are passed to the FileIO TestServices.FileIOFactorySupplier fileIOFactorySupplier = - (entityManagerFactory, metaStoreManagerFactory) -> + (storageCredentialCache, metaStoreManagerFactory) -> Mockito.spy( - new DefaultFileIOFactory(entityManagerFactory, metaStoreManagerFactory) { + new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory) { @Override FileIO loadFileIOInternal( @Nonnull String ioImplClassName, @Nonnull Map<String, String> properties) { @@ -233,6 +233,7 @@ public class FileIOFactoryTest { CATALOG_NAME); IcebergCatalog polarisCatalog = new IcebergCatalog( + services.storageCredentialCache(), services.entityManagerFactory().getOrCreateEntityManager(realmContext), services.metaStoreManagerFactory().getOrCreateMetaStoreManager(realmContext), callContext, diff --git a/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java b/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java index 38cedd8be..8384f6ee5 100644 --- a/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java +++ b/service/common/src/testFixtures/java/org/apache/polaris/service/TestServices.java @@ -78,6 +78,7 @@ public record TestServices( IcebergCatalogAdapter catalogAdapter, PolarisConfigurationStore configurationStore, PolarisDiagnostics polarisDiagnostics, + StorageCredentialCache storageCredentialCache, RealmEntityManagerFactory entityManagerFactory, MetaStoreManagerFactory metaStoreManagerFactory, RealmContext realmContext, @@ -91,7 +92,7 @@ public record TestServices( @FunctionalInterface public interface FileIOFactorySupplier - extends BiFunction<RealmEntityManagerFactory, MetaStoreManagerFactory, FileIOFactory> {} + extends BiFunction<StorageCredentialCache, MetaStoreManagerFactory, FileIOFactory> {} private static class MockedConfigurationStore implements PolarisConfigurationStore { private final Map<String, Object> defaults; @@ -158,8 +159,7 @@ public record TestServices( StorageCredentialCache storageCredentialCache = new StorageCredentialCache(storageCredentialCacheConfig); RealmEntityManagerFactory realmEntityManagerFactory = - new RealmEntityManagerFactory( - metaStoreManagerFactory, configurationStore, storageCredentialCache); + new RealmEntityManagerFactory(metaStoreManagerFactory, configurationStore); UserSecretsManagerFactory userSecretsManagerFactory = new UnsafeInMemorySecretsManagerFactory(); @@ -180,16 +180,16 @@ public record TestServices( userSecretsManagerFactory.getOrCreateUserSecretsManager(realmContext); FileIOFactory fileIOFactory = - fileIOFactorySupplier.apply(realmEntityManagerFactory, metaStoreManagerFactory); + fileIOFactorySupplier.apply(storageCredentialCache, metaStoreManagerFactory); TaskExecutor taskExecutor = Mockito.mock(TaskExecutor.class); PolarisEventListener polarisEventListener = new TestPolarisEventListener(); CallContextCatalogFactory callContextFactory = new PolarisCallContextCatalogFactory( + storageCredentialCache, realmEntityManagerFactory, metaStoreManagerFactory, - userSecretsManagerFactory, taskExecutor, fileIOFactory, polarisEventListener); @@ -268,6 +268,7 @@ public record TestServices( catalogService, configurationStore, polarisDiagnostics, + storageCredentialCache, realmEntityManagerFactory, metaStoreManagerFactory, realmContext, diff --git a/service/common/src/testFixtures/java/org/apache/polaris/service/catalog/io/MeasuredFileIOFactory.java b/service/common/src/testFixtures/java/org/apache/polaris/service/catalog/io/MeasuredFileIOFactory.java index bdaa3e955..c4bf40ca9 100644 --- a/service/common/src/testFixtures/java/org/apache/polaris/service/catalog/io/MeasuredFileIOFactory.java +++ b/service/common/src/testFixtures/java/org/apache/polaris/service/catalog/io/MeasuredFileIOFactory.java @@ -33,7 +33,7 @@ import org.apache.polaris.core.context.CallContext; import org.apache.polaris.core.persistence.MetaStoreManagerFactory; import org.apache.polaris.core.persistence.PolarisResolvedPathWrapper; import org.apache.polaris.core.storage.PolarisStorageActions; -import org.apache.polaris.service.config.RealmEntityManagerFactory; +import org.apache.polaris.core.storage.cache.StorageCredentialCache; /** * A FileIOFactory that measures the number of bytes read, files written, and files deleted. It can @@ -53,10 +53,10 @@ public class MeasuredFileIOFactory implements FileIOFactory { @Inject public MeasuredFileIOFactory( - RealmEntityManagerFactory realmEntityManagerFactory, + StorageCredentialCache storageCredentialCache, MetaStoreManagerFactory metaStoreManagerFactory) { defaultFileIOFactory = - new DefaultFileIOFactory(realmEntityManagerFactory, metaStoreManagerFactory); + new DefaultFileIOFactory(storageCredentialCache, metaStoreManagerFactory); } @Override