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 [mdr...@gmail.com] Sent: Thursday, March 08, 2012 23:28 To: user@hbase.apache.org Subject: Re: HTable.getEndKeys() returning empty results On Thu, Mar 8, 2012 at 2:50 PM, de Souza Medeiros Andre < andre.medei...@aalto.fi> 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: saint....@gmail.com [saint....@gmail.com] on behalf of Stack [ > st...@duboce.net] > Sent: Thursday, March 08, 2012 18:48 > To: user@hbase.apache.org > Subject: Re: HTable.getEndKeys() returning empty results > > On Thu, Mar 8, 2012 at 8:25 AM, de Souza Medeiros Andre > <andre.medei...@aalto.fi> 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 >