fixes Used TimestampSkipping iterator in RollbackCheckIterator
@@ -34,7 +34,7 @@ import org.apache.fluo.accumulo.values.WriteValue;
public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value> {
private static final String TIMESTAMP_OPT = "timestampOpt";
- private SortedKeyValueIterator<Key, Value> source;
+ private TimestampSkippingIterator source;
private long lockTime;
boolean hasTop = false;
@@ -50,7 +50,7 @@ public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value>
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options,
IteratorEnvironment env) throws IOException {
- this.source = source;
+ this.source = new TimestampSkippingIterator(source);
this.lockTime = Long.parseLong(options.get(TIMESTAMP_OPT));
}
@@ -95,7 +95,8 @@ public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value>
long ts = source.getTopKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;
if (colType == ColumnConstants.TX_DONE_PREFIX) {
- // do nothing if TX_DONE
+ source.skipToPrefix(curCol, ColumnConstants.WRITE_PREFIX);
+ continue;
} else if (colType == ColumnConstants.WRITE_PREFIX) {
long timePtr = WriteValue.getTimestamp(source.getTopValue().get());
@@ -107,6 +108,12 @@ public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value>
hasTop = true;
return;
}
+
+ if (lockTime > timePtr) {
+ source.skipToPrefix(curCol, ColumnConstants.DEL_LOCK_PREFIX);
+ continue;
+ }
+
} else if (colType == ColumnConstants.DEL_LOCK_PREFIX) {
if (ts > invalidationTime) {
invalidationTime = ts;
@@ -117,6 +124,11 @@ public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value>
return;
}
+ if (lockTime > ts) {
+ source.skipToPrefix(curCol, ColumnConstants.LOCK_PREFIX);
+ continue;
+ }
+
} else if (colType == ColumnConstants.LOCK_PREFIX) {
if (ts > invalidationTime) {
// nothing supersedes this lock, therefore the column is locked
