in modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java [69:162]
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
range = IteratorUtil.maximizeStartKeyTimeStamp(range);
if (columnFamilies.isEmpty() && !inclusive) {
source.seek(range, SnapshotIterator.NOTIFY_CF_SET, false);
} else {
source.seek(range, columnFamilies, inclusive);
}
Key curCol = new Key();
if (source.hasTop()) {
curCol.set(source.getTopKey());
// TODO can this optimization cause problems?
if (!curCol.equals(range.getStartKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
return;
}
}
long invalidationTime = -1;
hasTop = false;
while (source.hasTop()
&& curCol.equals(source.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
ColumnType colType = ColumnType.from(source.getTopKey());
long ts = source.getTopKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;
switch (colType) {
case TX_DONE:
source.skipToPrefix(curCol, ColumnType.WRITE);
continue;
case WRITE: {
long timePtr = WriteValue.getTimestamp(source.getTopValue().get());
if (timePtr > invalidationTime) {
invalidationTime = timePtr;
}
if (lockTime == timePtr) {
hasTop = true;
return;
}
if (lockTime > timePtr) {
source.skipToPrefix(curCol, ColumnType.DEL_LOCK);
continue;
}
break;
}
case DEL_LOCK: {
if (ts > invalidationTime) {
invalidationTime = ts;
}
if (ts == lockTime) {
hasTop = true;
return;
}
if (lockTime > ts) {
source.skipToPrefix(curCol, ColumnType.LOCK);
continue;
}
break;
}
case RLOCK: {
source.skipToPrefix(curCol, ColumnType.LOCK);
continue;
}
case LOCK: {
if (ts > invalidationTime) {
// nothing supersedes this lock, therefore the column is locked
hasTop = true;
return;
}
break;
}
case DATA: {
// can stop looking
return;
}
case ACK: {
// do nothing if ACK
break;
}
default:
throw new IllegalArgumentException();
}
source.next();
}
}