Ok, now I'm not sure if I what I just said can be done.

According to Lars George's book, in HBase "there are no index files that allow 
such direct access of a particular row or column.". Does this mean that my scan 
"starting" at the given pointer will actually start scanning from the beginning 
of the block in HFile, ignoring everything until it scans the row I specified 
as the start? 
________________________________________
From: de Souza Medeiros Andre [[email protected]]
Sent: Friday, March 09, 2012 12:02
To: [email protected]
Subject: RE: HTable.getEndKeys() returning empty results

Hi Drz,

Yes, I've thought about that problem. But I've got an idea that sounds quite 
ok. Since scanning seems to be the only way of getting the last data row of 
table A, one can implement a "counter" table (single row, single column) to 
point to the row in A where the scanner should start. The counter value can be 
periodically updated to improve the performance of scanners.

Thanks for the support

-- Andre Medeiros
________________________________________
From: Michael Drzal [[email protected]]
Sent: Thursday, March 08, 2012 23:28
To: [email protected]
Subject: Re: HTable.getEndKeys() returning empty results

On Thu, Mar 8, 2012 at 2:50 PM, de Souza Medeiros Andre <
[email protected]> wrote:

> Thanks for the answer.
> This is quite confusing though, what is the point of having a method to
> retrieve the last key if we know that anyway it will be an empty byte array?
>
> Or does this happen only with one-region tables?
>
> Any way, is there some way of getting the last _data_ row of a table?
> Other than scanning the whole thing...
>

Think about it this way:

   - the last key for the region is key099
   - you insert key100
   - you insert key101
   - you insert key102

Do you really want the meta table updated for each an every insert that
touches the end?

  Drz


> Thanks,
> - Andre Medeiros
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Stack [
> [email protected]]
> Sent: Thursday, March 08, 2012 18:48
> To: [email protected]
> Subject: Re: HTable.getEndKeys() returning empty results
>
> On Thu, Mar 8, 2012 at 8:25 AM, de Souza Medeiros Andre
> <[email protected]> wrote:
> > Hi all,
> >
> > Has someone had problems with HTable.getEndKeys() method? In my
> application it returns an array of byte[], but the first (and only) byte[]
> is empty, so essentially it's telling me that the (single) region has no
> end key.
> >
> > The table has 3 rows and I'm running standalone HBase 0.90.4 CDH3u3 on
> my local machine. Moreover, the call getEndKeys() is executed immediately
> after I put rows in the table.
> >
> > Do I need to wait until the .META. table gets updated with the regions'
> end row keys?
> > Does HTable.getEndKeys() work only in a fully distributed mode?
> > Is there any other way of getting the last row in a table? (this is my
> objective after all)
> >
>
> An empty byte array is the last key in a table of one region only.  An
> hbase table uses empty byte array as both the start and end row
> signifier as per the bigtable paper (I don't see this explicitly
> called out in the reference guide but I'm probably not looking in
> right place).
>
> St.Ack
>

Reply via email to