yihua commented on code in PR #13292:
URL: https://github.com/apache/hudi/pull/13292#discussion_r2112959418


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/MetadataTableNonBlockingWritesConflictResolutionStrategy.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.hudi.client.transaction;
+
+import org.apache.hudi.common.model.HoodieCommitMetadata;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.table.timeline.HoodieInstant;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieMetadataException;
+import org.apache.hudi.exception.HoodieWriteConflictException;
+import org.apache.hudi.table.HoodieTable;
+
+import java.util.stream.Stream;
+
+/**
+ * Conflict resolution strategy to be used with metadata table when NBCC is 
enabled.
+ * This resolution will not conflict any operations and let everything succeed 
the conflict resolution step.
+ */
+public class MetadataTableNonBlockingWritesConflictResolutionStrategy 
implements ConflictResolutionStrategy {

Review Comment:
   One thing to note for subsequent PRs adding the streaming write support on 
MDT: the requested time ordering can be different from completion time ordering 
in MDT after DT and MDT start transactions together (and the completion time 
order is supposed to be the same between MDT and DT, because of the DT lock).  
In this case, when reading MDT file groups, we need to make sure that the 
completion time ordering is used for merging log files.
   
   ```
      MDT DC 1 |-----------------|
      MDT DC 2      |---------|
   ```



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java:
##########
@@ -2855,8 +2864,15 @@ public Integer getWritesFileIdEncoding() {
     return props.getInteger(WRITES_FILEID_ENCODING, 
HoodieMetadataPayload.RECORD_INDEX_FIELD_FILEID_ENCODING_UUID);
   }
 
-  public boolean needResolveWriteConflict(WriteOperationType operationType) {
+  public boolean needResolveWriteConflict(WriteOperationType operationType, 
boolean isMetadataTable, HoodieWriteConfig config,
+                                          HoodieTableConfig tableConfig) {
     WriteConcurrencyMode mode = getWriteConcurrencyMode();
+    if (isMetadataTable && 
config.isStreamingWritesToMetadataEnabled(tableConfig.getTableVersion())) {
+      // for metadata table, if streaming writes are enabled, we might need to 
perform conflict resolution.
+      // datatable NBCC is still evolving and might go through evolution 
compared to its current state.
+      // But incase of metadata table, when streaming writes are enabled, we 
are just looking to let every commit succeed w/o any resolution as such.

Review Comment:
   might be better to add the check `isMetadataTable && 
config.isStreamingWritesToMetadataEnabled(tableConfig.getTableVersion())` under 
`case NON_BLOCKING_CONCURRENCY_CONTROL:` so it's easier to understand



-- 
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