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 58207E48F for ; Tue, 5 Feb 2013 18:45:33 +0000 (UTC) Received: (qmail 16748 invoked by uid 500); 5 Feb 2013 18:45:30 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 16662 invoked by uid 500); 5 Feb 2013 18:45:30 -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 16625 invoked by uid 500); 5 Feb 2013 18:45:30 -0000 Delivered-To: apmail-hadoop-hbase-user@hadoop.apache.org Received: (qmail 16612 invoked by uid 99); 5 Feb 2013 18:45:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 18:45:30 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yuzhihong@gmail.com designates 209.85.213.47 as permitted sender) Received: from [209.85.213.47] (HELO mail-yh0-f47.google.com) (209.85.213.47) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 18:45:22 +0000 Received: by mail-yh0-f47.google.com with SMTP id w68so61921yhw.6 for ; Tue, 05 Feb 2013 10:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=+eTvevzLajEtc1VZoDpj8DDttg5ALYO5LfsnUjPZyjw=; b=ZDT8iEgbcTwqSEipk88USkGdb1WBEd13Do9EXvethtEKms4ACh9ZwvWNr/k446wC80 FeF7Ejl8B7vNUjgM6Mirkkwbl1IQYm3QgKyydiw/9hiaWbzLH4r6/0jvGAVV7ajm6kUV kxwKHZws10hDyo8w4JKZB2+ZYDEGvpZ3oP10BfG8ZQLIIuXsdq11zFC3KK/nVZJy13YZ huPb+gXunNdFEotCjBTliURnbuhTC3vYJIJA1gAWqUqBinxu2LuGXsidUeVXtPBSQoNa oUsYLfayuMY1PyHiE4sPYoAuDQQqaVzj5YRQ9fO+6dJl4cJAVwVqAFBYD1ZDciCqVv0U koLw== MIME-Version: 1.0 X-Received: by 10.236.89.49 with SMTP id b37mr32468212yhf.33.1360089901086; Tue, 05 Feb 2013 10:45:01 -0800 (PST) Received: by 10.101.11.7 with HTTP; Tue, 5 Feb 2013 10:45:01 -0800 (PST) In-Reply-To: References: Date: Tue, 5 Feb 2013 10:45:01 -0800 Message-ID: Subject: Re: The Exceptions When Concurrently Writing and Reading From: Ted Yu To: user@hbase.apache.org, bing.li@asu.edu Cc: "hbase-user@hadoop.apache.org" Content-Type: multipart/alternative; boundary=20cf3011d8e76ab83004d4fe9bce X-Virus-Checked: Checked by ClamAV on apache.org --20cf3011d8e76ab83004d4fe9bce Content-Type: text/plain; charset=ISO-8859-1 To help us more easily correlate line numbers, can you tell us the version of HBase you're using ? Thanks On Tue, Feb 5, 2013 at 10:39 AM, Bing Li wrote: > Dear all, > > To raise the performance of writing data into HBase, the > "synchronized" is removed from the writing method. > > But after "synchronized" is removed from the method of writing, I get > the following exceptions when reading. Before the removal, no such > exceptions. > > Could you help me how to solve it? > > Thanks so much! > > Best wishes, > Bing > > Feb 6, 2013 12:21:31 AM > org.apache.hadoop.hbase.ipc.HBaseClient$Connection run > WARNING: Unexpected exception receiving call responses > java.lang.NullPointerException > at > org.apache.hadoop.hbase.io.HbaseObjectWritable.readObject(HbaseObjectWritable.java:521) > at > org.apache.hadoop.hbase.io.HbaseObjectWritable.readFields(HbaseObjectWritable.java:297) > at > org.apache.hadoop.hbase.ipc.HBaseClient$Connection.receiveResponse(HBaseClient.java:593) > at > org.apache.hadoop.hbase.ipc.HBaseClient$Connection.run(HBaseClient.java:505) > Feb 6, 2013 12:21:31 AM > org.apache.hadoop.hbase.client.ScannerCallable close > WARNING: Ignore, probably already closed > java.io.IOException: Call to greatfreeweb/127.0.1.1:60020 > failed on local exception: java.io.IOException: Unexpected exception > receiving call responses > at > org.apache.hadoop.hbase.ipc.HBaseClient.wrapException(HBaseClient.java:934) > at > org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:903) > at > org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150) > at $Proxy6.close(Unknown Source) > at > org.apache.hadoop.hbase.client.ScannerCallable.close(ScannerCallable.java:112) > at > org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:74) > at > org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:39) > at > org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getRegionServerWithRetries(HConnectionManager.java:1325) > at > org.apache.hadoop.hbase.client.HTable$ClientScanner.nextScanner(HTable.java:1167) > at > org.apache.hadoop.hbase.client.HTable$ClientScanner.next(HTable.java:1296) > at > org.apache.hadoop.hbase.client.HTable$ClientScanner$1.hasNext(HTable.java:1356) > at > com.greatfree.hbase.rank.NodeRankRetriever.LoadNodeGroupNodeRankRowKeys(NodeRankRetriever.java:348) > at > com.greatfree.ranking.PersistNodeGroupNodeRanksThread.run(PersistNodeGroupNodeRanksThread.java:29) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:662) Caused by: > java.io.IOException: Unexpected exception receiving call responses > at > org.apache.hadoop.hbase.ipc.HBaseClient$Connection.run(HBaseClient.java:509) > Caused by: java.lang.NullPointerException > at > org.apache.hadoop.hbase.io.HbaseObjectWritable.readObject(HbaseObjectWritable.java:521) > at > org.apache.hadoop.hbase.io.HbaseObjectWritable.readFields(HbaseObjectWritable.java:297) > at > org.apache.hadoop.hbase.ipc.HBaseClient$Connection.receiveResponse(HBaseClient.java:593) > at > org.apache.hadoop.hbase.ipc.HBaseClient$Connection.run(HBaseClient.java:505) > > The writing method is as follows. > > > // The "synchronized" is removed to raise the performance. > // public synchronized void AddNodeViewGroupNodeRanks(String > hostNodeKey, String groupKey, int timingScale, Map > groupNodeRankMap) > > public void AddNodeViewGroupNodeRanks(String hostNodeKey, String > groupKey, int timingScale, Map groupNodeRankMap) > { > List puts = new ArrayList(); > Put hostNodeKeyPut; > Put groupKeyPut; > Put timingScalePut; > Put nodeKeyPut; > Put rankPut; > > byte[] groupNodeRankRowKey; > > for (Map.Entry nodeRankEntry : > groupNodeRankMap.entrySet()) > { > groupNodeRankRowKey = Bytes.toBytes(...); > > hostNodeKeyPut = new Put(groupNodeRankRowKey); > hostNodeKeyPut.add(...); > puts.add(hostNodeKeyPut); > ...... > > rankPut = new Put(groupNodeRankRowKey); > rankPut.add(...); > puts.add(rankPut); > } > > try > { > this.rankTable.put(puts); > } > catch (IOException e) > { > e.printStackTrace(); > } > } > > > The reading method that causes the exceptions is as follows. > > public Set LoadNodeGroupNodeRankRowKeys(String > hostNodeKey, String groupKey, int timingScale) > { > List nodeGroupFilterList = new ArrayList(); > > SingleColumnValueFilter hostNodeKeyFilter = new > SingleColumnValueFilter(...); > hostNodeKeyFilter.setFilterIfMissing(true); > nodeGroupFilterList.add(hostNodeKeyFilter); > > ...... > > FilterList nodeGroupFilter = new > FilterList(nodeGroupFilterList); > Scan scan = new Scan(); > scan.setFilter(nodeGroupFilter); > scan.setCaching(Parameters.CACHING_SIZE); > scan.setBatch(Parameters.BATCHING_SIZE); > > Set rowKeySet = Sets.newHashSet(); > try > { > ResultScanner scanner = > this.rankTable.getScanner(scan); > > // EXCEPTIONS are raised at the following line. > for (Result result : scanner) > { > for (KeyValue kv : result.raw()) > { > rowKeySet.add(Bytes.toString(kv.getRow())); > break; > } > } > scanner.close(); > } > catch (IOException e) > { > e.printStackTrace(); > } > return rowKeySet; > } > --20cf3011d8e76ab83004d4fe9bce--