---
title: "２。hbase CRUD--Read(query) operations"
author: "leibnitz"
date: "2013-08-15T16:41:33Z"
tags: []
categories: ["开源软件"]
slug: "hbase-crud-read-query-operations"
draft: false
lastmod: "2014-08-28T17:36:17Z"
id: 1925061
url: "https://leibnitz.iteye.com/blog/1925061"
---

read

![](http://dl2.iteye.com/upload/attachment/0088/2326/d798fb3e-f514-324f-b8af-0403586667b2.png)  
 

   
![](http://dl2.iteye.com/upload/attachment/0088/2328/56774874-1d81-3f49-a8f5-e17948d111c7.png)  
   
![](http://dl2.iteye.com/upload/attachment/0088/2330/0378ab1e-60af-3432-9eb3-ddf593804b32.png)  
 

Note:

-Gets will be **converted to scan per Get** in RS

-scan is **needless to use offset** for retrieving ranged rows.this is different from common RMDBS.and this is implemented by RS used KeyValueHeap to mark scan position

-in hbase,there is a param called "hbase.client.scanner.max.result.size" for limit the result size(bytes) from RS,so RS will use both this param and caching to **limit the rows** **to be returned**.

-as Batch #3　diagramed above ,client will use the endkey of batch #2 as startkey to relocate next region,

so it's **transparently implement scan cross region for** client .

-as u see,hbase **Scan is probed to regions continuously(NOT concurrently**),so **the returned results ordered by rowkeys in ascend**.once the results size is satisfied requirement,scan will be stoped there.

-I dont know why the scannerId is generated by random,and never check for duplication in regionserver!!

if you know ,give me a clue please~~ ( as [２。hbase CRUD--Lease in hbase](/blog/1929539) ,there is bug :)

```
protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
    long scannerId = -1L;
    scannerId = rand.nextLong();
    String scannerName = String.valueOf(scannerId);
    scanners.put(scannerName, s);   
    this.leases.createLease(scannerName, new ScannerListener(scannerName));
    return scannerId;
  }
```

 

ref:

### [２。hbase CRUD--Read(query) operations(server side)](/blog/1925106)