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

建筑工程公司官网怎么快速优化网站

建筑工程公司官网,怎么快速优化网站,sns网站是什么,卧龙区网站制作背景#xff1a; kafka的文件系统数据源可以支持精准一次的一致性,本文就从源码看下如何TextInputFormat如何支持状态的精准一致性 TextInputFormat源码解析 首先flink会把输入的文件进行切分#xff0c;分成多个数据块的形式#xff0c;每个数据源算子任务会被分配以读取…背景 kafka的文件系统数据源可以支持精准一次的一致性,本文就从源码看下如何TextInputFormat如何支持状态的精准一致性 TextInputFormat源码解析 首先flink会把输入的文件进行切分分成多个数据块的形式每个数据源算子任务会被分配以读取其中的数据块,但是不是所有的文件都能进行分块判断文件是否可以进行分块的代码如下 protected boolean testForUnsplittable(FileStatus pathFile) {if (getInflaterInputStreamFactory(pathFile.getPath()) ! null) {unsplittable true;return true;}return false; }private InflaterInputStreamFactory? getInflaterInputStreamFactory(Path path) {String fileExtension extractFileExtension(path.getName());if (fileExtension ! null) {return getInflaterInputStreamFactory(fileExtension);} else {return null;} }后缀名称是.gz,.bzip2等的文件都没法切分,如果可以切分切分的具体代码如下所示 while (samplesTaken numSamples fileNum allFiles.size()) {// make a split for the sample and use it to read a recordFileStatus file allFiles.get(fileNum); // 根据偏移量进行切分FileInputSplit split new FileInputSplit(0, file.getPath(), offset, file.getLen() - offset, null);// we open the split, read one line, and take its lengthtry {open(split);if (readLine()) {totalNumBytes this.currLen this.delimiter.length;samplesTaken;}} finally {// close the file stream, do not release the bufferssuper.close();} // 偏移量迁移offset stepSize;// skip to the next file, if necessarywhile (fileNum allFiles.size() offset (file allFiles.get(fileNum)).getLen()) {offset - file.getLen();fileNum;} }再来看一下TextInputFormat如何支持checkpoint操作保存文件的偏移量的代码 Override public void snapshotState(StateSnapshotContext context) throws Exception {super.snapshotState(context);checkState(checkpointedState ! null, The operator state has not been properly initialized.);int subtaskIdx getRuntimeContext().getIndexOfThisSubtask();// 算子列表状态checkpointedState.clear();// 获取文件的当前读取的偏移ListT readerState getReaderState();try {for (T split : readerState) {//保存到检查点路径中checkpointedState.add(split);}} catch (Exception e) {checkpointedState.clear();throw new Exception(Could not add timestamped file input splits to to operator state backend of operator getOperatorName() .,e);}if (LOG.isDebugEnabled()) {LOG.debug({} (taskIdx{}) checkpointed {} splits: {}.,getClass().getSimpleName(),subtaskIdx,readerState.size(),readerState);} } 从检查点中恢复状态的代码如下 public void initializeState(StateInitializationContext context) throws Exception {super.initializeState(context);checkState(checkpointedState null, The reader state has already been initialized.);// 初始化算子操作状态checkpointedState context.getOperatorStateStore().getListState(new ListStateDescriptor(splits, new JavaSerializer()));int subtaskIdx getRuntimeContext().getIndexOfThisSubtask();LOG.info(Restoring state for the {} (taskIdx{})., getClass().getSimpleName(), subtaskIdx);splits splits null ? new PriorityQueue() : splits;for (T split : checkpointedState.get()) {//从检查点状态中恢复各个切分的分块splits.add(split);} }
http://www.hkea.cn/news/14348139/

相关文章:

  • 展馆门户网站建设行政事业单位网站建设建议
  • 1.1做网站的目的抖音代运营怎么做
  • 比分网站怎么做高端网站建设专家
  • 搭建网站的网站wordpress系统如何用
  • 做网站需要哪些硬件软件网线水晶头接法
  • 做文库网站怎么赚钱吗软件开发的七个流程
  • 廊坊网站建设制作建网站费用 优帮云
  • html购物网站怎么做免费微商城小程序模板
  • 昆明网站建设优化企业地质公园网站建设
  • 泉州建设网站公司哪家好高端网站建设设
  • 免费地图制作网站怎么进入网站管理系统
  • 网站建设公司咨询电话手机端网站seo
  • 做网站文字编辑好不好做语文综合题的网站
  • 免费网站建设哪家好网站开发总结经验和教训
  • 网站整体设计风格网站建设费属于研发费用吗
  • 禅城顺德网站建设做网站挣钱么
  • 免费个人网站模板下载erp管理系统有哪些牌子
  • 如何编程建设网站自己如何做网站内容
  • 网站开发流程图解释含义成都网站排名 生客seo怎么样
  • sp怎么做视频网站旅游网站首页模板下载
  • 电子商务网站开发设计wordpress 广告位
  • 大连 手机网站案例wordpress写文章失败
  • 开发一个网站要学什么软件江西住房和城乡建设厅网站首页
  • 浙江网络公司网站建设广州自助网站搭建建站公司
  • 很长的网站域名怎么做短wordpress主题cms
  • ins做甜品网站上海做网站那家公司好
  • 建设证件查询官方网站上海企业信息登记号查询
  • 做排名出租网站企业官方网站开发平台
  • mil后缀网站被邀请做刷客会不会碰到钓鱼网站
  • 怎么做招聘网站设计人脉做的最好的网站