Hbase put写入源码分析
今天有空闲时间看一下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写入源码分析的更多相关文章
- 【RocketMQ源码分析】深入消息存储(1)
最近在学习RocketMQ相关的东西,在学习之余沉淀几篇笔记. RocketMQ有很多值得关注的设计点,消息发送.消息消费.路由中心NameServer.消息过滤.消息存储.主从同步.事务消息等等. ...
- Hbase写入hdfs源码分析
版权声明:本文由熊训德原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/258 来源:腾云阁 https://www.qclo ...
- Hbase WAL线程模型源码分析
版权声明:本文由熊训德原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/257 来源:腾云阁 https://www.qclo ...
- Hbase源码分析:Hbase UI中Requests Per Second的具体含义
Hbase源码分析:Hbase UI中Requests Per Second的具体含义 让运维加监控,被问到Requests Per Second(见下图)的具体含义是什么?我一时竟回答不上来,虽然大 ...
- 浅谈ZooKeeper基本原理与源码分析
最近一直有小伙伴私信我,问一些关于Zookeeper的知识,下边关于的Zookeeper的知识整理了一下,一起学习一下. 看完本文对于Zookeeper想深入全面了解的读者朋友们,小编这里整理了一份更 ...
- spark源码分析以及优化
第一章.spark源码分析之RDD四种依赖关系 一.RDD四种依赖关系 RDD四种依赖关系,分别是 ShuffleDependency.PrunDependency.RangeDependency和O ...
- 图解Janusgraph系列-图数据底层序列化源码分析(Data Serialize)
图解Janusgraph系列-图数据底层序列化源码分析(Data Serialize) 大家好,我是洋仔,JanusGraph图解系列文章,实时更新~ 图数据库文章总目录: 整理所有图相关文章,请移步 ...
- 【图解源码】Zookeeper3.7源码分析,包含服务启动流程源码、网络通信源码、RequestProcessor处理请求源码
Zookeeper3.7源码剖析 能力目标 能基于Maven导入最新版Zookeeper源码 能说出Zookeeper单机启动流程 理解Zookeeper默认通信中4个线程的作用 掌握Zookeepe ...
- zookeeper源码分析之四服务端(单机)处理请求流程
上文: zookeeper源码分析之一服务端启动过程 中,我们介绍了zookeeper服务器的启动过程,其中单机是ZookeeperServer启动,集群使用QuorumPeer启动,那么这次我们分析 ...
随机推荐
- 10道Python常见面试题
1.MySQL索引种类 1.普通索引 2.唯一索引 3.主键索引 4.组合索引 5.全文索引 2.索引在什么情况下遵循最左前缀的规则? 最左前缀原理的一部分,索引index1:(a,b,c),只会走a ...
- dtd语法
dtd语法 <!ELEMENT 元素名 约束> //简单元素三种:没有子元素的元素 eg: <!ELEMENT name (#PCDATA)> (#PCDATA):约束name ...
- 在Angular4中使用ng2-baidu-map详解
一.引言 之前在Angular4使用过百度地图,记录一下踩过的坑 二.实现 1.安装 npm install angular2-baidu-map 2.在app.module.ts配置 ak key在 ...
- Python 安装第三方库,pip install 安装慢,安装不上的解决办法
今天来说一下,有些刚刚接触python的朋友,在使用pip install安装python 第三方库的过程中 会出现网速很慢,或者是安装下载到中途,停止,卡主,或者是下载报错等问题.如下图: 还有一些 ...
- NCcat学习使用
一.使用手册 1.简介:nc/NetCat是一款端口监听工具,可以用来建立系统之间的连接.传输文件.TCP代理等. 2.命令参数 nc [-options] hostname port[s] ...
- pdfium
https://github.com/SubtleCow/AccessControlListsintheDOM/tree/4673d995e5614bc682cecd22f9b2919b2360273 ...
- 201871010111-刘佳华《面向对象程序设计(java)》第四周学习总结
201871010111-刘佳华<面向对象程序设计(java)>第四周学习总结 实验时间 2019-9-20 第一部分:总结第四章理论知识 4.1:类与对象的概念. 类:类是构造对象的模板 ...
- 【使用篇二】SpringBoot单元测试(10)
SpringCloud单元测试:https://www.cnblogs.com/myitnews/p/11796321.html 1. 创建项目Maven Project,修改pom.xml < ...
- Artificial Intelligence in Finance
https://sigmoidal.io/real-applications-of-ai-in-finance/ Artificial Intelligence is taking the finan ...
- 洛谷 U86564 排队形
洛谷 U86564 排队形 题目传送门 题目背景 \(JDFZ2019\)秋季运动会开始辣!为了使强大的高一 · \(6\)班有一个更好的精神面貌,班主任\(T\)老师和体委\(LY\),\(LYB\ ...