You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by yo...@apache.org on 2018/11/13 10:15:55 UTC

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

[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/6e1e8197
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/6e1e8197
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/6e1e8197

Branch: refs/heads/1.0.0
Commit: 6e1e8197d3b011ffec2367ef88dc2284c6bed9d0
Parents: ec1c6da
Author: Ohad Shacham <oh...@yahoo-inc.com>
Authored: Tue Jul 31 17:23:34 2018 +0300
Committer: Yonatan Gottesman <yo...@gmail.com>
Committed: Tue Nov 13 10:03:10 2018 +0200

----------------------------------------------------------------------
 .../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/6e1e8197/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/6e1e8197/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);