Increment expects a long as per returned by Bytes.toBytes(long). ie: 8 bytes, big endian.
you put '1' array length 1. when increment finds no value, it assumes '0'. if you want 0 based counting dont put an initial value. On Fri, Feb 25, 2011 at 12:23 AM, Sandesh Devaraju <[email protected]> wrote: > Hi All, > > Surely, I'm doing something wrong here! > > # hbase shell > 11/02/25 08:22:31 WARN conf.Configuration: DEPRECATED: hadoop-site.xml > found in the classpath. Usage of hadoop-site.xml is deprecated. > Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to > override properties of core-default.xml, mapred-default.xml and > hdfs-default.xml respectively > HBase Shell; enter 'help<RETURN>' for list of supported commands. > Type "exit<RETURN>" to leave the HBase Shell > Version: 0.89.20100924+28, r, Mon Oct 11 09:52:07 PDT 2010 > > hbase(main):008:0> create 'test', {NAME => 'foo', VERSIONS => 1} > 0 row(s) in 1.1380 seconds > > hbase(main):011:0> put 'test', 'spam', 'foo:bar', 1 > 0 row(s) in 0.0280 seconds > > hbase(main):012:0> scan 'test' > ROW COLUMN+CELL > spam column=foo:bar, > timestamp=1298621905598, value=1 > 1 row(s) in 0.0930 seconds > > hbase(main):013:0> incr 'test', 'spam', 'foo:bar', 1 > > ERROR: org.apache.hadoop.hbase.client.RetriesExhaustedException: > Trying to contact region server > ec2-67-202-23-98.compute-1.amazonaws.com:60020 for region > test,,1298621872571.b9f9ed863ab27cf3a94a5279222e2557., row 'spam', but > failed after 7 attempts. > Exceptions: > java.io.IOException: java.io.IOException: > java.lang.IllegalArgumentException: offset (30) + length (8) exceed > the capacity of the array: 31 > at > org.apache.hadoop.hbase.util.Bytes.explainWrongLengthOrOffset(Bytes.java:502) > at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:480) > at > org.apache.hadoop.hbase.regionserver.HRegion.incrementColumnValue(HRegion.java:2884) > at > org.apache.hadoop.hbase.regionserver.HRegionServer.incrementColumnValue(HRegionServer.java:2448) > at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:561) > at > org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039) > > > Any help here would be much appreciated. > > Thanks, > Sandesh >
