}
}
public static Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> getMetadataLocationEntries(SortedMap<Key,Value> entries) {
Key key;
Value val;
Text location = null;
Value prevRow = null;
KeyExtent ke;
SortedMap<KeyExtent,Text> results = new TreeMap<KeyExtent,Text>();
ArrayList<KeyExtent> locationless = new ArrayList<KeyExtent>();
Text lastRowFromKey = new Text();
// text obj below is meant to be reused in loop for efficiency
Text colf = new Text();
Text colq = new Text();
for (Entry<Key,Value> entry : entries.entrySet()) {
key = entry.getKey();
val = entry.getValue();
if (key.compareRow(lastRowFromKey) != 0) {
prevRow = null;
location = null;
key.getRow(lastRowFromKey);
}
colf = key.getColumnFamily(colf);
colq = key.getColumnQualifier(colq);
// interpret the row id as a key extent
if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY) || colf.equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
if (location != null) {
throw new IllegalStateException("Tablet has multiple locations : " + lastRowFromKey);
}
location = new Text(val.toString());
} else if (Constants.METADATA_PREV_ROW_COLUMN.equals(colf, colq)) {
prevRow = new Value(val);
}
if (prevRow != null) {
ke = new KeyExtent(key.getRow(), prevRow);
if (location != null)