keith-turner closed pull request #962: Using TimestampSkipping iterator in
RollbackCheckIterator
URL: https://github.com/apache/fluo/pull/962
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java
b/modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java
index 5129b1dc..962f1725 100644
---
a/modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java
+++
b/modules/accumulo/src/main/java/org/apache/fluo/accumulo/iterators/RollbackCheckIterator.java
@@ -34,7 +34,7 @@
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 static void setLocktime(IteratorSetting cfg, long
time) {
@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 void seek(Range range, Collection<ByteSequence>
columnFamilies, boolean i
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 void seek(Range range, Collection<ByteSequence>
columnFamilies, boolean i
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 void seek(Range range, Collection<ByteSequence>
columnFamilies, boolean i
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
diff --git
a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
index eeb16934..4d75fbd2 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/VisibilityCache.java
@@ -49,7 +49,8 @@ public int weigh(Bytes key, ColumnVisibility vis) {
VisibilityCache(FluoConfiguration conf) {
visCache = CacheBuilder.newBuilder()
-
.expireAfterAccess(FluoConfigurationImpl.getVisibilityCacheTimeout(conf,
TimeUnit.MILLISECONDS),
+ .expireAfterAccess(
+ FluoConfigurationImpl.getVisibilityCacheTimeout(conf,
TimeUnit.MILLISECONDS),
TimeUnit.MILLISECONDS)
.maximumWeight(FluoConfigurationImpl.getVisibilityCacheSize(conf)).weigher(new
VisWeigher())
.concurrencyLevel(10).build();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services