accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher <ctubb...@apache.org>
Subject Re: How to get the first key of the Tablet servers
Date Tue, 16 Jun 2015 13:37:14 GMT
Actually, scanning `new Range($endRow)` will only give you keys in
that last row (if it exists).

You'd actually want to scan:

[null, $endRow] :: for the first split point, $endRow
($endRow, $endRow2] :: for each sequence of two split points, $endRow
and $endRow2
($endRow, null) :: for the last split point

You can use the constructor, `Range(Text, boolean, Text, boolean)` for
the startRow and stopRow (with inclusive flag set for each, when
appropriated).

Optionally, you could create a simple iterator based on the provided
FirstEntryInRowIterator, called "FirstEntryInTablet", which just
returns one item and then nothing else, and then simply scan the
entire table with the default options. The only thing returned would
be the first entries in each tablet.

Of course, all this is assuming you want the first actual (existing)
key for each tablet. If you want the first key a tablet could
theoretically contain, that's even easier... no scanning necessary.
That's just a key comprised of the split point + '\0' for the row, and
empty values for everything else (except the first tablet... in the
first tablet, the first possible key has a empty byte string for the
row).


--
Christopher L Tubbs II
http://gravatar.com/ctubbsii


On Tue, Jun 16, 2015 at 1:24 AM, Josh Elser <josh.elser@gmail.com> wrote:
> Not sure I understand your question. Do you mean of a Tablet instead of
> TabletServer? A TabletServer will host many Tablets.
>
> Assuming so, the easiest way to get the first key for each Tablet is to
> fetch the split points for a table. The split points are the end-row of each
> Tablet in a table.
>
> Then, to get the first keys in each Tablet, construct a `new
> Range($endRow)`, open a Scanner and fetch the first Key. Make sure you also
> do this with `new Range()` as well to get the first Key in the first Tablet
> for the table (the Tablet which starts at -inf).
>
> There is no easy way that I can think of to determine what the last key in a
> Tablet is. What is the reason that you want to explicitly know this? Maybe
> there is a different to do what you're trying to do?
>
> - Josh
>
>
> Rukshan Chathuranga wrote:
>>
>> hi,
>>
>> Does anyone know how to get the first or last key of the tablet servers?
>>
>> Thanks and Regards.
>>
>> /Rukshan Chathuranga./
>> /Department Of Computer Science & Engineering,
>> /
>> /Faculty Of Engineering,
>> /
>> /University Of Moratuwa. //Sri Lanka./
>> /WEB: http://www.rukspot.com/ <http://rukspot.com/>
>> /
>>
>

Mime
View raw message