You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by oh...@apache.org on 2018/07/31 14:23:43 UTC

incubator-omid git commit: [OMID-106] Delete should use write timestamp when writing family deletion marker. This is noticeable after a checkpoint.

Repository: incubator-omid
Updated Branches:
  refs/heads/phoenix-integration 7d0986ecb -> 1fdd260e5


[OMID-106] Delete should use write timestamp when writing
 family deletion marker. This is noticeable after a checkpoint.


Project: http://git-wip-us.apache.org/repos/asf/incubator-omid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-omid/commit/1fdd260e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/1fdd260e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/1fdd260e

Branch: refs/heads/phoenix-integration
Commit: 1fdd260e56cccfa160ee9ceb10366c34f768b480
Parents: 7d0986e
Author: Ohad Shacham <oh...@yahoo-inc.com>
Authored: Tue Jul 31 17:23:34 2018 +0300
Committer: Ohad Shacham <oh...@yahoo-inc.com>
Committed: Tue Jul 31 17:23:34 2018 +0300

----------------------------------------------------------------------
 .../org/apache/omid/transaction/TTable.java     |  2 +-
 .../apache/omid/transaction/TestCheckpoint.java | 37 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/1fdd260e/hbase-client/src/main/java/org/apache/omid/transaction/TTable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/omid/transaction/TTable.java b/hbase-client/src/main/java/org/apache/omid/transaction/TTable.java
index aab2e2f..1331b87 100644
--- a/hbase-client/src/main/java/org/apache/omid/transaction/TTable.java
+++ b/hbase-client/src/main/java/org/apache/omid/transaction/TTable.java
@@ -245,7 +245,7 @@ public class TTable implements Closeable {
 
         HBaseTransaction transaction = enforceHBaseTransactionAsParam(tx);
 
-        final long writeTimestamp = transaction.getStartTimestamp();
+        final long writeTimestamp = transaction.getWriteTimestamp();
         boolean deleteFamily = false;
 
         final Put deleteP = new Put(delete.getRow(), writeTimestamp);

http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/1fdd260e/hbase-client/src/test/java/org/apache/omid/transaction/TestCheckpoint.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/omid/transaction/TestCheckpoint.java b/hbase-client/src/test/java/org/apache/omid/transaction/TestCheckpoint.java
index 078ea5f..65a2ac5 100644
--- a/hbase-client/src/test/java/org/apache/omid/transaction/TestCheckpoint.java
+++ b/hbase-client/src/test/java/org/apache/omid/transaction/TestCheckpoint.java
@@ -20,6 +20,7 @@ package org.apache.omid.transaction;
 import java.util.List;
 
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -298,6 +299,42 @@ public class TestCheckpoint extends OmidTestBase {
     }
 
     @Test(timeOut = 30_000)
+    public void testDeleteAfterCheckpoint(ITestContext context) throws Exception {
+        TransactionManager tm = newTransactionManager(context);
+        TTable tt = new TTable(hbaseConf, TEST_TABLE);
+
+        byte[] rowName1 = Bytes.toBytes("row1");
+        byte[] famName1 = Bytes.toBytes(TEST_FAMILY);
+        byte[] colName1 = Bytes.toBytes("col1");
+        byte[] dataValue1 = Bytes.toBytes("testWrite-1");
+
+        Transaction tx1 = tm.begin();
+
+        Put row1 = new Put(rowName1);
+        row1.add(famName1, colName1, dataValue1);
+        tt.put(tx1, row1);
+
+        tm.commit(tx1);
+
+        Transaction tx2 = tm.begin();
+
+        HBaseTransaction hbaseTx2 = enforceHBaseTransactionAsParam(tx1);
+
+        hbaseTx2.checkpoint();
+
+        Delete d = new Delete(rowName1);
+        tt.delete(tx2, d);
+
+        try {
+            tm.commit(tx2);
+        } catch (TransactionException e) {
+            Assert.fail();
+        }
+
+        tt.close();
+    }
+
+    @Test(timeOut = 30_000)
     public void testOutOfCheckpoints(ITestContext context) throws Exception {
         TransactionManager tm = newTransactionManager(context);