hbase源码分析HTable ->getScanner(final Scan scan)源码分析
来源:互联网 发布:网络写作平台17k 编辑:程序博客网 时间:2024/05/29 04:46
HTable ->getScanner(final Scan scan)源码分析
1、判断scan.getBatch() > 0 && scan.isSmall()
batch默认为-1
small默认为false
定义如下:
/**
* Set it true for small scan to get better performance
*
* Small scan should use pread and big scan can use seek + read
*
* seek + read is fast but can cause two problem (1) resource contention (2)
* cause too much network io
*
* [89-fb] Using pread for non-compaction read request
* https://issues.apache.org/jira/browse/HBASE-7266
*
* On the other hand, if setting it true, we would do
* openScanner,next,closeScanner in one RPC call. It means the better
* performance for small scan. [HBASE-9488].
*
* Generally, if the scan range is within one data block(64KB), it could be
* considered as a small scan.
*/
private boolean small = false;
如果判断为true,则抛出异常
throw new IllegalArgumentException("Small scan should not be used with batching");
也就是说如果scan是small就不能batch
2、判断scan.getCaching() <= 0
如果为true从配置文件中hbase.client.scanner.caching读取,如果不存在,返回值为Integer.MAX_VALUE
3、判断scan.getMaxResultSize() <= 0
maxResultSize默认值为-1,if语句为true,则从配置文件中hbase.client.scanner.max.result.size中读取,如果不存在,返回值为2 * 1024 * 1024
/**
* scan总共分为四种类型:
* 1、reversed、small--ClientSmallReversedScanner
* 2、reversed、big--ReversedClientScanner
* 3、notReversed、small--ClientSmallScanner
* 4、notReversed、big--ClientScanner
*/
4、判断scan.isReversed()
/**
* Get whether this scan is a reversed one.
* @return true if backward scan, false if forward(default) scan
*/
4.1、判断scan.isSmall()
/**
* Get whether this scan is a small scan
* @return true if small scan
*/
true:
return new ClientSmallReversedScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
false:
return new ReversedClientScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
5、判断scan.isSmall()
true:
return new ClientSmallScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
false:
return new ClientScanner(getConfiguration(), scan, getName(), this.connection,
this.rpcCallerFactory, this.rpcControllerFactory,
1、判断scan.getBatch() > 0 && scan.isSmall()
batch默认为-1
small默认为false
定义如下:
/**
* Set it true for small scan to get better performance
*
* Small scan should use pread and big scan can use seek + read
*
* seek + read is fast but can cause two problem (1) resource contention (2)
* cause too much network io
*
* [89-fb] Using pread for non-compaction read request
* https://issues.apache.org/jira/browse/HBASE-7266
*
* On the other hand, if setting it true, we would do
* openScanner,next,closeScanner in one RPC call. It means the better
* performance for small scan. [HBASE-9488].
*
* Generally, if the scan range is within one data block(64KB), it could be
* considered as a small scan.
*/
private boolean small = false;
如果判断为true,则抛出异常
throw new IllegalArgumentException("Small scan should not be used with batching");
也就是说如果scan是small就不能batch
2、判断scan.getCaching() <= 0
如果为true从配置文件中hbase.client.scanner.caching读取,如果不存在,返回值为Integer.MAX_VALUE
3、判断scan.getMaxResultSize() <= 0
maxResultSize默认值为-1,if语句为true,则从配置文件中hbase.client.scanner.max.result.size中读取,如果不存在,返回值为2 * 1024 * 1024
/**
* scan总共分为四种类型:
* 1、reversed、small--ClientSmallReversedScanner
* 2、reversed、big--ReversedClientScanner
* 3、notReversed、small--ClientSmallScanner
* 4、notReversed、big--ClientScanner
*/
4、判断scan.isReversed()
/**
* Get whether this scan is a reversed one.
* @return true if backward scan, false if forward(default) scan
*/
4.1、判断scan.isSmall()
/**
* Get whether this scan is a small scan
* @return true if small scan
*/
true:
return new ClientSmallReversedScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
false:
return new ReversedClientScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
5、判断scan.isSmall()
true:
return new ClientSmallScanner(getConfiguration(), scan, getName(),
this.connection, this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
false:
return new ClientScanner(getConfiguration(), scan, getName(), this.connection,
this.rpcCallerFactory, this.rpcControllerFactory,
pool, tableConfiguration.getReplicaCallTimeoutMicroSecondScan());
接下来再一个一个分析
0 0
- hbase源码分析HTable ->getScanner(final Scan scan)源码分析
- HBase 0.92.1 Scan 源码详细分析
- HBase的Scan实现源码分析
- go-hbase的Scan模型源码分析
- HBase源码分析:HTable put过程
- HBase scan的客户端分析
- hbase HTable之Put、delete、get等源码分析
- HBase的scan源码分析客户端部分之整体流程(一)
- HBase源码学习 客户端scan过程
- spring启动component-scan类扫描加载过程---源码分析
- spring启动component-scan类扫描加载过程---源码分析
- spring启动component-scan类扫描加载过程---源码分析
- spring启动component-scan类扫描加载过程---源码分析
- spring启动component-scan类扫描加载过程---源码分析
- Android wpa_supplicant源码分析–扫描scan过程
- HBase分析之Get、Scan(一)
- hbase-1.2.1之scan、batch操作的源码学习
- Wi-Fi scan 分析
- hdu 2037贪心(选择不相交区间)
- Android(三)创建第一个android项目
- create synonym cimmgr.table_B for cimmgr.table_A; alter table cimmgr.table_a rename to table_c;
- MiniGUI输入法模块mGi软键盘使用实例
- 使用sh -x调试shell脚本
- hbase源码分析HTable ->getScanner(final Scan scan)源码分析
- iOS-数据存储之FMDB
- webGL第四课
- 主键增长策略
- mysql 分表修改语句
- 杭电-1114 Piggy-Bank(完全背包)
- 返回字符串
- centos7下使用yum安装mysql
- [XUPort笔记]修改的XUPorter,提供代码编辑