flink保证sink 端exactly-once有幂等写入和事务写入两种方式。事务写入的实现方式又有预写日志和两阶段提交。请问预写日志和两阶段提交的差别在哪里?两个好像都是先写入缓存,等checkpoint确认了,再写入磁盘。请问两者的差别在哪里?
2条回答 默认 最新
- bingcore 2021-11-05 12:40关注
The WAL sink writes all result records intoapplication state and emits them to the sink system once it receives thenotification that a checkpoint was completed. Since the sink buffersrecords in the state backend, the WAL sink can be used with any kindof sink system. However, it cannot provide bulletproof exactly-onceguarantees, adds to the state size of an application, and the sinksystem has to deal with a spiky writing pattern.In contrast, the 2PC sink requires a sink system that offers transactionalsupport or exposes building blocks to emulate transactions. For eachcheckpoint, the sink starts a transaction and appends all receivedrecords to the transaction, writing them to the sink system withoutcommitting them. When it receives the notification that a checkpointcompleted, it commits the transaction and materializes the writtenresults. The mechanism relies on the ability of a sink to commit atransaction after recovering from a failure that was opened before acompleted checkpoint.The 2PC protocol piggybacks on Flink’s existing checkpointingmechanism. The checkpoint barriers are notifications to start a newtransaction, the notifications of all operators about the success of theirindividual checkpoint are their commit votes, and the messages of theJobManager that notify about the success of a checkpoint are theinstructions to commit the transactions. In contrast to WAL sinks, 2PCsinks can achieve exactly-once output depending on the sink systemand the sink’s implementation. Moreover, a 2PC sink continuouslywrites records to the sink system compared to the spiky writing pattern2of a WAL sink.
解决 无用评论 打赏 举报
悬赏问题
- ¥15 没输出运行不了什么问题
- ¥20 输入import torch显示Intel MKL FATAL ERROR,系统驱动1%,: Cannot load mkl_intel_thread.dll.
- ¥15 点云密度大则包围盒小
- ¥15 nginx使用nfs进行服务器的数据共享
- ¥15 C#i编程中so-ir-192编码的字符集转码UTF8问题
- ¥15 51嵌入式入门按键小项目
- ¥30 海外项目,如何降低Google Map接口费用?
- ¥15 fluentmeshing
- ¥15 手机/平板的浏览器里如何实现类似荧光笔的效果
- ¥15 盘古气象大模型调用(python)