Skip to content

Commit 202fe08

Browse files
llvieirakeith-turner
authored andcommitted
fixes #949 Used TimestampSkipping iterator in RollbackCheckIterator (#962)
1 parent 955c86f commit 202fe08

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class RollbackCheckIterator implements SortedKeyValueIterator<Key, Value> {
3535
private static final String TIMESTAMP_OPT = "timestampOpt";
3636

37-
private SortedKeyValueIterator<Key, Value> source;
37+
private TimestampSkippingIterator source;
3838
private long lockTime;
3939

4040
boolean hasTop = false;
@@ -50,7 +50,7 @@ public static void setLocktime(IteratorSetting cfg, long time) {
5050
@Override
5151
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options,
5252
IteratorEnvironment env) throws IOException {
53-
this.source = source;
53+
this.source = new TimestampSkippingIterator(source);
5454
this.lockTime = Long.parseLong(options.get(TIMESTAMP_OPT));
5555
}
5656

@@ -95,7 +95,8 @@ public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean i
9595
long ts = source.getTopKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;
9696

9797
if (colType == ColumnConstants.TX_DONE_PREFIX) {
98-
// do nothing if TX_DONE
98+
source.skipToPrefix(curCol, ColumnConstants.WRITE_PREFIX);
99+
continue;
99100
} else if (colType == ColumnConstants.WRITE_PREFIX) {
100101
long timePtr = WriteValue.getTimestamp(source.getTopValue().get());
101102

@@ -107,6 +108,12 @@ public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean i
107108
hasTop = true;
108109
return;
109110
}
111+
112+
if (lockTime > timePtr) {
113+
source.skipToPrefix(curCol, ColumnConstants.DEL_LOCK_PREFIX);
114+
continue;
115+
}
116+
110117
} else if (colType == ColumnConstants.DEL_LOCK_PREFIX) {
111118
if (ts > invalidationTime) {
112119
invalidationTime = ts;
@@ -117,6 +124,11 @@ public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean i
117124
return;
118125
}
119126

127+
if (lockTime > ts) {
128+
source.skipToPrefix(curCol, ColumnConstants.LOCK_PREFIX);
129+
continue;
130+
}
131+
120132
} else if (colType == ColumnConstants.LOCK_PREFIX) {
121133
if (ts > invalidationTime) {
122134
// nothing supersedes this lock, therefore the column is locked

0 commit comments

Comments
 (0)