hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-16497 Add test for backup / restore involving MOB table
Date Thu, 08 Sep 2016 19:38:57 GMT
Repository: hbase
Updated Branches:
  refs/heads/HBASE-7912 8f6e3a63f -> 4c9ecdf86


HBASE-16497 Add test for backup / restore involving MOB table


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4c9ecdf8
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4c9ecdf8
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4c9ecdf8

Branch: refs/heads/HBASE-7912
Commit: 4c9ecdf8637e9569ea0e14cb43c7e0860acbf2c5
Parents: 8f6e3a6
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Sep 8 12:38:52 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Sep 8 12:38:52 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/backup/TestRemoteBackup.java       | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4c9ecdf8/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java
index cc351e1..4f4f7ad 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java
@@ -28,6 +28,8 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.snapshot.MobSnapshotTestingUtils;
+import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Threads;
@@ -53,6 +55,7 @@ public class TestRemoteBackup extends TestBackupBase {
     final CountDownLatch latch = new CountDownLatch(1);
     final int NB_ROWS_IN_FAM3 = 6;
     final byte[] fam3Name = Bytes.toBytes("f3");
+    final byte[] fam2Name = Bytes.toBytes("f2");
     final Connection conn = ConnectionFactory.createConnection(conf1);
     Thread t = new Thread() {
       @Override
@@ -79,15 +82,23 @@ public class TestRemoteBackup extends TestBackupBase {
     t.start();
 
     table1Desc.addFamily(new HColumnDescriptor(fam3Name));
+    // family 2 is MOB enabled
+    HColumnDescriptor hcd = new HColumnDescriptor(fam2Name);
+    hcd.setMobEnabled(true);
+    hcd.setMobThreshold(0L);
+    table1Desc.addFamily(hcd);
     HBaseTestingUtility.modifyTableSync(TEST_UTIL.getAdmin(), table1Desc);
 
+    SnapshotTestingUtils.loadData(TEST_UTIL, table1, 50, fam2Name);
+    HTable t1 = (HTable) conn.getTable(table1);
+    int rows0 = MobSnapshotTestingUtils.countMobRows(t1, fam2Name);
+
     latch.countDown();
     String backupId = backupTables(BackupType.FULL,
       Lists.newArrayList(table1), BACKUP_REMOTE_ROOT_DIR);
     assertTrue(checkSucceeded(backupId));
     
     LOG.info("backup complete " + backupId);
-    HTable t1 = (HTable) conn.getTable(table1);
     Assert.assertThat(TEST_UTIL.countRows(t1, famName), CoreMatchers.equalTo(NB_ROWS_IN_BATCH));
 
     t.join();
@@ -113,6 +124,9 @@ public class TestRemoteBackup extends TestBackupBase {
     Assert.assertThat(TEST_UTIL.countRows(hTable, famName), CoreMatchers.equalTo(NB_ROWS_IN_BATCH));
     int cnt3 = TEST_UTIL.countRows(hTable, fam3Name);
     Assert.assertTrue(cnt3 >= 0 && cnt3 <= NB_ROWS_IN_FAM3);
+
+    int rows1 = MobSnapshotTestingUtils.countMobRows(t1, fam2Name);
+    Assert.assertEquals(rows0, rows1);
     hTable.close();
 
     hAdmin.close();


Mime
View raw message