当前位置: 首页 > news >正文

福州专业网站建设网络公司山西seo关键词优化软件搜索

福州专业网站建设网络公司,山西seo关键词优化软件搜索,dw做网站一般是多大的尺寸,高端网站定制设计公司背景 在flink中可以通过使用事务性数据汇实现精准一次的保证,本文基于Kakfa的事务处理来看一下在Flink 内部如何实现基于两阶段提交协议的事务性数据汇. flink kafka事务性数据汇的实现 1。首先在开始进行快照的时候也就是收到checkpoint通知的时候,在…

背景

在flink中可以通过使用事务性数据汇实现精准一次的保证,本文基于Kakfa的事务处理来看一下在Flink 内部如何实现基于两阶段提交协议的事务性数据汇.

flink kafka事务性数据汇的实现

1。首先在开始进行快照的时候也就是收到checkpoint通知的时候,在snapshot方法中会开启一个新的事务,代码如下:

   public void snapshotState(FunctionSnapshotContext context) throws Exception {// this is like the pre-commit of a 2-phase-commit transaction// we are ready to commit and remember the transactioncheckState(currentTransactionHolder != null,"bug: no transaction object when performing state snapshot");long checkpointId = context.getCheckpointId();LOG.debug("{} - checkpoint {} triggered, flushing transaction '{}'",name(),context.getCheckpointId(),currentTransactionHolder);preCommit(currentTransactionHolder.handle);// 调用kafkaProducer.flush();清理上一个事务的状态(注意不是提交),只是确保前一个事务的所有资源清理完毕pendingCommitTransactions.put(checkpointId, currentTransactionHolder);LOG.debug("{} - stored pending transactions {}", name(), pendingCommitTransactions);
// 调用producer.beginTransaction();方法开启一个新的kafka事务currentTransactionHolder = beginTransactionInternal();LOG.debug("{} - started new transaction '{}'", name(), currentTransactionHolder);state.clear();state.add(new State<>(this.currentTransactionHolder,new ArrayList<>(pendingCommitTransactions.values()),userContext));}

2.其次在JobManager通知检查点完成的通知方法,也就是notifyCheckpointComplete方法中提交事务

Iterator<Map.Entry<Long, TransactionHolder<TXN>>> pendingTransactionIterator =pendingCommitTransactions.entrySet().iterator();Throwable firstError = null;while (pendingTransactionIterator.hasNext()) {Map.Entry<Long, TransactionHolder<TXN>> entry = pendingTransactionIterator.next();Long pendingTransactionCheckpointId = entry.getKey();TransactionHolder<TXN> pendingTransaction = entry.getValue();if (pendingTransactionCheckpointId > checkpointId) {continue;}LOG.info("{} - checkpoint {} complete, committing transaction {} from checkpoint {}",name(),checkpointId,pendingTransaction,pendingTransactionCheckpointId);logWarningIfTimeoutAlmostReached(pendingTransaction);try {//调用producer.commitTransaction()方法提交事务commit(pendingTransaction.handle);} catch (Throwable t) {if (firstError == null) {firstError = t;}}LOG.debug("{} - committed checkpoint transaction {}", name(), pendingTransaction);pendingTransactionIterator.remove();}if (firstError != null) {throw new FlinkRuntimeException("Committing one of transactions failed, logging first encountered failure",firstError);}

至此,一个两阶段提交的flink事务性数据汇完成了,这个事务性数据汇可以构成端到端一致性的一部分

http://www.hkea.cn/news/360965/

相关文章:

  • 为女朋友做的表白网站百度大数据分析工具
  • 上海高端网站建设服务公seo推广公司
  • 找人合伙做网站平台仿站定制模板建站
  • 深圳市网站建设科技公司腾讯网网站网址
  • wordpress语言文件夹seo销售好做吗
  • 河北建设集团官网西安网站seo
  • 在外汇局网站做登记报告恢复原来的百度
  • 做外贸做的很好的网站全国疫情突然又严重了
  • 开发app需要什么样的团队百度seo优化培训
  • ftp上传网站之后软文什么意思范例
  • 询广西南宁网站运营推广系统
  • wordpress侧边栏小工具佛山网站优化
  • 用vs做网站原型企业培训课程有哪些内容
  • wordpress评论自定义百度刷排名seo
  • 四川建设网官网登录入口泉州seo外包
  • 网站有备案 去掉备案网络营销意思
  • 新建网站推广给企业百度问一问在线咨询客服
  • 曹鹏wordpress建站seo视频广东疫情防控措施
  • 网站开发的岗位排名优化工具
  • 岳阳做网站怎么做推广让别人主动加我
  • 不断改进网站建设公司百度官网优化
  • 万户网站宁波网站制作优化服务
  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo