HonahX commented on code in PR #1104:
URL: https://github.com/apache/polaris/pull/1104#discussion_r2013455754


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:
##########
@@ -1821,4 +1824,176 @@ public Map<String, String> getInternalPropertyMap(
     // return the result
     return new ResolvedEntityResult(entity, 
entityVersions.getGrantRecordsVersion(), grantRecords);
   }
+
+  @Override
+  public @Nonnull AttachmentResult attachPolicyToEntity(
+      @Nonnull PolarisCallContext callCtx,
+      @Nonnull List<PolarisEntityCore> targetCatalogPath,
+      @Nonnull PolarisEntityCore target,
+      @Nonnull List<PolarisEntityCore> policyCatalogPath,
+      @Nonnull PolicyEntity policy,
+      Map<String, String> parameters) {
+    // get metastore we should be using
+    BasePersistence ms = callCtx.getMetaStore();
+
+    PolicyType policyType = PolicyType.fromCode(policy.getPolicyTypeCode());
+    if (policyType == null) {
+      // This should never happen
+      return new AttachmentResult(
+          BaseResult.ReturnStatus.UNEXPECTED_ERROR_SIGNALED, "Unknown policy 
type");
+    }
+
+    // TODO: this may make it necessary to push down this logic to policy 
persistence layer

Review Comment:
   I've made a first attempt by introducing 
`checkConditionsForWriteToPolicyMappingRecordsInCurrentTxn` (suggestions on 
naming welcome) in `TransactionalPolicyMappingPersistence` to help making 
`writeToPolicyMappingRecords` atomically check for conflict for inheritable 
policyType and then persist.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to