collado-mike commented on code in PR #238:
URL: https://github.com/apache/polaris/pull/238#discussion_r1761984285


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/TransactionWorkspaceMetaStoreManager.java:
##########
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.persistence;
+
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.polaris.core.PolarisCallContext;
+import org.apache.polaris.core.entity.PolarisBaseEntity;
+import org.apache.polaris.core.entity.PolarisEntity;
+import org.apache.polaris.core.entity.PolarisEntityCore;
+import org.apache.polaris.core.entity.PolarisEntityId;
+import org.apache.polaris.core.entity.PolarisEntitySubType;
+import org.apache.polaris.core.entity.PolarisEntityType;
+import org.apache.polaris.core.entity.PolarisPrivilege;
+import org.apache.polaris.core.storage.PolarisStorageActions;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Wraps an existing impl of PolarisMetaStoreManager and delegates expected 
"read" operations
+ * through to the wrapped instance while throwing errors on unexpected 
operations or enqueuing
+ * expected write operations into a collection to be committed as a single 
atomic unit.
+ *
+ * <p>Note that as long as the server-side multi-commit transaction semantics 
are effectively only
+ * SERIALIZABLE isolation (i.e. if we can resolve all UpdateRequirements 
"statically" before the set
+ * of commits and translate these into an atomic collection of 
compare-and-swap operations to apply
+ * the transaction), this workspace should also reject readEntity/loadEntity 
operations to avoid
+ * implying that any reads from this transaction workspace include writes 
performed into this
+ * transaction workspace that haven't yet been committed.
+ *
+ * <p>Not thread-safe; instances should only be used within a single request 
context and should not
+ * be reused between requests.
+ */
+public class TransactionWorkspaceMetaStoreManager implements 
PolarisMetaStoreManager {

Review Comment:
   Sorry for the delay. This makes a ton of sense - I hadn't really been 
thinking about non-Iceberg entities, so supporting updates for Principals, etc. 
makes sense. I do like the premise that we can update this tx workspace to 
support uncommitted reads later on (maybe worth including as a comment in the 
code?).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to