rymurr commented on a change in pull request #1587: URL: https://github.com/apache/iceberg/pull/1587#discussion_r526098717
########## File path: nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java ########## @@ -0,0 +1,151 @@ +/* + * 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.iceberg.nessie; + +import com.dremio.nessie.client.NessieClient; +import com.dremio.nessie.error.NessieConflictException; +import com.dremio.nessie.error.NessieNotFoundException; +import com.dremio.nessie.model.Contents; +import com.dremio.nessie.model.ContentsKey; +import com.dremio.nessie.model.IcebergTable; +import com.dremio.nessie.model.ImmutableIcebergTable; +import java.util.Map; +import org.apache.hadoop.conf.Configuration; +import org.apache.iceberg.BaseMetastoreTableOperations; +import org.apache.iceberg.Snapshot; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.common.DynFields; +import org.apache.iceberg.exceptions.CommitFailedException; +import org.apache.iceberg.exceptions.NoSuchTableException; +import org.apache.iceberg.hadoop.HadoopFileIO; +import org.apache.iceberg.io.FileIO; + +/** + * Nessie implementation of Iceberg TableOperations. + */ +public class NessieTableOperations extends BaseMetastoreTableOperations { + + private static DynFields.StaticField<Object> sparkEnvMethod; + private static DynFields.UnboundField<Object> sparkConfMethod; + private static DynFields.UnboundField<Object> appIdMethod; + private final Configuration conf; + private final NessieClient client; + private final ContentsKey key; + private UpdateableReference reference; + private IcebergTable table; + private HadoopFileIO fileIO; + + /** + * Create a nessie table operations given a table identifier. + */ + public NessieTableOperations( + Configuration conf, + ContentsKey key, + UpdateableReference reference, + NessieClient client) { + this.conf = conf; + this.key = key; + this.reference = reference; + this.client = client; + } + + @Override + protected void doRefresh() { + // break reference with parent (to avoid cross-over refresh) + // TODO, confirm this is correct behavior. + // reference = reference.copy(); Review comment: Yes and no, but the option should at least be there. However I think doing this properly is a bigger question. Whether to refresh depends on the isolation level and the use case. Currently if two tables were modified by a different process on the same branch and an iceberg client, who had both those tables cached, committed to only one then the two tables would be out of sync on that iceberg client. But I think that would be true if they were using Hive or Hadoop also, correct? I think rather than addressing this use case in here it would be better to have a wider discussion on how to handle consistency across iceberg catalogs. Thoughts? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
