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

做竹鼠网站微信网站开发报价表

做竹鼠网站,微信网站开发报价表,长春建站企业,wordpress安装主题要多久背景 算子的联合列表状态是平时使用的比较少的一种状态,本文通过kafka的消费者实现来看一下怎么使用算子列表联合状态 算子联合列表状态 首先我们看一下算子联合列表状态的在进行故障恢复或者从某个保存点进行扩缩容启动应用时状态的恢复情况 算子联合列表状态主…

背景

算子的联合列表状态是平时使用的比较少的一种状态,本文通过kafka的消费者实现来看一下怎么使用算子列表联合状态

算子联合列表状态

首先我们看一下算子联合列表状态的在进行故障恢复或者从某个保存点进行扩缩容启动应用时状态的恢复情况
在这里插入图片描述
算子联合列表状态主要由这两个方法处理:
1初始化方法

public final void initializeState(FunctionInitializationContext context) throws Exception {OperatorStateStore stateStore = context.getOperatorStateStore();// 在初始化方法中获取联合列表状态this.unionOffsetStates =stateStore.getUnionListState(new ListStateDescriptor<>(OFFSETS_STATE_NAME,createStateSerializer(getRuntimeContext().getExecutionConfig())));if (context.isRestored()) {restoredState = new TreeMap<>(new KafkaTopicPartition.Comparator());
// 把联合列表状态的数据都恢复成类的本地变量中// populate actual holder for restored statefor (Tuple2<KafkaTopicPartition, Long> kafkaOffset : unionOffsetStates.get()) {restoredState.put(kafkaOffset.f0, kafkaOffset.f1);}LOG.info("Consumer subtask {} restored state: {}.",getRuntimeContext().getIndexOfThisSubtask(),restoredState);} else {LOG.info("Consumer subtask {} has no restore state.",getRuntimeContext().getIndexOfThisSubtask());}}

2.开始通知检查点开始的方法:

public final void snapshotState(FunctionSnapshotContext context) throws Exception {if (!running) {LOG.debug("snapshotState() called on closed source");} else {unionOffsetStates.clear();final AbstractFetcher<?, ?> fetcher = this.kafkaFetcher;if (fetcher == null) {// the fetcher has not yet been initialized, which means we need to return the// originally restored offsets or the assigned partitionsfor (Map.Entry<KafkaTopicPartition, Long> subscribedPartition :subscribedPartitionsToStartOffsets.entrySet()) {// 进行checkpoint时,把数据保存到联合列表状态中进行保存unionOffsetStates.add(Tuple2.of(subscribedPartition.getKey(), subscribedPartition.getValue()));}if (offsetCommitMode == OffsetCommitMode.ON_CHECKPOINTS) {// the map cannot be asynchronously updated, because only one checkpoint call// can happen// on this function at a time: either snapshotState() or// notifyCheckpointComplete()pendingOffsetsToCommit.put(context.getCheckpointId(), restoredState);}} else {HashMap<KafkaTopicPartition, Long> currentOffsets = fetcher.snapshotCurrentState();if (offsetCommitMode == OffsetCommitMode.ON_CHECKPOINTS) {// the map cannot be asynchronously updated, because only one checkpoint call// can happen// on this function at a time: either snapshotState() or// notifyCheckpointComplete()pendingOffsetsToCommit.put(context.getCheckpointId(), currentOffsets);}for (Map.Entry<KafkaTopicPartition, Long> kafkaTopicPartitionLongEntry :currentOffsets.entrySet()) {unionOffsetStates.add(Tuple2.of(kafkaTopicPartitionLongEntry.getKey(),kafkaTopicPartitionLongEntry.getValue()));}}if (offsetCommitMode == OffsetCommitMode.ON_CHECKPOINTS) {// truncate the map of pending offsets to commit, to prevent infinite growthwhile (pendingOffsetsToCommit.size() > MAX_NUM_PENDING_CHECKPOINTS) {pendingOffsetsToCommit.remove(0);}}}}
http://www.yayakq.cn/news/754069/

相关文章:

  • 前端移动网站开发网站概念设计
  • 做家具有那个网站好旅游网站开发内容
  • 大型网站快速排名泰安企业网站建设电话
  • 信誉比较好的网上做任务的网站网上怎么注册公司营业执照
  • 做旅游景区网站新媒体运营怎么学
  • 吉安市网站制作c2c模式的特点有哪些
  • 2019怎么做网站赚钱长沙制作手机网站的公司
  • 类似于凡科的网站哪些专业要学网页制作
  • 全自动免费网页制作电商seo搜索优化
  • 张店学校网站建设公司wordpress带会员中心主题
  • jsp网站部署怎么做做个网站需要多久
  • 广州做创客教室的厂家网站wordpress 字符集 404
  • 东莞做企业网站百度的seo关键词优化怎么弄
  • 做商城外贸网站安防公司手机网站
  • 免费认证网站销售怎么做
  • 网站后台插件下载网站封面制作
  • 网站容易被百度收录郴州网站建设公司有哪些
  • 湖南新能源公司中企动力网站建设潍坊网站建设多少钱
  • 做网站需要学习哪些引流推广平台有哪些
  • 深圳华鑫峰网站建设网站建设的目的分析
  • 小型的企业网站二七区做网站
  • 网站怎么做登录2021国内最好用免费建站系统
  • 公司汇报网站建设方案赣州章贡区医保局电话
  • 嘉兴网站开发与制作哪里做网站的比较多
  • 北京朝阳双桥网站建设网上书店网站建设实训报告总结
  • 企业官方网站怎么查wordpress实现ajax
  • 网站建设要注册哪些商标类别购物网站app制作
  • 网站关键词优化方法抚州做网站公司
  • 成都网站设计平台网站设计的技术方案
  • 网站蜘蛛来访记录安徽省建设质量安全协会网站