今天有空闲时间看一下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 处理中文遇到的编码问题总结 以及 字符str的编码如何判断

    如何处理中午编码的问题 Python的UnicodeDecodeError: 'utf8' codec can't decode byte 0xxx in position 这个错误是因为你代码中的某 ...

  2. 微信和QQ可以关闭广告了,每次能关6个月

    微信和QQ可以关闭广告了,这次腾讯真的是良心了,虽然不能完全关闭,但是每次能关6个月,也能清静不少时间. 关闭地址:点击进入

  3. JPA笔记2 OneToMany

    package one_to_many; import java.util.HashSet; import java.util.Set; import javax.persistence.Cascad ...

  4. tushare库:免费的python财经数据接口

    tushare官网以及在线文档http://tushare.org/ 安装    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tus ...

  5. AWS之EC2实例搭建LAMP服务器

    在 Amazon Linux 2 上安装 LAMP Web 服务器 创建EC2实例,在安全组添加HTTP(80)规则 步骤 1:准备 LAMP 服务器 1.使用putty连接到你的EC2实例上(AMI ...

  6. linux (06) redis安装

    redis安装 一.在linux安装redis,通过源码编译安装redis 1.下载源码包 wget http://download.redis.io/releases/redis-4.0.10.ta ...

  7. re 模块详解

    1.re 模块 regex 1.查找 :findall 意思"匹配所有,每一项都是列表的组成元素" 有返回值 import re ret=re.findall("\d+& ...

  8. python gyp

    https://github.com/bnoordhuis/gyp 所以,手动加了这个变量 https://blog.csdn.net/weixin_30576827/article/details/ ...

  9. 201871010104-陈园园 《面向对象程序设计(java)》第八周学习总结

    201871010104-陈园园 <面向对象程序设计(java)>第八周学习总结 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ ...

  10. android SDK安装Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-1.xml出错 解决方案

    更换代理服务器:http://mirrors.neusoft.edu.cn 端口:80 reload 解决 若以上不成功在hosts文件中添加以下内容 #Google主页203.208.46.146 ...