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

网站引流怎么做全网搜索引擎优化

网站引流怎么做,全网搜索引擎优化,石家庄网络科技有限公司,广州第一炮背景 GenericWriteAheadSink原理是把接收记录按照检查点进行分段,每个到来的记录都放到对应的分段中,这些分段内的记录是作为算子状态的形式存储和故障恢复的,对于每个分段内的记录列表,flink会在收到检查点完成的通知时把他们都…

背景

GenericWriteAheadSink原理是把接收记录按照检查点进行分段,每个到来的记录都放到对应的分段中,这些分段内的记录是作为算子状态的形式存储和故障恢复的,对于每个分段内的记录列表,flink会在收到检查点完成的通知时把他们都写到外部存储中,本文对其中的检查点完成后是否对应的事务必须成功这个点进行讲解

源码解析GenericWriteAheadSink

首先开始进行checkpoint时代码如下

public void snapshotState(StateSnapshotContext context) throws Exception {super.snapshotState(context);// 把检查点id先放入本地变量中saveHandleInState(context.getCheckpointId(), context.getCheckpointTimestamp());this.checkpointedState.clear();for (PendingCheckpoint pendingCheckpoint : pendingCheckpoints) {// 把本地变量中的检查点存放到算子列表状态中this.checkpointedState.add(pendingCheckpoint);}}private void saveHandleInState(final long checkpointId, final long timestamp) throws Exception {PendingCheckpoint pendingCheckpoint =new PendingCheckpoint(checkpointId, subtaskIdx, timestamp, handle);// 把检查点id先放到   pendingCheckpoints本地变量中 pendingCheckpoints.add(pendingCheckpoint);}

其实接收检查点完成的通知:

public void notifyCheckpointComplete(long checkpointId) throws Exception {super.notifyCheckpointComplete(checkpointId);synchronized (pendingCheckpoints) {Iterator<PendingCheckpoint> pendingCheckpointIt = pendingCheckpoints.iterator();while (pendingCheckpointIt.hasNext()) {PendingCheckpoint pendingCheckpoint = pendingCheckpointIt.next();long pastCheckpointId = pendingCheckpoint.checkpointId;int subtaskId = pendingCheckpoint.subtaskId;long timestamp = pendingCheckpoint.timestamp;StreamStateHandle streamHandle = pendingCheckpoint.stateHandle;//把历史的+当前的还没有成功提交的检查点id对应的事务,重新调用sendValue方法并提交对应检查点的事务if (pastCheckpointId <= checkpointId) {try {// 历史的或者当前的事务未提交if (!committer.isCheckpointCommitted(subtaskId, pastCheckpointId)) {try (FSDataInputStream in = streamHandle.openInputStream()) {// 调用sendValue方法写数据boolean success =sendValues(new ReusingMutableToRegularIteratorWrapper<>(new InputViewIterator<>(new DataInputViewStreamWrapper(in),serializer),serializer),pastCheckpointId,timestamp);if (success) {//提交对应检查点对应的事务committer.commitCheckpoint(subtaskId, pastCheckpointId);streamHandle.discardState();pendingCheckpointIt.remove();}}} else {streamHandle.discardState();pendingCheckpointIt.remove();}} catch (Exception e) {// we have to break here to prevent a new (later) checkpoint// from being committed before this oneLOG.error("Could not commit checkpoint.", e);break;}}}}}

注意这里需要注意的是flink的检查点成功创建后才会使用notify方法进行通知,flink没有保证一定通知,此外通知之后不论这个notify方法中发生了什么异常都不影响flink已经创建了检查点的事实。
对应到我们这个例子,你就会发现在notify方法中有需要把历史检查点已经创建成功但是对应的事务没有提交的事务重新调用一次sendValue方法和提交对应检查点的事务,也就是说不是每一次检查点都能成功的提交事务,如果事务没有提交成功,等待下一次检查点的通知即可,下一个检查点的通知会把历史的检查点重新检测一次.

http://www.dt0577.cn/news/3307.html

相关文章:

  • 网销都是在那些网站做推广抖音seo什么意思
  • 做班级玩网站做哪些方面海南百度推广公司
  • 斗门区建设局网站seo 公司
  • 网站建设要托管服务器千度seo
  • 城乡建设工程信息网莆田百度快照优化
  • 用wix做网站需要备案吗营销技巧
  • 网页设计是什么概念seo课程心得体会
  • 中山网站建设工具猫手机网站百度关键词排名查询
  • 品牌奶茶加盟网站建设百度收录要多久
  • dede怎么做商城网站仁茂网络seo
  • 大企业网站建设费用市场调查报告模板及范文
  • 沈阳优化网站长春网站优化
  • 那里可以做app网站东莞哪种网站推广好
  • 网站seo具体怎么做关键词排名的工具
  • 网站首页banner怎么做0元做游戏代理
  • 唐山做网站公司哪家好如何在百度上开店铺
  • 门户网站开发流程浙江seo技术培训
  • 美篇相册制作免费下载app黑帽seo工具
  • 电子商务企业网站的基本功能原创代写文章平台
  • 南宁网站 制作seo快速排名软件平台
  • 中企动力做的网站升级收费sem是什么岗位
  • 欧美做愛网站A级移动惠生活app下载网址
  • 南京网站开发价格东莞网站seo推广
  • 做调查问卷换赏金的网站新冠病毒最新消息
  • wordpress默认页面黄石seo
  • 静态后台管理网站模板班级优化大师下载
  • 珠江摩尔网站建设电商平台推广
  • 哪个网站做淘宝客国外seo工具
  • 济南网站建设优化怎么做电商卖东西
  • 谁有好的网站推荐一个网站推广平台搭建