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

湖北设计公司深圳网站seo推广

湖北设计公司,深圳网站seo推广,网站建设的栏目规划,学校门户网站什么意思背景 算子的联合列表状态是平时使用的比较少的一种状态#xff0c;本文通过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 (Tuple2KafkaTopicPartition, 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.EntryKafkaTopicPartition, 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 {HashMapKafkaTopicPartition, 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.EntryKafkaTopicPartition, 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.yutouwan.com/news/477608/

相关文章:

  • 料神wordpress建站教程全国前十装饰公司排名
  • 企业网站建设的流程与原则客户管理系统的功能
  • 宁夏住房和城乡建设官方网站二手建筑铝模板哪里有卖
  • 商城网站优化方案中国建设银行老版本下载官方网站
  • 手机电脑网站 建站程序百度推广手机app下载
  • 网站空间500M在线代理入口
  • 上海网站建设公司推荐柳州企业做网站
  • 网站防止盗图阿里云部署多个网站
  • dw自己做网站需要什么意思wordpress详细教程
  • 佛山企业网站开发公司浏览器下载免费大全
  • 遵义网站设计公司上海自建网站
  • 广州新建站作图网站做课程表
  • html5 微网站 源码电子科技东莞网站建设
  • 东莞企业网站排名优化学做莱网站
  • 新手做网页做那个网站简单成都谷歌seo
  • 个人网站的版权怎么写西安网站开发高端网站开发
  • 番禺建设银行网站软件开发好学吗?
  • 建设网站注意什么网站制作公司 恶意
  • 山西长治做网站公司有哪些阿里云建设网站
  • 网站配色 蓝色商标注册平台官网
  • 统一企业官方网站虹口网站建设
  • 上海外贸网站关于网站建设的广告词
  • 秦皇岛做网站汉狮网络成都建设规划局网站首页
  • 网站建设一年多少恰大数据获客
  • 用帝国cms做网站柳州市建设工程质量安全监督管理处网站
  • 法律行业网站建设公司注册地址变更手续
  • 淘宝客网站名网站建设尺寸像素是多少
  • 海拉尔网站建设平台制作网站建网站
  • 做设计参考的网站微信网站开发 全屏
  • 做公司网站要什么资料重庆模板建站代理