[
https://issues.apache.org/jira/browse/HBASE-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexey Kovyrin updated HBASE-2314:
----------------------------------
Fix Version/s: 0.21.0
Affects Version/s: 0.21.0
Status: Patch Available (was: In Progress)
Patch submitted to implement get_counter command and improve incr command:
{quote}
~/work/git/hbase (HBASE-2314)
[01:05] $ ./bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version: 0.21.0-SNAPSHOT, rUnknown, Tue Mar 9 23:15:28 EST 2010
hbase(main):001:0> get 'blah', 123, 'a:cnt'
COLUMN CELL
0 row(s) in 0.4100 seconds
hbase(main):002:0> get_counter 'blah', 123, 'a:cnt'
No counter found at specified coordinates
hbase(main):003:0> incr 'blah', 123, 'a:cnt'
COUNTER VALUE = 1
hbase(main):004:0> get_counter 'blah', 123, 'a:cnt'
COUNTER VALUE = 1
hbase(main):005:0> incr 'blah', 123, 'a:cnt'
COUNTER VALUE = 2
hbase(main):006:0> incr 'blah', 123, 'a:cnt'
COUNTER VALUE = 3
hbase(main):007:0> get_counter 'blah', 123, 'a:cnt'
COUNTER VALUE = 3
hbase(main):008:0> get 'blah', 123, 'a:cnt'
COLUMN CELL
a:cnt timestamp=1268460380431,
value=\x00\x00\x00\x00\x00\x00\x00\x03
1 row(s) in 0.0210 seconds
hbase(main):009:0>
{quote}
> [shell] Support for getting counters
> ------------------------------------
>
> Key: HBASE-2314
> URL: https://issues.apache.org/jira/browse/HBASE-2314
> Project: Hadoop HBase
> Issue Type: Improvement
> Affects Versions: 0.21.0
> Reporter: stack
> Assignee: Alexey Kovyrin
> Fix For: 0.21.0
>
> Attachments: HBASE-2314.patch
>
>
> From the list:
> {code}
> On Fri, Mar 12, 2010 at 7:11 AM, Ray Duong <[email protected]> wrote:
> > Hi Hbase,
> >
> > I'm a little confuse on how the auto increment works in Hbase. Shouldn't
> > the value be a number instead of a bytearray? Is there a way to convert the
> > value into a string?
> >
> >
> > hbase(main):013:0> create 'testcounter', 'cf'
> > 0 row(s) in 2.0950 seconds
> > 3854.986: [GC 3854.987: [ParNew: 19136K->1671K(19136K), 0.0175270 secs]
> > 27147K->11204K(83008K) icms_dc=7 , 0.0177320 secs] [Times: user=0.02
> > sys=0.03, real=0.01 secs]
> > hbase(main):014:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > 0 row(s) in 0.0080 seconds
> > hbase(main):015:0> incr 'testcounter', 'r1', 'cf:counter', 1
> > 0 row(s) in 0.0040 seconds
> > hbase(main):016:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > r1 column=cf:counter, timestamp=1268406376222,
> > value=\x00\x00\x00\x00\x00\x00\x00\x0
> >
> > 1
> >
> > 1 row(s) in 0.0110 seconds
> > hbase(main):017:0> incr 'testcounter', 'r1', 'cf:counter', 1
> > 0 row(s) in 0.0030 seconds
> > hbase(main):018:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > r1 column=cf:counter, timestamp=1268406376222,
> > value=\x00\x00\x00\x00\x00\x00\x00\x0
> >
> > 2
> >
> > 1 row(s) in 0.0090 seconds
> > hbase(main):019:0> incr 'testcounter', 'r1', 'cf:counter', 1
> > 0 row(s) in 0.0040 seconds
> > hbase(main):020:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > r1 column=cf:counter, timestamp=1268406376222,
> > value=\x00\x00\x00\x00\x00\x00\x00\x0
> >
> > 3
> >
> > 1 row(s) in 0.0080 seconds
> > hbase(main):021:0> incr 'testcounter', 'r1', 'cf:counter', 10
> > 0 row(s) in 0.0040 seconds
> > hbase(main):022:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > r1 column=cf:counter, timestamp=1268406376222,
> > value=\x00\x00\x00\x00\x00\x00\x00\x0
> >
> > D
> >
> > 1 row(s) in 0.0090 seconds
> > hbase(main):023:0> incr 'testcounter', 'r1', 'cf:counter', 100
> > 0 row(s) in 0.0030 seconds
> > hbase(main):024:0> scan 'testcounter'
> > ROW
> > COLUMN+CELL
> >
> > r1 column=cf:counter, timestamp=1268406376222,
> > value=\x00\x00\x00\x00\x00\x00\x00q
> > 1 row(s) in 0.0230 seconds
> >
> {code}
> Add support for counters, something that will get the cell value, turn it
> into a value and emit it as a jruby int.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.