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


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndex.scala:
##########
@@ -144,6 +149,56 @@ class TestPartitionStatsIndex extends 
PartitionStatsIndexTestBase {
     verifyQueryPredicate(hudiOpts)
   }
 
+  /**
+   * Test case to do a write with updates and then validate partition stats 
with multi-writer.
+   */
+  @ParameterizedTest
+  @EnumSource(classOf[HoodieTableType])
+  def testPartitionStatsWithMultiWriter(tableType: HoodieTableType): Unit = {
+    val hudiOpts = commonOpts ++ Map(
+      DataSourceWriteOptions.TABLE_TYPE.key -> tableType.name(),
+      HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key() -> 
"optimistic_concurrency_control",
+      HoodieCleanConfig.FAILED_WRITES_CLEANER_POLICY.key() -> "LAZY",
+      HoodieLockConfig.LOCK_PROVIDER_CLASS_NAME.key() -> 
"org.apache.hudi.client.transaction.lock.FileSystemBasedLockProvider",

Review Comment:
   Should `InProcessLockProvider` be used since `FileSystemBasedLockProvider` 
cannot guarantee atomicity with local file system?



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestSecondaryIndexPruning.scala:
##########
@@ -316,6 +320,114 @@ class TestSecondaryIndexPruning extends 
SparkClientFunctionalTestHarness {
     }
   }
 
+  /**
+   * Test case to do a write with updates and validate secondary index with 
multiple writers (only one of them creates secondary index).
+   */
+  @Test
+  def testSecondaryIndexWithConcurrentWrites(): Unit = {
+    if (HoodieSparkUtils.gteqSpark3_3) {
+      val tableName = "hudi_multi_writer_table"
+
+      // Common Hudi options
+      val hudiOpts = Map(
+        "hoodie.table.name" -> tableName,
+        "hoodie.datasource.write.recordkey.field" -> "record_key_col",
+        "hoodie.datasource.write.precombine.field" -> "ts",
+        "hoodie.datasource.write.operation" -> "upsert",
+        "hoodie.upsert.shuffle.parallelism" -> "2",
+        "hoodie.insert.shuffle.parallelism" -> "2",
+        "hoodie.metadata.enable" -> "true",
+        "hoodie.metadata.record.index.enable" -> "true",
+        "hoodie.enable.data.skipping" -> "true",
+        "hoodie.parquet.small.file.limit" -> "0",
+        HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key -> 
"optimistic_concurrency_control",
+        HoodieLockConfig.WRITE_CONFLICT_RESOLUTION_STRATEGY_CLASS_NAME.key() 
-> classOf[PreferWriterConflictResolutionStrategy].getName

Review Comment:
   Use `SimpleConcurrentFileWritesConflictResolutionStrategy`



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