wuhainan opened a new issue, #13453: URL: https://github.com/apache/seatunnel/issues/13453
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues. ### What happened A SeaTunnel batch job on Flink finished successfully, but the destination Hive partition contained fewer rows than the source reported reading. The Hive sink used `data_save_mode = "DROP_DATA"` with parallelism greater than one, and multiple sink subtasks wrote to the same partition. The same risk applies to non-partitioned Hive tables based on code inspection. For a partitioned table, the committer clears the affected partition directory. For a non-partitioned table, it clears the entire table directory. In either case, multiple committers can clear the same directory during one job. **Expected:** After a successful batch overwrite, the target table or partition contains all rows from the current batch. **Actual:** In the observed partitioned-table run, the job reported success while the target partition contained only part of the batch. The non-partitioned case has not yet been reproduced independently. ### SeaTunnel Version SeaTunnel 3.0.0 ### SeaTunnel Config ```conf env { job.mode = "BATCH" parallelism = 2 } source { Jdbc { plugin_output = "jdbc_rows" url = "jdbc:mysql://mysql.example:3306/test" driver = "com.mysql.cj.jdbc.Driver" username = "test_user" password = "test_password" query = "SELECT id, '2026-01-01' AS dt FROM hive_overwrite_input" partition_column = "id" partition_num = 2 } } sink { Hive { table_name = "test.hive_overwrite_repro" metastore_uri = "thrift://hive-metastore.example:9083" partition_by = ["dt"] data_save_mode = "DROP_DATA" parallelism = 2 } } ``` ### Running Command ```shell ./bin/start-seatunnel-flink-20-connector-v2.sh \ --master yarn-application --deploy-mode run-application \ --config ./hive-overwrite-repro.conf ``` ### Error Exception ```log No exception was reported in the observed run. `HiveSinkAggregatedCommitter` tracks deleted directories in an instance-local `deletedTargetDirectories` set. If Committer A publishes its files before Committer B clears the same directory, B can remove A's output. The proposed fix is to coordinate cleanup and publication once per target directory for the entire batch while retaining parallel writers. The target directory can be either a partition directory or the root data directory of a non-partitioned table. - [Hive table and partition cleanup code](https://github.com/apache/seatunnel/blob/v3.0.0/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/commit/HiveSinkAggregatedCommitter.java#L193-L263) - [Flink commit adapter](https://github.com/apache/seatunnel/blob/v3.0.0/seatunnel-translation/seatunnel-translation-flink/seatunnel-translation-flink-20/src/main/java/org/apache/seatunnel/translation/flink/sink/FlinkSink.java#L86-L100) - [Related issue #10280, which covers cleanup across streaming checkpoints](https://github.com/apache/seatunnel/issues/10280) ``` ### Zeta or Flink or Spark Version flink 1.20 ### Java or Scala Version java 17 ### Screenshots _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
