diff --git a/persistence/eclipselink/src/test/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreManagerTest.java b/persistence/eclipselink/src/test/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreManagerTest.java index aa3a6a3d553..d2cb37fecd3 100644 --- a/persistence/eclipselink/src/test/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreManagerTest.java +++ b/persistence/eclipselink/src/test/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreManagerTest.java @@ -88,7 +88,7 @@ protected PolarisTestMetaStoreManager createPolarisTestMetaStoreManager() { new PolarisEclipseLinkMetaStoreSessionImpl( store, Mockito.mock(), realmContext, null, "polaris", RANDOM_SECRETS); TransactionalMetaStoreManagerImpl metaStoreManager = - new TransactionalMetaStoreManagerImpl(clock); + new TransactionalMetaStoreManagerImpl(clock, diagServices); PolarisCallContext callCtx = new PolarisCallContext(realmContext, session, diagServices); return new PolarisTestMetaStoreManager(metaStoreManager, callCtx); } 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 ea247fdfb5d..c6693884255 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 @@ -89,7 +89,7 @@ protected PrincipalSecretsGenerator secretsGenerator( * into the existing realm-based setup flow. */ protected PolarisMetaStoreManager createNewMetaStoreManager(Clock clock) { - return new TransactionalMetaStoreManagerImpl(clock); + return new TransactionalMetaStoreManagerImpl(clock, diagnostics); } private void initializeForRealm( diff --git a/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java b/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java index 50ebc52a788..d2d92037d23 100644 --- a/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java +++ b/polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java @@ -32,6 +32,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.apache.polaris.core.PolarisCallContext; +import org.apache.polaris.core.PolarisDiagnostics; import org.apache.polaris.core.entity.AsyncTaskType; import org.apache.polaris.core.entity.EntityNameLookupRecord; import org.apache.polaris.core.entity.LocationBasedEntity; @@ -89,9 +90,11 @@ public class TransactionalMetaStoreManagerImpl extends BaseMetaStoreManager { LoggerFactory.getLogger(TransactionalMetaStoreManagerImpl.class); private final Clock clock; + private final PolarisDiagnostics diagnostics; - public TransactionalMetaStoreManagerImpl(Clock clock) { + public TransactionalMetaStoreManagerImpl(Clock clock, PolarisDiagnostics diagnostics) { this.clock = clock; + this.diagnostics = diagnostics; } /** @@ -166,11 +169,11 @@ private void dropEntity( @Nonnull PolarisBaseEntity entity) { // validate the entity type and subtype - callCtx.getDiagServices().checkNotNull(entity, "unexpected_null_dpo"); - callCtx.getDiagServices().checkNotNull(entity.getName(), "unexpected_null_name"); + diagnostics.checkNotNull(entity, "unexpected_null_dpo"); + diagnostics.checkNotNull(entity.getName(), "unexpected_null_name"); // creation timestamp must be filled - callCtx.getDiagServices().check(entity.getDropTimestamp() == 0, "already_dropped"); + diagnostics.check(entity.getDropTimestamp() == 0, "already_dropped"); // for now drop all associated grants, etc. synchronously // delete ALL grant records to (if the entity is a grantee) and from that entity @@ -268,14 +271,13 @@ private void dropEntity( @Nonnull PolarisPrivilege priv) { // validate non null arguments - callCtx.getDiagServices().checkNotNull(securable, "unexpected_null_securable"); - callCtx.getDiagServices().checkNotNull(grantee, "unexpected_null_grantee"); - callCtx.getDiagServices().checkNotNull(priv, "unexpected_null_priv"); + diagnostics.checkNotNull(securable, "unexpected_null_securable"); + diagnostics.checkNotNull(grantee, "unexpected_null_grantee"); + diagnostics.checkNotNull(priv, "unexpected_null_priv"); // ensure that this entity is indeed a grantee like entity - callCtx - .getDiagServices() - .check(grantee.getType().isGrantee(), "entity_must_be_grantee", "entity={}", grantee); + diagnostics.check( + grantee.getType().isGrantee(), "entity_must_be_grantee", "entity={}", grantee); // create new grant record PolarisGrantRecord grantRecord = @@ -294,9 +296,7 @@ private void dropEntity( PolarisBaseEntity granteeEntity = ms.lookupEntityInCurrentTxn( callCtx, grantee.getCatalogId(), grantee.getId(), grantee.getTypeCode()); - callCtx - .getDiagServices() - .checkNotNull(granteeEntity, "grantee_not_found", "grantee={}", grantee); + diagnostics.checkNotNull(granteeEntity, "grantee_not_found", "grantee={}", grantee); // grants have changed, we need to bump-up the grants version PolarisBaseEntity updatedGranteeEntity = granteeEntity.withGrantRecordsVersion(granteeEntity.getGrantRecordsVersion() + 1); @@ -307,9 +307,7 @@ private void dropEntity( PolarisBaseEntity securableEntity = ms.lookupEntityInCurrentTxn( callCtx, securable.getCatalogId(), securable.getId(), securable.getTypeCode()); - callCtx - .getDiagServices() - .checkNotNull(securableEntity, "securable_not_found", "securable={}", securable); + diagnostics.checkNotNull(securableEntity, "securable_not_found", "securable={}", securable); // grants have changed, we need to bump-up the grants version PolarisBaseEntity updatedSecurableEntity = new PolarisBaseEntity.Builder(securableEntity) @@ -342,31 +340,25 @@ private void revokeGrantRecord( @Nonnull PolarisGrantRecord grantRecord) { // validate securable - callCtx - .getDiagServices() - .check( - securable.getCatalogId() == grantRecord.getSecurableCatalogId() - && securable.getId() == grantRecord.getSecurableId(), - "securable_mismatch", - "securable={} grantRec={}", - securable, - grantRecord); + diagnostics.check( + securable.getCatalogId() == grantRecord.getSecurableCatalogId() + && securable.getId() == grantRecord.getSecurableId(), + "securable_mismatch", + "securable={} grantRec={}", + securable, + grantRecord); // validate grantee - callCtx - .getDiagServices() - .check( - grantee.getCatalogId() == grantRecord.getGranteeCatalogId() - && grantee.getId() == grantRecord.getGranteeId(), - "grantee_mismatch", - "grantee={} grantRec={}", - grantee, - grantRecord); + diagnostics.check( + grantee.getCatalogId() == grantRecord.getGranteeCatalogId() + && grantee.getId() == grantRecord.getGranteeId(), + "grantee_mismatch", + "grantee={} grantRec={}", + grantee, + grantRecord); // ensure the grantee is really a grantee - callCtx - .getDiagServices() - .check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); + diagnostics.check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); // remove that grant ms.deleteFromGrantRecordsInCurrentTxn(callCtx, grantRecord); @@ -375,10 +367,8 @@ private void revokeGrantRecord( PolarisBaseEntity refreshGrantee = ms.lookupEntityInCurrentTxn( callCtx, grantee.getCatalogId(), grantee.getId(), grantee.getTypeCode()); - callCtx - .getDiagServices() - .checkNotNull( - refreshGrantee, "missing_grantee", "grantRecord={} grantee={}", grantRecord, grantee); + diagnostics.checkNotNull( + refreshGrantee, "missing_grantee", "grantRecord={} grantee={}", grantRecord, grantee); // grants have changed, we need to bump-up the grants version PolarisBaseEntity updatedRefreshGrantee = refreshGrantee.withGrantRecordsVersion(refreshGrantee.getGrantRecordsVersion() + 1); @@ -389,14 +379,12 @@ private void revokeGrantRecord( PolarisBaseEntity refreshSecurable = ms.lookupEntityInCurrentTxn( callCtx, securable.getCatalogId(), securable.getId(), securable.getTypeCode()); - callCtx - .getDiagServices() - .checkNotNull( - refreshSecurable, - "missing_securable", - "grantRecord={} securable={}", - grantRecord, - securable); + diagnostics.checkNotNull( + refreshSecurable, + "missing_securable", + "grantRecord={} securable={}", + grantRecord, + securable); // grants have changed, we need to bump-up the grants version PolarisBaseEntity updatedRefreshSecurable = refreshSecurable.withGrantRecordsVersion(refreshSecurable.getGrantRecordsVersion() + 1); @@ -428,7 +416,7 @@ private void revokeGrantRecord( @Nullable PolarisStorageIntegration integration, @Nonnull List principalRoles) { // validate input - callCtx.getDiagServices().checkNotNull(catalog, "unexpected_null_catalog"); + diagnostics.checkNotNull(catalog, "unexpected_null_catalog"); // check if that catalog has already been created PolarisBaseEntity refreshCatalog = @@ -438,13 +426,11 @@ private void revokeGrantRecord( // if found, probably a retry, simply return the previously created catalog if (refreshCatalog != null) { // if found, ensure it is indeed a catalog - callCtx - .getDiagServices() - .check( - refreshCatalog.getTypeCode() == PolarisEntityType.CATALOG.getCode(), - "not_a_catalog", - "catalog={}", - catalog); + diagnostics.check( + refreshCatalog.getTypeCode() == PolarisEntityType.CATALOG.getCode(), + "not_a_catalog", + "catalog={}", + catalog); // lookup catalog admin role, should exist PolarisBaseEntity catalogAdminRole = @@ -456,10 +442,8 @@ private void revokeGrantRecord( PolarisEntityConstants.getNameOfCatalogAdminRole()); // if found, ensure not null - callCtx - .getDiagServices() - .checkNotNull( - catalogAdminRole, "catalog_admin_role_not_found", "catalog={}", refreshCatalog); + diagnostics.checkNotNull( + catalogAdminRole, "catalog_admin_role_not_found", "catalog={}", refreshCatalog); // done, return the existing catalog return new CreateCatalogResult(refreshCatalog, catalogAdminRole); @@ -513,21 +497,19 @@ private void revokeGrantRecord( PolarisEntityConstants.getRootEntityId(), PolarisEntityType.PRINCIPAL_ROLE.getCode(), PolarisEntityConstants.getNameOfPrincipalServiceAdminRole()); - callCtx.getDiagServices().checkNotNull(serviceAdminRole, "missing_service_admin_role"); + diagnostics.checkNotNull(serviceAdminRole, "missing_service_admin_role"); this.persistNewGrantRecord( callCtx, ms, adminRole, serviceAdminRole, PolarisPrivilege.CATALOG_ROLE_USAGE); } else { // grant to each principal role usage on its catalog_admin role for (PolarisEntityCore principalRole : principalRoles) { // validate not null and really a principal role - callCtx.getDiagServices().checkNotNull(principalRole, "null principal role"); - callCtx - .getDiagServices() - .check( - principalRole.getTypeCode() == PolarisEntityType.PRINCIPAL_ROLE.getCode(), - "not_principal_role", - "type={}", - principalRole.getType()); + diagnostics.checkNotNull(principalRole, "null principal role"); + diagnostics.check( + principalRole.getTypeCode() == PolarisEntityType.PRINCIPAL_ROLE.getCode(), + "not_principal_role", + "type={}", + principalRole.getType()); // grant usage on that catalog admin role to this principal this.persistNewGrantRecord( @@ -744,7 +726,7 @@ private void bootstrapPolarisService( @Nonnull TransactionalPersistence ms, @Nonnull PolarisBaseEntity principal) { // validate input - callCtx.getDiagServices().checkNotNull(principal, "unexpected_null_principal"); + diagnostics.checkNotNull(principal, "unexpected_null_principal"); // check if that catalog has already been created PolarisBaseEntity refreshPrincipal = @@ -754,13 +736,11 @@ private void bootstrapPolarisService( // if found, probably a retry, simply return the previously created principal if (refreshPrincipal != null) { // if found, ensure it is indeed a principal - callCtx - .getDiagServices() - .check( - principal.getTypeCode() == PolarisEntityType.PRINCIPAL.getCode(), - "not_a_principal", - "principal={}", - principal); + diagnostics.check( + principal.getTypeCode() == PolarisEntityType.PRINCIPAL.getCode(), + "not_a_principal", + "principal={}", + principal); // get internal properties Map properties = @@ -770,35 +750,26 @@ private void bootstrapPolarisService( String clientId = properties.get(PolarisEntityConstants.getClientIdPropertyName()); // should not be null - callCtx - .getDiagServices() - .checkNotNull( - clientId, - "null_client_id", - "properties={}", - refreshPrincipal.getInternalProperties()); + diagnostics.checkNotNull( + clientId, "null_client_id", "properties={}", refreshPrincipal.getInternalProperties()); // ensure non null and non empty - callCtx - .getDiagServices() - .check( - !clientId.isEmpty(), - "empty_client_id", - "properties={}", - refreshPrincipal.getInternalProperties()); + diagnostics.check( + !clientId.isEmpty(), + "empty_client_id", + "properties={}", + refreshPrincipal.getInternalProperties()); // get the main and secondary secrets for that client PolarisPrincipalSecrets principalSecrets = ms.loadPrincipalSecretsInCurrentTxn(callCtx, clientId); // should not be null - callCtx - .getDiagServices() - .checkNotNull( - principalSecrets, - "missing_principal_secrets", - "clientId={} principal={}", - clientId, - refreshPrincipal); + diagnostics.checkNotNull( + principalSecrets, + "missing_principal_secrets", + "clientId={} principal={}", + clientId, + refreshPrincipal); // done, return the newly created principal return new CreatePrincipalResult(refreshPrincipal, principalSecrets); @@ -990,10 +961,10 @@ private void bootstrapPolarisService( @Nonnull PolarisBaseEntity entity) { // entity cannot be null - callCtx.getDiagServices().checkNotNull(entity, "unexpected_null_entity"); + diagnostics.checkNotNull(entity, "unexpected_null_entity"); // entity name must be specified - callCtx.getDiagServices().checkNotNull(entity.getName(), "unexpected_null_entity_name"); + diagnostics.checkNotNull(entity.getName(), "unexpected_null_entity_name"); // first, check if the entity has already been created, in which case we will simply return it PolarisBaseEntity entityFound = @@ -1085,7 +1056,7 @@ private void bootstrapPolarisService( @Nullable List catalogPath, @Nonnull PolarisBaseEntity entity) { // entity cannot be null - callCtx.getDiagServices().checkNotNull(entity, "unexpected_null_entity"); + diagnostics.checkNotNull(entity, "unexpected_null_entity"); // re-resolve everything including that entity PolarisEntityResolver resolver = new PolarisEntityResolver(callCtx, ms, catalogPath, entity); @@ -1099,9 +1070,7 @@ private void bootstrapPolarisService( PolarisBaseEntity entityRefreshed = ms.lookupEntityInCurrentTxn( callCtx, entity.getCatalogId(), entity.getId(), entity.getTypeCode()); - callCtx - .getDiagServices() - .checkNotNull(entityRefreshed, "unexpected_entity_not_found", "entity={}", entity); + diagnostics.checkNotNull(entityRefreshed, "unexpected_entity_not_found", "entity={}", entity); // check that the version of the entity has not changed at all to avoid concurrent updates if (entityRefreshed.getEntityVersion() != entity.getEntityVersion()) { @@ -1152,7 +1121,7 @@ private void bootstrapPolarisService( @Nonnull TransactionalPersistence ms, @Nonnull List entities) { // ensure that the entities list is not null - callCtx.getDiagServices().checkNotNull(entities, "unexpected_null_entities"); + diagnostics.checkNotNull(entities, "unexpected_null_entities"); // list of all updated entities List updatedEntities = new ArrayList<>(entities.size()); @@ -1204,16 +1173,14 @@ private void bootstrapPolarisService( @Nonnull PolarisBaseEntity renamedEntity) { // entity and new name cannot be null - callCtx.getDiagServices().checkNotNull(entityToRename, "unexpected_null_entityToRename"); - callCtx.getDiagServices().checkNotNull(renamedEntity, "unexpected_null_renamedEntity"); + diagnostics.checkNotNull(entityToRename, "unexpected_null_entityToRename"); + diagnostics.checkNotNull(renamedEntity, "unexpected_null_renamedEntity"); // if a new catalog path is specified (i.e. re-parent operation), a catalog path should be // specified too - callCtx - .getDiagServices() - .check( - (newCatalogPath == null) || (catalogPath != null), - "newCatalogPath_specified_without_catalogPath"); + diagnostics.check( + (newCatalogPath == null) || (catalogPath != null), + "newCatalogPath_specified_without_catalogPath"); // null is shorthand for saying the path isn't changing if (newCatalogPath == null) { @@ -1334,7 +1301,7 @@ private void bootstrapPolarisService( @Nullable Map cleanupProperties, boolean cleanup) { // entity cannot be null - callCtx.getDiagServices().checkNotNull(entityToDrop, "unexpected_null_entity"); + diagnostics.checkNotNull(entityToDrop, "unexpected_null_entity"); // re-resolve everything including that entity PolarisEntityResolver resolver = @@ -1491,29 +1458,25 @@ private void bootstrapPolarisService( @Nonnull PolarisEntityCore grantee) { // validate the grantee input - callCtx.getDiagServices().checkNotNull(grantee, "unexpected_null_grantee"); - callCtx - .getDiagServices() - .check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); + diagnostics.checkNotNull(grantee, "unexpected_null_grantee"); + diagnostics.check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); // validate role - callCtx.getDiagServices().checkNotNull(role, "unexpected_null_role"); + diagnostics.checkNotNull(role, "unexpected_null_role"); // role should be a catalog or a principal role boolean isCatalogRole = role.getTypeCode() == PolarisEntityType.CATALOG_ROLE.getCode(); boolean isPrincipalRole = role.getTypeCode() == PolarisEntityType.PRINCIPAL_ROLE.getCode(); - callCtx.getDiagServices().check(isCatalogRole || isPrincipalRole, "not_a_role"); + diagnostics.check(isCatalogRole || isPrincipalRole, "not_a_role"); // if the role is a catalog role, ensure a catalog is specified and // vice-versa, catalog should be null if the role is a principal role - callCtx - .getDiagServices() - .check( - (catalog == null && isPrincipalRole) || (catalog != null && isCatalogRole), - "catalog_mismatch", - "catalog={} role={}", - catalog, - role); + diagnostics.check( + (catalog == null && isPrincipalRole) || (catalog != null && isCatalogRole), + "catalog_mismatch", + "catalog={} role={}", + catalog, + role); // re-resolve now all these entities List otherTopLevelEntities = new ArrayList<>(2); @@ -1540,16 +1503,14 @@ private PolarisEntityResolver resolveSecurableToRoleGrant( @Nullable List catalogPath, @Nonnull PolarisEntityCore securable) { // validate role input - callCtx.getDiagServices().checkNotNull(grantee, "unexpected_null_grantee"); - callCtx - .getDiagServices() - .check(grantee.getType().isGrantee(), "not_grantee_type", "grantee={}", grantee); + diagnostics.checkNotNull(grantee, "unexpected_null_grantee"); + diagnostics.check(grantee.getType().isGrantee(), "not_grantee_type", "grantee={}", grantee); // securable must be supplied - callCtx.getDiagServices().checkNotNull(securable, "unexpected_null_securable"); + diagnostics.checkNotNull(securable, "unexpected_null_securable"); if (securable.getCatalogId() > 0) { // catalogPath must be supplied if the securable has a catalogId - callCtx.getDiagServices().checkNotNull(catalogPath, "unexpected_null_catalogPath"); + diagnostics.checkNotNull(catalogPath, "unexpected_null_catalogPath"); } // re-resolve now all these entities @@ -1583,9 +1544,7 @@ private PolarisEntityResolver resolveSecurableToRoleGrant( : PolarisPrivilege.PRINCIPAL_ROLE_USAGE; // grant usage on this role to this principal - callCtx - .getDiagServices() - .check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); + diagnostics.check(grantee.getType().isGrantee(), "not_a_grantee", "grantee={}", grantee); PolarisGrantRecord grantRecord = this.persistNewGrantRecord(callCtx, ms, role, grantee, usagePriv); return new PrivilegeResult(grantRecord); @@ -2027,11 +1986,9 @@ private PolarisEntityResolver resolveSecurableToRoleGrant( // get meta store session we should be using TransactionalPersistence ms = ((TransactionalPersistence) callCtx.getMetaStore()); - callCtx - .getDiagServices() - .check( - !allowedReadLocations.isEmpty() || !allowedWriteLocations.isEmpty(), - "allowed_locations_to_subscope_is_required"); + diagnostics.check( + !allowedReadLocations.isEmpty() || !allowedWriteLocations.isEmpty(), + "allowed_locations_to_subscope_is_required"); // reload the entity, error out if not found EntityResult reloadedEntity = loadEntity(callCtx, catalogId, entityId, entityType); @@ -2045,14 +2002,12 @@ private PolarisEntityResolver resolveSecurableToRoleGrant( ms.loadPolarisStorageIntegrationInCurrentTxn(callCtx, reloadedEntity.getEntity()); // cannot be null - callCtx - .getDiagServices() - .checkNotNull( - storageIntegration, - "storage_integration_not_exists", - "catalogId={}, entityId={}", - catalogId, - entityId); + diagnostics.checkNotNull( + storageIntegration, + "storage_integration_not_exists", + "catalogId={}, entityId={}", + catalogId, + entityId); try { AccessConfig accessConfig = @@ -2505,8 +2460,8 @@ private LoadPolicyMappingsResult doLoadPoliciesOnEntityByType( @Nonnull PolarisEntityCore target, @Nonnull PolicyEntity policy, Map parameters) { - callCtx.getDiagServices().checkNotNull(target, "unexpected_null_target"); - callCtx.getDiagServices().checkNotNull(policy, "unexpected_null_policy"); + diagnostics.checkNotNull(target, "unexpected_null_target"); + diagnostics.checkNotNull(policy, "unexpected_null_policy"); PolarisPolicyMappingRecord mappingRecord = new PolarisPolicyMappingRecord( diff --git a/polaris-core/src/test/java/org/apache/polaris/core/persistence/PolarisTreeMapMetaStoreManagerTest.java b/polaris-core/src/test/java/org/apache/polaris/core/persistence/PolarisTreeMapMetaStoreManagerTest.java index 41030b01469..d1d3b8de02a 100644 --- a/polaris-core/src/test/java/org/apache/polaris/core/persistence/PolarisTreeMapMetaStoreManagerTest.java +++ b/polaris-core/src/test/java/org/apache/polaris/core/persistence/PolarisTreeMapMetaStoreManagerTest.java @@ -34,7 +34,7 @@ public PolarisTestMetaStoreManager createPolarisTestMetaStoreManager() { PolarisDiagnostics diagServices = new PolarisDefaultDiagServiceImpl(); TreeMapMetaStore store = new TreeMapMetaStore(diagServices); TransactionalMetaStoreManagerImpl metaStoreManager = - new TransactionalMetaStoreManagerImpl(clock); + new TransactionalMetaStoreManagerImpl(clock, diagServices); PolarisCallContext callCtx = new PolarisCallContext( () -> "testRealm", diff --git a/polaris-core/src/test/java/org/apache/polaris/core/persistence/ResolverTest.java b/polaris-core/src/test/java/org/apache/polaris/core/persistence/ResolverTest.java index ba7b202fef3..37e66499ba6 100644 --- a/polaris-core/src/test/java/org/apache/polaris/core/persistence/ResolverTest.java +++ b/polaris-core/src/test/java/org/apache/polaris/core/persistence/ResolverTest.java @@ -31,6 +31,7 @@ public class ResolverTest extends BaseResolverTest { private final Clock clock = Clock.systemUTC(); + private final PolarisDefaultDiagServiceImpl diagServices = new PolarisDefaultDiagServiceImpl(); private PolarisCallContext callCtx; private PolarisTestMetaStoreManager tm; private TransactionalMetaStoreManagerImpl metaStoreManager; @@ -38,7 +39,6 @@ public class ResolverTest extends BaseResolverTest { @Override protected PolarisCallContext callCtx() { if (callCtx == null) { - PolarisDefaultDiagServiceImpl diagServices = new PolarisDefaultDiagServiceImpl(); TreeMapMetaStore store = new TreeMapMetaStore(diagServices); TreeMapTransactionalPersistenceImpl metaStore = new TreeMapTransactionalPersistenceImpl(store, Mockito.mock(), RANDOM_SECRETS); @@ -50,7 +50,7 @@ protected PolarisCallContext callCtx() { @Override protected PolarisMetaStoreManager metaStoreManager() { if (metaStoreManager == null) { - metaStoreManager = new TransactionalMetaStoreManagerImpl(clock); + metaStoreManager = new TransactionalMetaStoreManagerImpl(clock, diagServices); } return metaStoreManager; } diff --git a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java index 1184e55a0fe..628a4b29127 100644 --- a/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java +++ b/polaris-core/src/test/java/org/apache/polaris/core/persistence/cache/InMemoryEntityCacheTest.java @@ -80,7 +80,7 @@ public InMemoryEntityCacheTest() { TreeMapMetaStore store = new TreeMapMetaStore(diagServices); TransactionalPersistence metaStore = new TreeMapTransactionalPersistenceImpl(store, Mockito.mock(), RANDOM_SECRETS); - metaStoreManager = new TransactionalMetaStoreManagerImpl(Clock.systemUTC()); + metaStoreManager = new TransactionalMetaStoreManagerImpl(Clock.systemUTC(), diagServices); callCtx = new PolarisCallContext(() -> "testRealm", metaStore, diagServices); // bootstrap the meta store with our test schema