[SUPPORT] Flink stream write hudi, failed to checkpoint
When I used Flink to synchronize data to write HUDi in COW mode, Flink job kept failing to restart and checkpoint kept failing. The Parquet file had been written to the path of S3, but the metadata of the table was not generated.My error message is as follows:

Checkpoint failures are mostly unsuccessful. After many job restarts, the metadata of the table is synchronized to glue


Environment Description
-
Hudi version : 0.11.0
-
Hive version : 3.1.2
-
Flink version : 1.14.0
-
Hadoop version : 3.2.1
-
Storage (HDFS/S3/GCS..) : S3
-
Running on Docker? (yes/no) : no
Add the stacktrace of the error.
2022-05-26 07:02:04,853 INFO org.apache.hudi.common.table.timeline.HoodieActiveTimeline [] - Loaded instants upto : Option{val=[==>20220526070204519__commit__INFLIGHT]} 2022-05-26 07:02:04,854 INFO org.apache.hudi.sink.StreamWriteOperatorCoordinator [] - Executor executes action [initialize instant ] success! 2022-05-26 07:05:05,157 INFO org.apache.flink.runtime.checkpoint.CheckpointCoordinator [] - Triggering checkpoint 1 (type=CHECKPOINT) @ 1653548704936 for job db2606cb4c8b068abba1c50fde7cc981. 2022-05-26 07:05:05,161 INFO org.apache.hudi.sink.StreamWriteOperatorCoordinator [] - Executor executes action [taking checkpoint 1] success! 2022-05-26 07:05:17,905 ERROR org.apache.hudi.sink.StreamWriteOperatorCoordinator [] - Executor executes action [handle write metadata event for instant 20220526070204519] error java.lang.IllegalStateException: Receive an unexpected event for instant 20220526070207156 from task 0 at org.apache.hudi.common.util.ValidationUtils.checkState(ValidationUtils.java:67) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.StreamWriteOperatorCoordinator.handleWriteMetaEvent(StreamWriteOperatorCoordinator.java:426) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.StreamWriteOperatorCoordinator.lambda$handleEventFromOperator$4(StreamWriteOperatorCoordinator.java:287) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.utils.NonThrownExecutor.lambda$execute$0(NonThrownExecutor.java:93) ~[data-warehouse-jar-with-dependencies.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_332] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_332] at java.lang.Thread.run(Thread.java:750) [?:1.8.0_332] 2022-05-26 07:05:17,918 INFO org.apache.flink.runtime.jobmaster.JobMaster [] - Trying to recover from a global failure. org.apache.flink.util.FlinkException: Global failure triggered by OperatorCoordinator for 'stream_write -> Sink: clean_commits' (operator d7e1479d29f5496e566077d01795f68f). at org.apache.flink.runtime.operators.coordination.OperatorCoordinatorHolder$LazyInitializedCoordinatorContext.failJob(OperatorCoordinatorHolder.java:545) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.StreamWriteOperatorCoordinator.lambda$start$0(StreamWriteOperatorCoordinator.java:180) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.utils.NonThrownExecutor.lambda$execute$0(NonThrownExecutor.java:103) ~[data-warehouse-jar-with-dependencies.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_332] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_332] at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_332] Caused by: org.apache.hudi.exception.HoodieException: Executor executes action [handle write metadata event for instant 20220526070204519] error ... 5 more Caused by: java.lang.IllegalStateException: Receive an unexpected event for instant 20220526070207156 from task 0 at org.apache.hudi.common.util.ValidationUtils.checkState(ValidationUtils.java:67) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.StreamWriteOperatorCoordinator.handleWriteMetaEvent(StreamWriteOperatorCoordinator.java:426) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.StreamWriteOperatorCoordinator.lambda$handleEventFromOperator$4(StreamWriteOperatorCoordinator.java:287) ~[data-warehouse-jar-with-dependencies.jar:?] at org.apache.hudi.sink.utils.NonThrownExecutor.lambda$execute$0(NonThrownExecutor.java:93) ~[data-warehouse-jar-with-dependencies.jar:?] ... 3 more 2022-05-26 07:05:17,920 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph [] - Job insert-into_default_catalog.default_database.hudi_sink (db2606cb4c8b068abba1c50fde7cc981) switched from state RUNNING to RESTARTING. 2022-05-26 07:05:17,925 WARN org.apache.hudi.sink.StreamWriteOperatorCoordinator [] - Reset the event for task [0] 2022-05-26 07:05:17,926 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph [] - stream_write -> Sink: clean_commits (1/1) (5b601ab60f621f586bd0f09c2cbe21b7) switched from RUNNING to CANCELING. 2022-05-26 07:05:17,928 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph [] - bucket_assigner (1/1) (e02f84c19cf38cebfd4c771efeb057c3) switched from RUNNING to CANCELING.
This seems to be a concurrent write exception. Can you check if there is another application writing to the same table?
This seems to be a concurrent write exception. Can you check if there is another application writing to the same table?
No, I only have one job running in the cluster. I don't have multiple tasks writing a table concurrently
Did you open the metadata table or something ?
I stored the hudI metadata tables in AWS Glue, and the metadata files in S3. I did not read or write these files
Your error indicates that the coordinator receives an event with greater timestamp than it currently starts, what is why it reports an error. If there are multiple writers with different transactions start, this error may occur, for your case, you may need to find out who generates the reported timestamp first/
Your error indicates that the coordinator receives an event with greater timestamp than it currently starts, what is why it reports an error. If there are multiple writers with different transactions start, this error may occur, for your case, you may need to find out who generates the reported timestamp first/
It's confusing because I only have one task to write data to this table
I Got the same problem when using pg-cdc as source and hudi as destionation.
The records in source table is about 4.3 million.
flink configuration with hudi is something like:
, 'table.type'= 'MERGE_ON_READ'
, 'write.operation' = 'upsert'
, 'write.precombine.field' = 'create_date'
, 'write.ignore.failed' = 'true'
, 'write.tasks' = '1'
, 'compaction.tasks' = '1'
, 'compaction.schedule.enabled' = 'true'
, 'compaction.async.enabled' = 'true'
, 'compaction.trigger.strategy' = 'num_or_time'
, 'compaction.delta_commits' = '5'
, 'compaction.delta_seconds' = '300'
, 'compaction.max_memory' = '1024'
, 'hive_sync.enable'= 'true'
, 'hive_sync.mode'= 'hms'

