今天有空闲时间看一下HBASE的写入代码

MutiAction类,是一个action的container,包括get . put. delete。并且是根据region name分组的。其中核心的就是add方法,根据传进来的region name将action分组

public final class MultiAction<R> {
// TODO: This class should not be visible outside of the client package. // map of regions to lists of puts/gets/deletes for that region.
public Map<byte[], List<Action<R>>> actions =
new TreeMap<byte[], List<Action<R>>>(Bytes.BYTES_COMPARATOR); private long nonceGroup = HConstants.NO_NONCE; public MultiAction() {
super();
} /**
* Get the total number of Actions
*
* @return total number of Actions for all groups in this container.
*/
public int size() {
int size = 0;
for (List<?> l : actions.values()) {
size += l.size();
}
return size;
} /**
* Add an Action to this container based on it's regionName. If the regionName
* is wrong, the initial execution will fail, but will be automatically
* retried after looking up the correct region.
*
* @param regionName
* @param a
*/
public void add(byte[] regionName, Action<R> a) {
add(regionName, Arrays.asList(a));
} /**
* Add an Action to this container based on it's regionName. If the regionName
* is wrong, the initial execution will fail, but will be automatically
* retried after looking up the correct region.
*
* @param regionName
* @param actionList list of actions to add for the region
*/
public void add(byte[] regionName, List<Action<R>> actionList){
List<Action<R>> rsActions = actions.get(regionName);
if (rsActions == null) {
rsActions = new ArrayList<Action<R>>(actionList.size());
actions.put(regionName, rsActions);
}
rsActions.addAll(actionList);
} public void setNonceGroup(long nonceGroup) {
this.nonceGroup = nonceGroup;
} public Set<byte[]> getRegions() {
return actions.keySet();
} public boolean hasNonceGroup() {
return nonceGroup != HConstants.NO_NONCE;
} public long getNonceGroup() {
return this.nonceGroup;
}
}  

接下来介绍AyncProcess类,该类

待续

Hbase put写入源码分析的更多相关文章

  1. 【RocketMQ源码分析】深入消息存储(1)

    最近在学习RocketMQ相关的东西,在学习之余沉淀几篇笔记. RocketMQ有很多值得关注的设计点,消息发送.消息消费.路由中心NameServer.消息过滤.消息存储.主从同步.事务消息等等. ...

  2. Hbase写入hdfs源码分析

    版权声明:本文由熊训德原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/258 来源:腾云阁 https://www.qclo ...

  3. Hbase WAL线程模型源码分析

    版权声明:本文由熊训德原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/257 来源:腾云阁 https://www.qclo ...

  4. Hbase源码分析:Hbase UI中Requests Per Second的具体含义

    Hbase源码分析:Hbase UI中Requests Per Second的具体含义 让运维加监控,被问到Requests Per Second(见下图)的具体含义是什么?我一时竟回答不上来,虽然大 ...

  5. 浅谈ZooKeeper基本原理与源码分析

    最近一直有小伙伴私信我,问一些关于Zookeeper的知识,下边关于的Zookeeper的知识整理了一下,一起学习一下. 看完本文对于Zookeeper想深入全面了解的读者朋友们,小编这里整理了一份更 ...

  6. spark源码分析以及优化

    第一章.spark源码分析之RDD四种依赖关系 一.RDD四种依赖关系 RDD四种依赖关系,分别是 ShuffleDependency.PrunDependency.RangeDependency和O ...

  7. 图解Janusgraph系列-图数据底层序列化源码分析(Data Serialize)

    图解Janusgraph系列-图数据底层序列化源码分析(Data Serialize) 大家好,我是洋仔,JanusGraph图解系列文章,实时更新~ 图数据库文章总目录: 整理所有图相关文章,请移步 ...

  8. 【图解源码】Zookeeper3.7源码分析,包含服务启动流程源码、网络通信源码、RequestProcessor处理请求源码

    Zookeeper3.7源码剖析 能力目标 能基于Maven导入最新版Zookeeper源码 能说出Zookeeper单机启动流程 理解Zookeeper默认通信中4个线程的作用 掌握Zookeepe ...

  9. zookeeper源码分析之四服务端(单机)处理请求流程

    上文: zookeeper源码分析之一服务端启动过程 中,我们介绍了zookeeper服务器的启动过程,其中单机是ZookeeperServer启动,集群使用QuorumPeer启动,那么这次我们分析 ...

随机推荐

  1. python 错误、调试、单元测试、文档测试

    错误分为程序的错误和由用户错误的输入引起的错误,此外还有因为各种各样意外的情况导致的错误,比如在磁盘满的时候写入.从网络爬取东西的时候,网络断了.这类错误称为异常 错误处理 参考链接:https:// ...

  2. Java学习——网络编程

    Java学习——网络编程 摘要:本文主要介绍了什么是网络编程,以及如何使用Java语言进行网络编程. 部分内容来自以下博客: https://www.cnblogs.com/renyuan/p/269 ...

  3. PHP工作岗位要求

    初级PHP 企业对初级PHP的要求是,在日常工作中,保证编码质量,对一般问题具有解决能力. 1.团队合作:经常是Git或者SVN.主要是为了能够融入敏捷开发团队2.前端:HTML.CSS.JS要精通. ...

  4. CSS animation属性

    定义和用法 animation属性是下列属性的一个缩写属性: animation-name animation-duration animation-timing-function animation ...

  5. 转:oracle 体系结构

    前几天面试的时候面试官才问过我ORACLE的体系结构,让我在一张白纸上画出来.回头想想当时答得还不错,大部分内容都描述出来了,呵呵,刚才在网上看到一篇讲解ORACLE体系结构的文章,觉得不错,转过来存 ...

  6. modbus_tk模块

    modbus_tk模块 通过modbus-RTU 读取地址,调用后返回反馈数值和故障信息. modbus_tk模块安装 pip install pymodbus_tk 下面代码功能:读取地址为0x42 ...

  7. Confluence 6.9.0 安装

    平台环境:centos 7.6 数据库版本:mysql-5.7.26,提前安装好,安装步骤略. 软件版本:Confluence6.9.0 所需软件:提前下载到本地电脑 atlassian-conflu ...

  8. 001-OpenStack-基础环境

    OpenStack-基础环境 1.实验描述 通过搭建 OpenStack 的 ocata 版,来学习虚拟化技术 2.实验环境 [你可能需要][CentOS 7 搭建模板机]点我快速打开文章 [你可能需 ...

  9. 关于如何自定义修改pytest-html报告深度学习总结

    第一.pytest-html执行命令总结: pytest test_case.py --html=report.html --self-contained-html 直接html独立显示pytest ...

  10. MAC自动化环境搭建

    UI自动化环境搭建 第一阶段:配置appium环境硬件配置mac系统电脑 java环境sunjiedeMacBook-Air:~ vicent$ java -versionjava version & ...