Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC62010612 for ; Tue, 3 Dec 2013 16:22:49 +0000 (UTC) Received: (qmail 70113 invoked by uid 500); 3 Dec 2013 16:22:46 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 69947 invoked by uid 500); 3 Dec 2013 16:22:46 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 69784 invoked by uid 99); 3 Dec 2013 16:22:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 16:22:44 +0000 X-ASF-Spam-Status: No, hits=2.4 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of vboylin1987@gmail.com designates 209.85.192.170 as permitted sender) Received: from [209.85.192.170] (HELO mail-pd0-f170.google.com) (209.85.192.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Dec 2013 16:22:39 +0000 Received: by mail-pd0-f170.google.com with SMTP id g10so20462618pdj.29 for ; Tue, 03 Dec 2013 08:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ZnGxAnpkdbCUOUu7tzog7VTUvmXQtKAd63LTTVUfvnA=; b=zo3XzN1ODFyn9Pe29EFn8fFCQUqpGE4CvHkB7xVcuoQD3CL2dEyIiAoQ8qrAF7mN2B 1HmQcYOLto9IOcJEV7uoLTndcsNctFSnjctvPa2IZSj7Iea1N8JQkF5pQLE3FV7PPCEd P4KEinyRRMGeQQY5kLJSVzJvBnBMpHPMEvIOU5ESAAHYHt3X3QXoFCDz73+BLo6p5INg ZaC49YDKkPnslTQv40NU63JcEjFT8BOC8lvNTNL82b6rsQOvd4k+AhSAkZ4VbprzeMSf K88fclxeegTKehJnj4DoLr7oHVnDYUyVHHb6HssJGMBeXLJY3/WJDslZZcJW8Ef8Ng4V QLOQ== MIME-Version: 1.0 X-Received: by 10.68.129.130 with SMTP id nw2mr39837315pbb.88.1386087737229; Tue, 03 Dec 2013 08:22:17 -0800 (PST) Received: by 10.70.36.102 with HTTP; Tue, 3 Dec 2013 08:22:17 -0800 (PST) Date: Wed, 4 Dec 2013 00:22:17 +0800 Message-ID: Subject: Strange Problem on using HRegion's getScanner Method in RegionServer From: Wukang Lin To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=047d7b10ccb53487f704eca3b35e X-Virus-Checked: Checked by ClamAV on apache.org --047d7b10ccb53487f704eca3b35e Content-Type: text/plain; charset=ISO-8859-1 Hi all, I got a trouble in using HRegion's RegionScanner in RegionServer. In my project, a custom RPC server was started in RegionServer using coprocessor mechanism, and it work well. In this RPC server, it receive a call from client, and scan the HRegion specialised by the params setted by the client like this: --------------------------------------------------------------------------------------------------------------------- HRegion region = this.getHRegionByEncodeName(encodeName); Scan scan = new Scan(); RegionScanner scanner = null; try { scanner = region.getScanner(scan); long total = 0; boolean hasNext = true; List kvs = new ArrayList(); while (hasNext) { kvs.clear(); hasNext = scanner.next(kvs); if (kvs.size() > 0) { total++; } } catch (IOException e) { LOG.warn("Exception thrown when scanning region '" + regionName + "', SKIP IT!", e); } finally { if (scanner != null) { try { scanner.close(); } catch (IOException e) { e.printStackTrace(); } } } LOG.info("Total " + total + " rows scanned."); --------------------------------------------------------------------------------------------------------------------- Then, I put a row to a HRegion by HTable interface, and make an RPC call of my custom RPC server to scan the HRegion(the code lines above is executed in a HRegionServer, a HRegion is scanned), and got nothing, total = 0. But if I use client side scan like HTable's scan interface or HBase shell, I can get the row I insert just now. I tried to flush the region and do a major compaction on the HRegion using hbase shell, Nothing changed. So, what's wrong with the code above? how to scan a HRegion in HRegionServer instance? Any responses is Appreciated! --047d7b10ccb53487f704eca3b35e--