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

帝国cms 企业网站经典软文案例分析

帝国cms 企业网站,经典软文案例分析,郑州媒体网站定制开发,汽车最全的网站背景 TwoPhaseCommitSinkFunction是flink中基于二阶段事务提交和检查点机制配合使用实现的精准一次的输出数据汇#xff0c;但是想要实现精准一次的输出#xff0c;实际使用中需要注意几个方面#xff0c;否则不仅仅达不到精准一次输出#xff0c;反而可能导致数据丢失但是想要实现精准一次的输出实际使用中需要注意几个方面否则不仅仅达不到精准一次输出反而可能导致数据丢失连至少一次的语义都不能达到 TwoPhaseCommitSinkFunction注意事项 TwoPhaseCommitSinkFunction是通过在两阶段提交协议实现的事务大概简化为一下步骤 1 在收到检查点分隔符的时候开启事务并把记录都写到开启的事务中 2. 开始进行状态的保存时把检查点id对应的事务结束掉做好准备提交的准备并开启下一个事务 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);//当前检查点对应的事务做好准备比如进行stream.flush等准备好提交事务preCommit(currentTransactionHolder.handle);// 把当前检查点id对应的事务添加到状态中pendingCommitTransactions.put(checkpointId, currentTransactionHolder);LOG.debug({} - stored pending transactions {}, name(), pendingCommitTransactions);currentTransactionHolder beginTransactionInternal();LOG.debug({} - started new transaction {}, name(), currentTransactionHolder);// 把当前检查点id对应的事务添加到状态中state.clear();state.add(new State(this.currentTransactionHolder,new ArrayList(pendingCommitTransactions.values()),userContext));} 收到检查点完成的通知notify方法提交第二步中检查点id对应的事务注意这一步不是每次flink在进行检查点的时候都会通知这种情况下某一次的notify方法就需要把前几次的事务一起进行提交了另外如果提交某个检查点的事务失败那么应用会重启并且在重启后的initSnapshot方法中再次进行事务提交如果还是失败这个过程一直持续 public final void notifyCheckpointComplete(long checkpointId) throws Exception {IteratorMap.EntryLong, TransactionHolderTXN pendingTransactionIterator pendingCommitTransactions.entrySet().iterator();Throwable firstError null;while (pendingTransactionIterator.hasNext()) {Map.EntryLong, TransactionHolderTXN entry pendingTransactionIterator.next();Long pendingTransactionCheckpointId entry.getKey();TransactionHolderTXN pendingTransaction entry.getValue();if (pendingTransactionCheckpointId checkpointId) {continue;}LOG.info({} - checkpoint {} complete, committing transaction {} from checkpoint {},name(),checkpointId,pendingTransaction,pendingTransactionCheckpointId);logWarningIfTimeoutAlmostReached(pendingTransaction);try {// 提交事务commit(pendingTransaction.handle);} catch (Throwable t) {//事务失败时记录异常后面会把异常抛出导致应用重启if (firstError null) {firstError t;}}LOG.debug({} - committed checkpoint transaction {}, name(), pendingTransaction);// 事务成功后移除当前的事务pendingTransactionIterator.remove();}if (firstError ! null) {// 事务提交失败会抛出异常导致job异常中止throw new FlinkRuntimeException(Committing one of transactions failed, logging first encountered failure,firstError);}}总结 1。事务不能提交失败如果失败会导致作业失败然后重新提交如果最终没有成功提交那么数据会丢失 2。数据库服务端的事务超时时间不能设置太短不能仅仅大于检查点的间隔大小原因是上面说的flink有可能丢失检查点完成后的通知消息所以服务端的事务超时时间要设置的足够大.
http://www.zqtcl.cn/news/682377/

相关文章:

  • 硚口区建设局网站海绵宝宝的网页设计html源代码
  • 旅游网站建设合同成年做羞羞的视频网站
  • 海门网站建设制作道德建设 网站
  • 苏州 规划建设局网站网页设计师培训费用图
  • 怎么做视频解析的网站QQ空间可以建设网站吗
  • 视频网站 php源码甘肃 网站建设
  • 响应式网站和自适应便宜做网站8818
  • 湖南网站建设mxtia网站建设的流程图
  • 西安网站开发公司电话装修设计网站有哪些
  • 多少钱网站建设个人主页网页设计教程
  • 嘉兴品牌网站建设网站开发项目拖延周期
  • 网站版面布局结构网站建设公司公司
  • 给新公司建网站中国互联网企业排名前十名
  • 中国建设银行网站会员用户名网站建设应列入啥费用
  • 网站上面的水印怎么做的广东网站建设公
  • 爱站网关键词长尾挖掘工具wordpress文章外链
  • 做视频剪辑接私活的网站网站商城系统设计
  • thinkphp5做网站做网站需要准备资料
  • 门户网站平台建设方案建e室内设计网cad
  • 西安网站建设收费标准第五次全国经济普查
  • 成品网站货源1688免费襄阳公司网站建设
  • 2020国内十大小说网站排名365网站
  • 潍坊做网站的网络公司网页设计入门教材pdf
  • 影视公司网站建设wordpress 500ms
  • 旅游网站建设公司crm客户管理系统模板
  • 哪个网站有免费的模板阿里云上如何用iis做网站
  • 中山优化网站门户网站建设jz190
  • 湖州服装网站建设网站备案和域名备案区别
  • 网站开发好学嘛网络安全工程师年薪
  • 17网站一起做网店睡衣网线制作流程