danny0405 commented on a change in pull request #3928:
URL: https://github.com/apache/hudi/pull/3928#discussion_r745534162
##########
File path:
hudi-flink/src/test/java/org/apache/hudi/sink/TestWriteCopyOnWrite.java
##########
@@ -167,6 +168,28 @@ public void testUpsert() throws Exception {
.end();
}
+ @Test
+ public void testCompactionWithoutData() throws Exception {
+ // open the function and ingest data
+ conf.setString(FlinkOptions.TABLE_TYPE,
FlinkOptions.TABLE_TYPE_MERGE_ON_READ);
+ conf.setBoolean(FlinkOptions.COMPACTION_SCHEDULE_ENABLED, true);
+ conf.setInteger(FlinkOptions.COMPACTION_DELTA_COMMITS, 1);
+ TestWriteMergeOnRead.TestHarness.instance()
+ .preparePipeline(tempFile, conf)
+ .consume(TestData.DATA_SET_INSERT)
Review comment:
Why use `TestWriteMergeOnRead` in `TestWriteCopyOnWrite.java`
##########
File path:
hudi-flink/src/main/java/org/apache/hudi/sink/compact/HoodieFlinkCompactor.java
##########
@@ -75,14 +75,16 @@ public static void main(String[] args) throws Exception {
// judge whether have operation
// to compute the compaction instant time and do compaction.
if (cfg.schedule) {
- String compactionInstantTime =
CompactionUtil.getCompactionInstantTime(metaClient);
- boolean scheduled =
writeClient.scheduleCompactionAtInstant(compactionInstantTime, Option.empty());
- if (!scheduled) {
- // do nothing.
- LOG.info("No compaction plan for this job ");
- return;
+ Option<String> compactionInstantTimeOption =
CompactionUtil.getCompactionInstantTime(metaClient);
+ if (compactionInstantTimeOption.isPresent()) {
Review comment:
Why change this logic ?
##########
File path: hudi-flink/src/main/java/org/apache/hudi/util/CompactionUtil.java
##########
@@ -58,9 +79,11 @@ public static String
getCompactionInstantTime(HoodieTableMetaClient metaClient)
String firstPendingTimestamp = firstPendingInstant.get().getTimestamp();
String lastCompleteTimestamp = lastCompleteInstant.get().getTimestamp();
// Committed and pending compaction instants should have strictly lower
timestamps
- return StreamerUtil.medianInstantTime(firstPendingTimestamp,
lastCompleteTimestamp);
+ return Option.of(StreamerUtil.medianInstantTime(firstPendingTimestamp,
lastCompleteTimestamp));
+ } else if (!lastCompleteInstant.isPresent()) {
Review comment:
Why this change ? For what reason the `lastCompleteInstant` can be null ?
--
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]