smiralexan opened a new issue, #20808: URL: https://github.com/apache/hudi/issues/20808
### Bug Description **What happened:** `Pipelines.opUID` numbers operators with a static, JVM-wide counter that is never reset: https://github.com/apache/hudi/blob/829f07163989b6a6af9372123ac59975e99ca170/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/utils/Pipelines.java#L804-L807 Sink and source operators take their uids from it, e.g. the streaming source: https://github.com/apache/hudi/blob/829f07163989b6a6af9372123ac59975e99ca170/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSource.java#L269-L278 So the uid depends on how many pipelines the JVM has built before: - 1st job graph built in a JVM: `uid_stream_write_<table>`, `uid_split_monitor_<table>` - 2nd one in the same JVM: `uid_stream_write_1_<table>`, `uid_split_monitor_1_<table>` A savepoint taken from the first job cannot be restored by the second one: the operators are "not available in the new program". With `allowNonRestoredState` the job starts, but the Hudi operators silently lose their state. Any long-lived JVM that builds more than one job graph is affected: - job jar submitted to a session cluster through the JobManager REST API or web UI (`/jars/:id/run`), with the Hudi bundle in `flink/lib`; - interactive `sql-client.sh embedded` session; - SQL Gateway. `flink run`, `sql-client.sh -f` and application mode are not affected: each submit gets a fresh JVM or classloader. #17658 looks like the same problem. **What you expected:** The same program produces the same operator uids on every submit, so a savepoint can be restored. **Steps to reproduce:** 1. Start a session cluster with `hudi-flink1.20-bundle` in `flink/lib`. 2. Upload a job jar that writes to a Hudi table with `HoodiePipeline` (`POST /jars/upload`) and run it (`POST /jars/:id/run`). 3. Stop the job with a savepoint. 4. Run the same jar again on the same JobManager with `savepointPath` set to that savepoint. 5. The submit fails: the savepoint state cannot be mapped to the operators of the new job. **Related work in similar projects:** - apache/iceberg#15687 fixed the same class of bug: an operator uid that changed on every graph build and broke savepoint restore. - For one table used twice in a job, Iceberg (`uid-suffix`, apache/iceberg#14063) and Paimon (`sink.operator-uid.suffix`, apache/paimon#4424) let the user set an explicit uid suffix instead of numbering operators automatically. ### Environment **Hudi version:** 1.2.1 (the code is the same in master and in 0.15.0) **Query engine:** Flink 1.20.1, session cluster, DataStream API (`HoodiePipeline`) **Relevant configs:** Hudi bundle in `flink/lib`, COPY_ON_WRITE table, upsert ### Logs and Stack Trace java.lang.RuntimeException: org.apache.flink.runtime.client.JobInitializationException: Could not start the JobMaster. Caused by: org.apache.flink.runtime.client.JobInitializationException: Could not start the JobMaster. Caused by: java.util.concurrent.CompletionException: java.lang.IllegalStateException: Failed to rollback to checkpoint/savepoint s3p://<bucket>/flink-savepoint/savepoint-33cd1f-42a000300e72. Cannot map checkpoint/savepoint state for operator ce5e14d93c74b1e6f081aa3939051ebe to the new program, because the operator is not available in the new program. If you want to allow to skip this, you can set the --allowNonRestoredState option on the CLI. -- 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]
