hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Hutton <jesse.hut...@gmail.com>
Subject Re: java.lang.IllegalArgumentException in incrementColumnValue and Increment
Date Tue, 29 Mar 2011 19:23:06 GMT
AFAIK, (and maybe some experts can chime in here with some details) there is
no real way to over write a value in hbase. If you want to control the
number of versions, you can set the "max versions" property on the column
family, and that will be enforced whenever a major compaction occurs [1].

Jesse

1) http://www.outerthought.org/blog/465-ot.html

On Tue, Mar 29, 2011 at 12:43 PM, sulabh choudhury <sulabhc@gmail.com>wrote:

> I just realized that using the increment function creates another version,
> with a new timestamp.
> Is there a way we can use the previous TS, hence over writing the value ?
>
> On Tue, Mar 29, 2011 at 9:38 AM, sulabh choudhury <sulabhc@gmail.com>
> wrote:
>
> > Thanks Jesse. Changing the 10 to 10L made it work.
> >
> > On Tue, Mar 29, 2011 at 8:59 AM, Jesse Hutton <jesse.hutton@gmail.com
> >wrote:
> >
> >> Hi,
> >>
> >> It looks like the problem is that the initial value you're inserting in
> >> the column is an int, while HTable#incrementColumnValue() expects a
> long.
> >> Instead of:
> >>
> >>
> >>> I enter data by :-
> >>> theput.add(Bytes.toBytes("uid"),Bytes.toBytes("1"), 1301087829999L + t,
> >>> Bytes.toBytes(10))
> >>>
> >>
> >> try:
> >> theput.add(Bytes.toBytes("uid"),Bytes.toBytes("1"), 1301087829999L + t,
> >> Bytes.toBytes(10L));
> >>
> >> Jesse
> >>
> >>
> >>>
> >>> Now when I try to increment the value I have tried...
> >>> mytable.incrementColumnValue(Bytes.toBytes("row5"),
> >>> Bytes.toBytes("uid"),Bytes.toBytes("1"),Bytes.toBytes(1))
> >>> mytable.incrementColumnValue(Bytes.toBytes("row5"),
> >>> Bytes.toBytes("uid"),Bytes.toBytes("1"),1)
> >>>
> >>> also
> >>> val inc = new Increment(Bytes.toBytes("row" + 5))
> >>> inc.addColumn(Bytes.toBytes("uid"),Bytes.toBytes("1"),1)
> >>> mytable.increment(inc)
> >>>
> >>> In both of the cases, I get an error like
> >>> org.apache.hadoop.hbase.client.RetriesExhaustedException:
> >>> Exceptions:
> >>> java.io.IOException: java.io.IOException:
> >>> java.lang.IllegalArgumentException: offset (28) + length (8) exceed the
> >>> capacity of the array: 32
> >>> 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:3134)
> >>>  at
> >>>
> >>>
> org.apache.hadoop.hbase.regionserver.HRegionServer.incrementColumnValue(HRegionServer.java:2486)
> >>> at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
> >>>  at sun.reflec...
> >>>
> >>>
> >>> I guess I have tried all possible combinations of datatypes....I could
> >>> not
> >>> even find a decent example of incrementColumnValue()
> >>>
> >>
> >>
> >
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message