You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by kt...@apache.org on 2017/10/30 15:11:48 UTC

[fluo] branch master updated: fixes #949 Used TimestampSkipping iterator in RollbackCheckIterator (#962)

This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo.git


The following commit(s) were added to refs/heads/master by this push:
     new 202fe08  fixes #949 Used TimestampSkipping iterator in RollbackCheckIterator (#962)
202fe08 is described below

commit 202fe08cd58619be0db74300147876d5300cfdab
Author: Lucas Vieira <li...@gmail.com>
AuthorDate: Thu Oct 26 01:35:06 2017 -0300

    fixes #949 Used TimestampSkipping iterator in RollbackCheckIterator (#962)
---
 .../fluo/accumulo/iterators/RollbackCheckIterator.java | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

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 5129b1d..962f172 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 @@ 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

-- 
To stop receiving notification emails like this one, please contact
['"commits@fluo.apache.org" <co...@fluo.apache.org>'].