Also, I cannot find "20220601200434001" metadata file under .hoodie directory.

Thanks a lot for explaining the reasons, or methods to figure out the problem! Best Wishes!
@galain1994 Can you see the commit file in your archieved dirs.
@galain1994 Can you see the commit file in your archieved dirs.
There are commits files in archieved dir.
@galain1994 Can you see the commit file in your archieved dirs.
These days, I try to change the hudi arguments with:
compaction.trigger.strategy = 'num_commits'
'compaction.delta_commits' = '20'
And delete the table in Hive metastore, and all the files in table data path,
after restart the flink job, checkpoint runs normally, but no parquet file in each partition, only found log file.

Still have no clue to solve problem 😮💨
I have switched to deltaStreamer to synchronize data, flink writing hudi still feels too unstable
@galain1994 Can you see the commit file in your archieved dirs.
These days, I try to change the hudi arguments with:
compaction.trigger.strategy = 'num_commits''compaction.delta_commits' = '20'And delete the table in Hive metastore, and all the files in table data path, after restart the flink job, checkpoint runs normally, but no parquet file in each partition, only found log file.![]()
![]()
Still have no clue to solve problem 😮💨
I see that many compaction tasks have been scheduled in your pipeline, can you see the compaction metadata file under .hoodie folder now ? Is there any error log while compaction ?
I have switched to deltaStreamer to synchronize data, flink writing hudi still feels too unstable
You may need to set up your job correctly, flink hudi is stable now ~
really unstable
really unstable
You may need to set up the job correctly.
Close because of chronic inactivity.
really unstable
You may need to set up the job correctly.
Could you please provide an effective configuration reference? Thank you very much. I have also met the same problem.
Can you share you basic job info here, like the Hudi version and SQL config options.
你能在这里分享你的基本工作信息吗,比如 Hudi 版本和 SQL 配置选项。
hudi version: 0.13.0
flink version: 1.13.2
hudi jar : hudi-flink1.13-bundle-0.12.1
table config :
WITH (
'connector' = 'hudi',
'table.type' = 'MERGE_ON_READ',
'hoodie.table.name' = '***',
'hoodie.datasource.hive_sync.database' = '***',
'path' = '***',
'hoodie.datasource.hive_sync.enable' = 'true',
'hoodie.datasource.meta.sync.enable' = 'true',
'hoodie.metadata.enable' = 'true',
'hoodie.metadata.index.column.stats.enable' = 'true',
'oodie.enable.data.skipping' = 'true',
'hoodie.index.type' = 'SIMPLE',
'hoodie.datasource.write.operation' = 'upsert',
'hoodie.datasource.write.recordkey.field' = 'id',
'hoodie.datasource.write.streaming.retry.interval.ms' = '10000',
'hoodie.clean.automatic' = 'true',
'hoodie.cleaner.commits.retained' = '1',
'read.start-commit' = 'earliest',
'hoodie.datasource.write.precombine.field' = 'id',
'clean.retain_commits' = '2',
'compaction.max_memory' = '1024',
'compaction.timeout.seconds' = '1800',
'metadata.compaction.delta_commits' = '5'
);
There are some critical bug fixes since 0.13.0: https://www.yuque.com/yuzhao-my9fz/kb/flqll8#QmQk4, you need to cherry pick these fixes first, or wait for release 0.13.1 which would come out this weekend.