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 2630A18FE7 for ; Fri, 18 Dec 2015 22:59:44 +0000 (UTC) Received: (qmail 25522 invoked by uid 500); 18 Dec 2015 22:59:42 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 25451 invoked by uid 500); 18 Dec 2015 22:59:42 -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 25434 invoked by uid 99); 18 Dec 2015 22:59:42 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Dec 2015 22:59:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id DA163C06B9 for ; Fri, 18 Dec 2015 22:59:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id DaFkgq4g25io for ; Fri, 18 Dec 2015 22:59:40 +0000 (UTC) Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com [209.85.160.174]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 388D4429C4 for ; Fri, 18 Dec 2015 22:59:40 +0000 (UTC) Received: by mail-yk0-f174.google.com with SMTP id p130so75414596yka.1 for ; Fri, 18 Dec 2015 14:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Zj6HaG1W7Mobx/AO5oOZLZ/99WDQGFXpqSmiwi3NWsk=; b=TbjQP9UEPVv2N0PofFCXzpKRXwo3BkBD4vgildw4mnR0wUzgN5L7NEKt/6YntFKhNu 8Mm5ksM2xmp0G1TEkh+R5T9x6WxW3vrWbMnFKitcFqd+Ij+MOgMDO6HQ+FudHYH3liVo EnNv829UVxNK2dtRP+XqF7ErAM7QhS3eGiwZjntu4SK6ao5cLjvQAc0phsSJFsLZIktC oZ2FqSXl5WBgHEtakOWEjR8bp6Zcqk+s4cxh5+Xi4XfYbvzIy9Mk2VfvqhVoDICcncng L8WkH4Mn5DFS3H00Yqj9LGeaHDj3LqeHZI+J+9rXjWorvH+quQR7/MWhuzYwU5mSfBKu MW8Q== MIME-Version: 1.0 X-Received: by 10.13.223.21 with SMTP id i21mr5267133ywe.20.1450479579854; Fri, 18 Dec 2015 14:59:39 -0800 (PST) Received: by 10.37.56.202 with HTTP; Fri, 18 Dec 2015 14:59:39 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Dec 2015 14:59:39 -0800 Message-ID: Subject: Re: java.lang.reflect.InvocationTargetException when doing batch with large number of increment From: Ted Yu To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=001a114e43ba1c7d2d0527341833 --001a114e43ba1c7d2d0527341833 Content-Type: text/plain; charset=UTF-8 Here is related code from AsyncProcess: if (results.length != actions.size()) { throw new AssertionError("results.length"); } It means that the length of results (0 in your case) is not the same as number of Action's Please create results array with proper length. Cheers On Wed, Dec 16, 2015 at 12:01 PM, Keith Lui wrote: > Hi, > > Tried to do a 10K increment with batch. When using > public void batch(List actions, Object[] results) > got > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at com.simontuffs.onejar.Boot.run(Boot.java:340) > at com.simontuffs.onejar.Boot.main(Boot.java:166) > Caused by: java.lang.AssertionError: results.length > at > > org.apache.hadoop.hbase.client.AsyncProcess$AsyncRequestFutureImpl.(AsyncProcess.java:763) > at > > org.apache.hadoop.hbase.client.AsyncProcess.createAsyncRequestFuture(AsyncProcess.java:1578) > at > > org.apache.hadoop.hbase.client.AsyncProcess.submitAll(AsyncProcess.java:554) > at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:1000) > > Interestingly no exception is thrown when using the deprecated method > public Object[] batch(List actions) > > This is a sample code in Scala: > > val table = connection.getTable(TableName.valueOf("test_table")) > val increments = for (i <- 0 until 10000) yield > > { val increment = new Increment(Random.nextDouble().toString.getBytes) > increment.addColumn(family, qualifier, Random.nextLong()) increment } > > table.batch(increments, Array.empty[Object]) > > Same issue happens when running in Apache Spark Streaming which tries to > consume data from Kafka and writes to HBase. > > java.lang.AssertionError: results.length > at > > org.apache.hadoop.hbase.client.AsyncProcess$AsyncRequestFutureImpl.(AsyncProcess.java:763) > at > > org.apache.hadoop.hbase.client.AsyncProcess.createAsyncRequestFuture(AsyncProcess.java:1578) > at > > org.apache.hadoop.hbase.client.AsyncProcess.submitAll(AsyncProcess.java:554) > at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:1000) > > This error will not show up and run smoothly when using the deprecated > batch method. > --001a114e43ba1c7d2d0527341833--