You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/11/24 19:38:23 UTC
[GitHub] [hudi] vinothchandar commented on a change in pull request #4088: [HUDI-2671] Making error -> warn logs from timeline server with concurrent writers for inconsistent state
vinothchandar commented on a change in pull request #4088:
URL: https://github.com/apache/hudi/pull/4088#discussion_r756372182
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/TestHoodieMergeOnReadTable.java
##########
@@ -271,6 +282,84 @@ public void testLogFileCountsAfterCompaction(boolean populateMetaFields) throws
}
}
+ @Test
+ public void testOutOfSyncView() throws Exception {
+ // insert 100 records
+ HoodieWriteConfig.Builder cfgBuilder1 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 3)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
+ Properties properties = new Properties();
+ properties.setProperty(FILESYSTEM_LOCK_PATH_PROP_KEY, basePath() + "/.hoodie/.locks");
+ properties.setProperty(LOCK_PROVIDER_CLASS_NAME.key(), "org.apache.hudi.client.transaction.FileSystemBasedLockProviderTestClass");
+ cfgBuilder1.withProperties(properties);
+ HoodieWriteConfig config1 = cfgBuilder1.build();
+
+ HoodieWriteConfig.Builder cfgBuilder2 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 1)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
+ cfgBuilder2.withProperties(properties);
+ HoodieWriteConfig config2 = cfgBuilder2.build();
+
+ try (SparkRDDWriteClient writeClient = getHoodieWriteClient(config1);) {
Review comment:
use test table to shorten this test?
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/TestHoodieMergeOnReadTable.java
##########
@@ -271,6 +282,84 @@ public void testLogFileCountsAfterCompaction(boolean populateMetaFields) throws
}
}
+ @Test
+ public void testOutOfSyncView() throws Exception {
+ // insert 100 records
+ HoodieWriteConfig.Builder cfgBuilder1 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 3)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
+ Properties properties = new Properties();
+ properties.setProperty(FILESYSTEM_LOCK_PATH_PROP_KEY, basePath() + "/.hoodie/.locks");
+ properties.setProperty(LOCK_PROVIDER_CLASS_NAME.key(), "org.apache.hudi.client.transaction.FileSystemBasedLockProviderTestClass");
+ cfgBuilder1.withProperties(properties);
+ HoodieWriteConfig config1 = cfgBuilder1.build();
+
+ HoodieWriteConfig.Builder cfgBuilder2 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 1)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
+ cfgBuilder2.withProperties(properties);
+ HoodieWriteConfig config2 = cfgBuilder2.build();
+
+ try (SparkRDDWriteClient writeClient = getHoodieWriteClient(config1);) {
+
+ SparkRDDWriteClient writeClient1 = getHoodieWriteClient(config2);
+
+ String newCommitTime = "100";
+ writeClient.startCommitWithTime(newCommitTime);
+ //writeClient1.startCommitWithTime("101");
+
+ List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, 100);
+ JavaRDD<HoodieRecord> recordsRDD = jsc().parallelize(records, 1);
+ JavaRDD<WriteStatus> statuses = writeClient.insert(recordsRDD, newCommitTime);
+ statuses.collect();
+ //writeClient.commit(newCommitTime, statuses);
+
+ writeClient1.startCommitWithTime("101");
+ List<HoodieRecord> records1 = dataGen.generateInserts("101", 100);
+ JavaRDD<HoodieRecord> recordsRDD1 = jsc().parallelize(records1, 1);
+ JavaRDD<WriteStatus> statuses1 = writeClient1.insert(recordsRDD1, "101");
+ //statuses.collect();
+
+ writeClient.commit(newCommitTime, statuses);
+
+ metaClient.reloadActiveTimeline();
+ HoodieTable table = HoodieSparkTable.create(config1, context(), metaClient);
+ SyncableFileSystemView fileSystemView = ((SyncableFileSystemView) table.getSliceView());
+
+ writeClient1.commit("101", statuses1);
+
+ // Verify that all data file has one log file
+ metaClient.reloadActiveTimeline();
+ fileSystemView.sync();
+ String partitionPath = dataGen.getPartitionPaths()[0];
+ List<FileSlice> groupedLogFiles =
+ fileSystemView.getLatestFileSlices(partitionPath).collect(Collectors.toList());
+ for (FileSlice fileSlice : groupedLogFiles) {
+ System.out.println("Latest base file " + fileSlice.getBaseInstantTime());
Review comment:
remove?
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/TestHoodieMergeOnReadTable.java
##########
@@ -271,6 +282,84 @@ public void testLogFileCountsAfterCompaction(boolean populateMetaFields) throws
}
}
+ @Test
+ public void testOutOfSyncView() throws Exception {
Review comment:
would really love this being tested just using the timeline alone.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/TestHoodieMergeOnReadTable.java
##########
@@ -271,6 +282,84 @@ public void testLogFileCountsAfterCompaction(boolean populateMetaFields) throws
}
}
+ @Test
+ public void testOutOfSyncView() throws Exception {
+ // insert 100 records
+ HoodieWriteConfig.Builder cfgBuilder1 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 3)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
+ Properties properties = new Properties();
+ properties.setProperty(FILESYSTEM_LOCK_PATH_PROP_KEY, basePath() + "/.hoodie/.locks");
+ properties.setProperty(LOCK_PROVIDER_CLASS_NAME.key(), "org.apache.hudi.client.transaction.FileSystemBasedLockProviderTestClass");
+ cfgBuilder1.withProperties(properties);
+ HoodieWriteConfig config1 = cfgBuilder1.build();
+
+ HoodieWriteConfig.Builder cfgBuilder2 = getConfigBuilder(false, false, IndexType.BLOOM,
+ 1024 * 1024 * 1024L, HoodieClusteringConfig.newBuilder().build(), 1)
+ .withWriteConcurrencyMode(WriteConcurrencyMode.OPTIMISTIC_CONCURRENCY_CONTROL)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder().enable(false).build());
+ addConfigsForPopulateMetaFields(cfgBuilder1, true);
Review comment:
do we need this? simpler the test , relying on defaults as much as possible the better
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org