You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Pan W <pw...@gmail.com> on 2010/11/19 06:17:20 UTC
Confusing the retrieve result with a given timestamp
Hi,
I am using hbase shell to verify some konwleges that I have read from
the post of "Understanding HBase and BigTable"
That post says: "If an application asks for a given row at a given timestamp,
HBase will return cell data where the timestamp is less than or equal to
the one provided."
After some experiments, I feel confused about the concept of "less than" .
Describe details in the following :
1) create table:
create 'table', {NAME=>'cf1', VERSIONS=>3}
2) put some data in one cell with multi-version:
put 'table', 'row1', 'cf1:c1' , 'aaaa', 16
put 'table', 'row1', 'cf1:c1' , 'bbbb', 25
put 'table', 'row1', 'cf1:c1' , 'dddd', 32
3) get data:
get 'table', 'row1', {COLUMN=>'cf1:c1', TIMESTAMP=>19}
The result is NULL.
As the post says, The 'bbbb' with timestamp 16 that "less than" 19 should be returned,
Why get nothing?
(p.s I write some java code to verify the "less than" concept using
method setTimestamp(19) of class Get, and get same result . )
In addition, one more questions:
When I create table with parameter "VERSIONS=>3", means in one cell
only has not more than three version datas, is right?
If right, when I put more data into same cell, such as:
put 'table', 'row1', 'cf1:c1' ,'ffff', 42
Have four versions or three versions in this cell now?
why I can still retireve the oldest version data with timestamp 16?
hbase(main):022:0> get 'table', 'row1', {COLUMN=>'cf1:c1', TIMESTAMP=>16}
COLUMN CELL
cf1:c1 timestamp=16, value=aaaa
Sorry about the long mail, any help will be appreciated.
--
Pan W <pw...@gmail.com>
Re: Confusing the retrieve result with a given timestamp
Posted by Lars George <la...@gmail.com>.
Also see: https://issues.apache.org/jira/browse/HBASE-2470 (I
completely forgot I had opened it).
On Fri, Nov 19, 2010 at 2:15 PM, Pan W <pw...@gmail.com> wrote:
> Hi, Lars
>
> It's very nice of you to show the helpful blog to me. Now I see :-)
> --
> Pan W <pw...@gmail.com>
>
>
Re: Confusing the retrieve result with a given timestamp
Posted by Pan W <pw...@gmail.com>.
Hi, Lars
It's very nice of you to show the helpful blog to me. Now I see :-)
--
Pan W <pw...@gmail.com>
Re: Confusing the retrieve result with a given timestamp
Posted by Lars George <la...@gmail.com>.
Have a read here:
http://outerthought.org/blog/417-ot.html
Especially: "One interesting option that is missing is the ability to
retrieve the latest version less than or equal to a given timestamp,
thus giving the 'latest' state of the record at a certain point in
time. Update: this is (obviously) possible: just use a range from 0 to
the desired timestamp and set the max versions to 1 (thanks
Jonathan)."
Adding a time range to the Shell is trivial, currently it only
implements a fixed TIMESTAMP though. You could also use a Scan call
from the shell as that has a MINTIMESTAMP and MAXTIMESTAMP option.
That is for 0.20.x, apparently "someone" forgot to port this to 0.89?
Lars
On Fri, Nov 19, 2010 at 6:49 AM, Pan W <pw...@gmail.com> wrote:
> Hi, ryan, just as you say , now I am using setTimeRange to fulfill my request.
>
> I am just curious on the 'less than' concept,
>
> 'If an application asks for a given row at a given timestamp,
> HBase will return cell data where the timestamp is less than or
> equal to the one provided.'
>
> especially 'at a given timestamp' not time range...
>
> --
> Pan W <pw...@gmail.com>
>
>
Re: Confusing the retrieve result with a given timestamp
Posted by Pan W <pw...@gmail.com>.
Hi, ryan, just as you say , now I am using setTimeRange to fulfill my request.
I am just curious on the 'less than' concept,
'If an application asks for a given row at a given timestamp,
HBase will return cell data where the timestamp is less than or
equal to the one provided.'
especially 'at a given timestamp' not time range...
--
Pan W <pw...@gmail.com>
Re: Confusing the retrieve result with a given timestamp
Posted by Ryan Rawson <ry...@gmail.com>.
I'd have to look at the shell code, but its probably that the shell is
building the query to be 'give me the KV at TS=19'. The Java API lets
you specify both 'give me exact time' and 'give me time range'.
-ryan
On Thu, Nov 18, 2010 at 9:17 PM, Pan W <pw...@gmail.com> wrote:
> Hi,
>
> I am using hbase shell to verify some konwleges that I have read from
> the post of "Understanding HBase and BigTable"
>
> That post says: "If an application asks for a given row at a given timestamp,
> HBase will return cell data where the timestamp is less than or equal to
> the one provided."
> After some experiments, I feel confused about the concept of "less than" .
>
> Describe details in the following :
> 1) create table:
> create 'table', {NAME=>'cf1', VERSIONS=>3}
>
> 2) put some data in one cell with multi-version:
> put 'table', 'row1', 'cf1:c1' , 'aaaa', 16
> put 'table', 'row1', 'cf1:c1' , 'bbbb', 25
> put 'table', 'row1', 'cf1:c1' , 'dddd', 32
>
> 3) get data:
> get 'table', 'row1', {COLUMN=>'cf1:c1', TIMESTAMP=>19}
>
> The result is NULL.
> As the post says, The 'bbbb' with timestamp 16 that "less than" 19 should be returned,
> Why get nothing?
> (p.s I write some java code to verify the "less than" concept using
> method setTimestamp(19) of class Get, and get same result . )
>
>
> In addition, one more questions:
> When I create table with parameter "VERSIONS=>3", means in one cell
> only has not more than three version datas, is right?
> If right, when I put more data into same cell, such as:
> put 'table', 'row1', 'cf1:c1' ,'ffff', 42
> Have four versions or three versions in this cell now?
> why I can still retireve the oldest version data with timestamp 16?
> hbase(main):022:0> get 'table', 'row1', {COLUMN=>'cf1:c1', TIMESTAMP=>16}
> COLUMN CELL
> cf1:c1 timestamp=16, value=aaaa
>
>
> Sorry about the long mail, any help will be appreciated.
> --
> Pan W <pw...@gmail.com>
>
>