lvyanquan commented on code in PR #3639: URL: https://github.com/apache/flink-cdc/pull/3639#discussion_r1804467910
########## flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-paimon/src/test/java/org/apache/flink/cdc/connectors/paimon/sink/v2/PaimonSinkITCase.java: ########## @@ -454,6 +454,46 @@ public void testSinkWithMultiTables(String metastore) Collections.singletonList(Row.ofKind(RowKind.INSERT, "1", "1")), result); } + @ParameterizedTest + @ValueSource(strings = {"filesystem", "hive"}) + public void testDuplicateCommitAfterRestore(String metastore) + throws IOException, InterruptedException, Catalog.DatabaseNotEmptyException, + Catalog.DatabaseNotExistException, SchemaEvolveException { + initialize(metastore); + PaimonSink<Event> paimonSink = + new PaimonSink<>( + catalogOptions, new PaimonRecordEventSerializer(ZoneId.systemDefault())); + PaimonWriter<Event> writer = paimonSink.createWriter(new MockInitContext()); + Committer<MultiTableCommittable> committer = paimonSink.createCommitter(); + + // insert + for (Event event : createTestEvents()) { + writer.write(event, null); + } + writer.flush(false); + Collection<Committer.CommitRequest<MultiTableCommittable>> commitRequests = + writer.prepareCommit().stream() + .map(MockCommitRequestImpl::new) + .collect(Collectors.toList()); + committer.commit(commitRequests); + + // We've two steps in checkpoint: 1. snapshotState(ckp); 2. notifyCheckpointComplete(ckp). + // It's possible that flink job will restore from a checkpoint with only step#1 finished and + // step#2 not. + // CommitterOperator will try to re-commit recovered transactions. + committer.commit(commitRequests); Review Comment: Considering there is another issue https://issues.apache.org/jira/browse/FLINK-36541 in PaimonWriter, If there is a problem with adding this loop, you can skip it for now. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org