You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Zhengqi Zhang (Jira)" <ji...@apache.org> on 2022/05/01 08:55:00 UTC
[jira] [Commented] (FLINK-27318) KafkaSink: when init transaction, it take too long to get a producerId with epoch=0
[ https://issues.apache.org/jira/browse/FLINK-27318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17530498#comment-17530498 ]
Zhengqi Zhang commented on FLINK-27318:
---------------------------------------
This can happen if the task runs for a while and successfully completes many CheckPoints, and then we restart the task manually without recovering from CheckPoint.
I looked at this part of the code, it seems that the lastCheckpointId is 0 after restart, if the last completed CheckPoint is the 1000th time, it will try at least 1000 abort transactions, because each CheckPoint will use a transaction id, and this transaction id Exactly that ends with lastCheckpointId. So these operations will take a lot of time, and the program will only stop when it finds a produceId with epoch=0, because using the previous transaction id will not get a produceId with epoch=0.
Does this mean that when we restart the task manually without recovering from the last CheckPoint, we will spend a lot of time aborting the previous transaction.
!image-2022-05-01-16-50-27-264.png!
> KafkaSink: when init transaction, it take too long to get a producerId with epoch=0
> -----------------------------------------------------------------------------------
>
> Key: FLINK-27318
> URL: https://issues.apache.org/jira/browse/FLINK-27318
> Project: Flink
> Issue Type: Bug
> Components: Connectors / Kafka
> Affects Versions: 1.14.4
> Reporter: Zhengqi Zhang
> Priority: Major
> Attachments: image-2022-04-20-17-34-48-207.png, image-2022-04-20-17-59-27-397.png, image-2022-05-01-16-50-27-264.png
>
>
> as we can see, the new KafkaSink aborts all transactions that have been created by a subtask in a previous run, only return when get a producerId was unused before(epoch=0). But this can take a long time, especially if the task has been started and cancelled many times before. In my tests, it even took {*}10 minutes{*}. Is there a better way to solve this problem, or {*}do what FlinkKafkaProducer did{*}.
> !image-2022-04-20-17-59-27-397.png|width=534,height=256!
> !image-2022-04-20-17-34-48-207.png|width=556,height=412!
--
This message was sent by Atlassian Jira
(v8.20.7#820007)