Hbase source code analysis: org. Apache. hadoop. hbase. Client package

Source: Internet
Author: User

SCAN: sets scan record conditions, buffer size, cache size, and other resultscanner scanner: Provides the scan interface, clientscaner: implements the client resultscanner scanner, and data is distributed between multiple region, read in sequence. Usage: htableinterface TBL = NULL; TBL = table. gettable ("table_name"); scan = new scan (); // Set the number of records cached by the client. When the next method is called, data of the cache size is returned from the server at one time and cached on the client. When the next method is called, the next data is obtained directly from the client cache. Scan. setcaching (100); scan. setcacheblocks (true); scan. setstartrow (usernum + "10 "). getbytes (); scan. setstoprow (usernum + "20 "). getbytes (); clscaner = (clientlistener) TBL. getscaner (SCAN); Result [] rets = clscaner. next (); // obtain the result of the next row [] rets = clscaner. limit (START, pagesize); // in the next method, do while loop calls the nextscanner method to determine whether to end scan. The condition for loop completion is, the size of the retrieved records reaches the caching size, or the returned data is null if it cannot meet the filter conditions of the server side, or the current It is the last region or when the stoprowkey of the scan is less than the endkey of the current region, the scan is automatically terminated and the scan is not performed by the next region. Htable: Provides interfaces to interact with a single table, including put, get, and delete. It also provides the resultscaner creation method, which is non-thread-safe and htablepool is thread-safe. All the above operations on the region will eventually perform the servercallable operation on the regionserver. Next, let's focus on this class. A servercallale is a region operation class for a server. It locates the region (hregionlocation) based on startrow and obtains the server instance on which the location of the region is located (hregioninterface, the client proxy of the hregionserver ), call the call method to connect to the server instance and obtain data. In the call method of implementation class scanercallable, call the next method of hregioninterface (client proxy of hregionserver) to obtain results. After the hregionserver is connected through the RPC protocol, the regionscaner of the current region is performed inside the server (filtered Based on the configured startrow, endrow, and filter ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.