Class KeyExtent
- java.lang.Object
-
- org.apache.accumulo.core.dataImpl.KeyExtent
-
- All Implemented Interfaces:
Comparable<KeyExtent>
public class KeyExtent extends Object implements Comparable<KeyExtent>
keeps track of information needed to identify a tablet
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(KeyExtent other)booleancontains(KeyExtent oke)Determine if another KeyExtent is wholly contained within the range of this one.booleancontains(org.apache.hadoop.io.BinaryComparable row)Determine if the provided row is contained within the range of this KeyExtent.static KeyExtentcopyOf(KeyExtent original)Create a copy of a provided KeyExtent.org.apache.hadoop.io.TextendRow()Returns this extent's end rowbooleanequals(Object o)static Set<KeyExtent>findOverlapping(KeyExtent nke, SortedMap<KeyExtent,?> extents)static Set<KeyExtent>findOverlapping(KeyExtent nke, SortedSet<KeyExtent> extents)static KeyExtentfromMetaPrevRow(Map.Entry<Key,Value> prevRowEntry)Create a KeyExtent from a metadata previous end row entry.static KeyExtentfromMetaRow(org.apache.hadoop.io.Text encodedMetadataRow)Create a KeyExtent from the table ID and the end row encoded in the row field of a tablet's metadata entry, with no previous end row.static KeyExtentfromMetaRow(org.apache.hadoop.io.Text encodedMetadataRow, org.apache.hadoop.io.Text prevEndRow)Create a KeyExtent from the table ID and the end row encoded in the row field of a tablet's metadata entry, along with a previous end row.static KeyExtentfromTabletId(TabletId tabletId)Create a KeyExtent from aTabletId.static KeyExtentfromThrift(TKeyExtent tke)Create a KeyExtent from its Thrift form.UUIDgetUUID()Retrieve a unique identifier for this tablet that is useful for logging, without revealing the contents of the end row and previous end row.inthashCode()booleanisMeta()booleanisPreviousExtent(KeyExtent prevExtent)booleanisRootTablet()Stringobscured()booleanoverlaps(KeyExtent other)org.apache.hadoop.io.TextprevEndRow()Return the previous extent's end rowstatic KeyExtentreadFrom(DataInput in)Create a KeyExtent from a serialized form.TableIdtableId()Return the extent's table ID.RangetoDataRange()Compute a representation of this extent as a Range suitable for scanning this extent's table and retrieving all data between this extent's previous end row (exclusive) and its end row (inclusive) in that table (or another table in the same range, since the returned range does not specify the table to scan).RangetoMetaRange()Compute a representation of this extent as a Range suitable for scanning the corresponding metadata table for this extent's table, and retrieving all the metadata for the table's tablets between this extent's previous end row (exclusive) and its end row (inclusive) in that table.org.apache.hadoop.io.TexttoMetaRow()Return a serialized form of the table ID and end row for this extent, in a form suitable for use in the row portion of metadata entries for the tablet this extent represents.StringtoString()TKeyExtenttoThrift()Convert to Thrift form.voidwriteTo(DataOutput out)Serialize this KeyExtent.
-
-
-
Constructor Detail
-
KeyExtent
public KeyExtent(TableId table, org.apache.hadoop.io.Text endRow, org.apache.hadoop.io.Text prevEndRow)
Create a new KeyExtent from its components.- Parameters:
table- the ID for the tableendRow- the last row in this tablet, or null if this is the last tablet in this tableprevEndRow- the last row in the immediately preceding tablet for the table, or null if this represents the first tablet in this table
-
-
Method Detail
-
copyOf
public static KeyExtent copyOf(KeyExtent original)
Create a copy of a provided KeyExtent.- Parameters:
original- the KeyExtent to copy
-
fromThrift
public static KeyExtent fromThrift(TKeyExtent tke)
Create a KeyExtent from its Thrift form.- Parameters:
tke- the KeyExtent in its Thrift object form
-
toThrift
public TKeyExtent toThrift()
Convert to Thrift form.
-
fromMetaPrevRow
public static KeyExtent fromMetaPrevRow(Map.Entry<Key,Value> prevRowEntry)
Create a KeyExtent from a metadata previous end row entry.- Parameters:
prevRowEntry- a provided previous end row entry from the metadata table, stored in the"~tab"column family and"~pr"column. If the individual components are needed, considerKeyExtent(TableId, Text, Text)orfromMetaRow(Text, Text)instead.
-
fromMetaRow
public static KeyExtent fromMetaRow(org.apache.hadoop.io.Text encodedMetadataRow)
Create a KeyExtent from the table ID and the end row encoded in the row field of a tablet's metadata entry, with no previous end row.- Parameters:
encodedMetadataRow- the encodedtableIdandendRowfrom a metadata entry, as inentry.getKey().getRow()or fromMetadataSchema.TabletsSection.encodeRow(TableId, Text)
-
fromMetaRow
public static KeyExtent fromMetaRow(org.apache.hadoop.io.Text encodedMetadataRow, org.apache.hadoop.io.Text prevEndRow)
Create a KeyExtent from the table ID and the end row encoded in the row field of a tablet's metadata entry, along with a previous end row.- Parameters:
encodedMetadataRow- the encodedtableIdandendRowfrom a metadata entry, as inentry.getKey().getRow()or fromMetadataSchema.TabletsSection.encodeRow(TableId, Text)prevEndRow- the unencoded previous end row (a copy will be made)
-
fromTabletId
public static KeyExtent fromTabletId(TabletId tabletId)
Create a KeyExtent from aTabletId.- Parameters:
tabletId- theTabletIdto convert to a KeyExtent
-
toMetaRow
public org.apache.hadoop.io.Text toMetaRow()
Return a serialized form of the table ID and end row for this extent, in a form suitable for use in the row portion of metadata entries for the tablet this extent represents.
-
tableId
public TableId tableId()
Return the extent's table ID.
-
endRow
public org.apache.hadoop.io.Text endRow()
Returns this extent's end row
-
prevEndRow
public org.apache.hadoop.io.Text prevEndRow()
Return the previous extent's end row
-
readFrom
public static KeyExtent readFrom(DataInput in) throws IOException
Create a KeyExtent from a serialized form.- Throws:
IOException- See Also:
writeTo(DataOutput)
-
writeTo
public void writeTo(DataOutput out) throws IOException
Serialize this KeyExtent.- Throws:
IOException- See Also:
readFrom(DataInput)
-
compareTo
public int compareTo(KeyExtent other)
- Specified by:
compareToin interfaceComparable<KeyExtent>
-
getUUID
public UUID getUUID()
Retrieve a unique identifier for this tablet that is useful for logging, without revealing the contents of the end row and previous end row.
-
contains
public boolean contains(KeyExtent oke)
Determine if another KeyExtent is wholly contained within the range of this one. * @param oke- Returns:
- true if and only if the provided KeyExtent is contained within the range of this one
-
contains
public boolean contains(org.apache.hadoop.io.BinaryComparable row)
Determine if the provided row is contained within the range of this KeyExtent.- Returns:
- true if and only if the provided row is contained within the range of this one
-
toDataRange
public Range toDataRange()
Compute a representation of this extent as a Range suitable for scanning this extent's table and retrieving all data between this extent's previous end row (exclusive) and its end row (inclusive) in that table (or another table in the same range, since the returned range does not specify the table to scan).For example, if this extent represented a range of data from
AtoZfor tableT, the resulting Range could be used to scan tableT's data in the exclusive-inclusive range(A,Z], or the same range in another table,T2.
-
toMetaRange
public Range toMetaRange()
Compute a representation of this extent as a Range suitable for scanning the corresponding metadata table for this extent's table, and retrieving all the metadata for the table's tablets between this extent's previous end row (exclusive) and its end row (inclusive) in that table.For example, if this extent represented a range of data from
AtoZfor a user table,T, this would compute the range to scanaccumulo.metadatathat would include all the the metadata forT's tablets that contain data in the range(A,Z].
-
findOverlapping
public static Set<KeyExtent> findOverlapping(KeyExtent nke, SortedSet<KeyExtent> extents)
-
overlaps
public boolean overlaps(KeyExtent other)
-
findOverlapping
public static Set<KeyExtent> findOverlapping(KeyExtent nke, SortedMap<KeyExtent,?> extents)
-
isPreviousExtent
public boolean isPreviousExtent(KeyExtent prevExtent)
-
isMeta
public boolean isMeta()
-
isRootTablet
public boolean isRootTablet()
-
obscured
public String obscured()
-
-