Skip to content

Commit 2332f63

Browse files
authored
Simplify BaseMetaStoreManager.extractStorageConfiguration (#2194)
as a static helper method its strongly preferable to not depend on the full `PolarisCallContext` if not necessary.
1 parent 914be46 commit 2332f63

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ PolarisStorageIntegration<T> createStorageIntegrationInCurrentTxn(
679679
PolarisStorageIntegration<T> loadPolarisStorageIntegrationInCurrentTxn(
680680
@Nonnull PolarisCallContext callCtx, @Nonnull PolarisBaseEntity entity) {
681681
PolarisStorageConfigurationInfo storageConfig =
682-
BaseMetaStoreManager.extractStorageConfiguration(callCtx, entity);
682+
BaseMetaStoreManager.extractStorageConfiguration(callCtx.getDiagServices(), entity);
683683
return storageIntegrationProvider.getStorageIntegrationForConfig(storageConfig);
684684
}
685685

persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ public <T extends PolarisStorageConfigurationInfo> void persistStorageIntegratio
11201120
PolarisStorageIntegration<T> loadPolarisStorageIntegration(
11211121
@Nonnull PolarisCallContext callContext, @Nonnull PolarisBaseEntity entity) {
11221122
PolarisStorageConfigurationInfo storageConfig =
1123-
BaseMetaStoreManager.extractStorageConfiguration(callContext, entity);
1123+
BaseMetaStoreManager.extractStorageConfiguration(callContext.getDiagServices(), entity);
11241124
return storageIntegrationProvider.getStorageIntegrationForConfig(storageConfig);
11251125
}
11261126

polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,8 @@ private void revokeGrantRecord(
16081608
entityId);
16091609

16101610
PolarisStorageConfigurationInfo storageConfigurationInfo =
1611-
BaseMetaStoreManager.extractStorageConfiguration(callCtx, reloadedEntity.getEntity());
1611+
BaseMetaStoreManager.extractStorageConfiguration(
1612+
callCtx.getDiagServices(), reloadedEntity.getEntity());
16121613
try {
16131614
AccessConfig accessConfig =
16141615
storageIntegration.getSubscopedCreds(

polaris-core/src/main/java/org/apache/polaris/core/persistence/BaseMetaStoreManager.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import jakarta.annotation.Nonnull;
2525
import java.util.Map;
2626
import org.apache.polaris.core.PolarisCallContext;
27+
import org.apache.polaris.core.PolarisDiagnostics;
2728
import org.apache.polaris.core.entity.PolarisBaseEntity;
2829
import org.apache.polaris.core.entity.PolarisEntityConstants;
2930
import org.apache.polaris.core.entity.PolarisEntitySubType;
@@ -37,20 +38,18 @@ public abstract class BaseMetaStoreManager implements PolarisMetaStoreManager {
3738
private static final ObjectMapper MAPPER = new ObjectMapper();
3839

3940
public static PolarisStorageConfigurationInfo extractStorageConfiguration(
40-
@Nonnull PolarisCallContext callCtx, PolarisBaseEntity reloadedEntity) {
41+
@Nonnull PolarisDiagnostics diagnostics, PolarisBaseEntity reloadedEntity) {
4142
Map<String, String> propMap =
4243
PolarisObjectMapperUtil.deserializeProperties(reloadedEntity.getInternalProperties());
4344
String storageConfigInfoStr =
4445
propMap.get(PolarisEntityConstants.getStorageConfigInfoPropertyName());
4546

46-
callCtx
47-
.getDiagServices()
48-
.check(
49-
storageConfigInfoStr != null,
50-
"missing_storage_configuration_info",
51-
"catalogId={}, entityId={}",
52-
reloadedEntity.getCatalogId(),
53-
reloadedEntity.getId());
47+
diagnostics.check(
48+
storageConfigInfoStr != null,
49+
"missing_storage_configuration_info",
50+
"catalogId={}, entityId={}",
51+
reloadedEntity.getCatalogId(),
52+
reloadedEntity.getId());
5453
return PolarisStorageConfigurationInfo.deserialize(storageConfigInfoStr);
5554
}
5655

polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TransactionalMetaStoreManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,8 @@ private PolarisEntityResolver resolveSecurableToRoleGrant(
20552055
entityId);
20562056

20572057
PolarisStorageConfigurationInfo storageConfigurationInfo =
2058-
BaseMetaStoreManager.extractStorageConfiguration(callCtx, reloadedEntity.getEntity());
2058+
BaseMetaStoreManager.extractStorageConfiguration(
2059+
callCtx.getDiagServices(), reloadedEntity.getEntity());
20592060
try {
20602061
AccessConfig accessConfig =
20612062
storageIntegration.getSubscopedCreds(

polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TreeMapTransactionalPersistenceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ PolarisStorageIntegration<T> createStorageIntegrationInCurrentTxn(
577577
PolarisStorageIntegration<T> loadPolarisStorageIntegrationInCurrentTxn(
578578
@Nonnull PolarisCallContext callCtx, @Nonnull PolarisBaseEntity entity) {
579579
PolarisStorageConfigurationInfo storageConfig =
580-
BaseMetaStoreManager.extractStorageConfiguration(callCtx, entity);
580+
BaseMetaStoreManager.extractStorageConfiguration(callCtx.getDiagServices(), entity);
581581
return storageIntegrationProvider.getStorageIntegrationForConfig(storageConfig);
582582
}
583583

0 commit comments

Comments
 (0)