hbase源码学习之put
11页1、hbasehbase 源码学习之源码学习之 putputhbase-0.90.5一,首先来看下 put 的构造函数:ts 为时间戳,public Put(byte row) this(row, null);, public Put(byte row, RowLock rowLock) this(row, HConstants.LATEST_TIMESTAMP, rowLock);, public Put(byte row, RowLock rowLock) this(row, HConstants.LATEST_TIMESTAMP, rowLock);,public Put(byte row, long ts) this(row, ts, null);,public Put(byte row, long ts, RowLock rowLock) if(row = null | row.length HConstants.MAX_ROW_LENGTH) throw new IllegalArgumentException(“Row key is invalid“);this.row =
2、Arrays.copyOf(row, row.length);this.timestamp = ts;if(rowLock != null) this.lockId = rowLock.getLockId();看到的时候很明显了,有传入的参数 key,如果时间戳为空,则为 null,如果传入的 rowlock 不为空,那么就通过 rowLock.getLockId()拿到 lockId,赋值给当前 lockid. 638 棋牌 http:/另外还有个public Put(Put putToCopy) Copy constructor. Creates a Put operation cloned from the specified Put.this.writeToWAL = putToCopy.writeToWAL;HBase 中 WAL(Write Ahead Log) 的存储格式二,add 操作:public Put add(byte family, byte qualifier, long ts, byte value) List list = getKeyValueList(
3、family);KeyValue kv = createPutKeyValue(family, qualifier, ts, value);list.add(kv);familyMap.put(kv.getFamily(), list);return this;List list先取出依据 family 从 familyMap 拿到 List list,如果 list 为空,则创建一个 list,然后依据参数 family, qualifier, ts, value 生成一个 KeyValue然后将 KeyValue 放入 familyMap 中private List getKeyValueList(byte family) List list = familyMap.get(family);if(list = null) list = new ArrayList(0);return list;早来看下 htable 的 put 方法:private void doPut(final List puts) throws IOException int n = 0;for (Put p
4、ut : puts) validatePut(put);writeBuffer.add(put);currentWriteBufferSize += put.heapSize();/ we need to periodically see if the writebuffer is full instead of waiting until the end of the Listn+;if (n % DOPUT_WB_CHECK = 0 if (autoFlush | currentWriteBufferSize writeBufferSize) flushCommits();如果 currentWriteBufferSize writeBufferSize,此时就会调用 flushCommits()方法。天地棋牌 http:/Overridepublic void flushCommits() throws IOException try connection.processBatchOfPuts(writeBuffer, tableName, pool); finally if (
《hbase源码学习之put》由会员m****分享,可在线阅读,更多相关《hbase源码学习之put》请在金锄头文库上搜索。
DB2发生死锁情况时应该怎么处理
Python 为何能成最强编程语言
面试前必须要知道的Redis面试
MySQL下自动删除指定时间以前的记录的操作方法
深入理解FastCGI协议以及在PHP中的实现
MySQL数据库性能优化之硬件瓶颈分析
NoSQL数据库大全收集整理
2018 – 2019 年前端 JavaScript 面试题
PHP文件包含漏洞的形式总结
5种使用Python代码轻松实现数据可视化的方法
改进JavaScript和Bust的互操作性:深入认识wasm-bindgen组件
C#图片缩放平移从功能分析到编码实现
详解网络蜘蛛的安全隐患及预防方法
利用NAP解除安全隐患自动隐藏你的IP地址
解决分布式数据库和离线网络中原子性问题的新方法
bbed恢复数据遇到延迟块清除的问题
Oracle Data Redaction数据加密
linux下du和df结果不一致的原因及处理
基于QMP实现对qemu虚拟机进行交互
解读Java并发队列BlockingQueue
2023-06-30 7页
2022-09-15 93页
2022-06-04 27页
2022-04-25 3页
2022-03-24 7页
2022-03-24 7页
2022-03-24 8页
2022-03-24 4页
2022-03-24 43页
2022-03-24 7页