hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject [1/2] hbase git commit: HBASE-12802 Remove unnecessary Table.flushCommits() (Solomon Duskis)
Date Mon, 05 Jan 2015 23:55:23 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 071c3026f -> 0311cc860


http://git-wip-us.apache.org/repos/asf/hbase/blob/0311cc86/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index 6eb272c..2c0f03b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -117,17 +118,13 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          Table table = null;
-          try {
-            table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "&" + SECRET));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
-          } finally {
-            table.close();
           }
           return null;
         }
@@ -163,11 +160,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row2);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -206,17 +202,13 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          Table table = null;
-          try {
-            table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL));
             d.deleteFamilyVersion(fam, 123l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
-          } finally {
-            table.close();
           }
           return null;
         }
@@ -252,17 +244,13 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          Table table = null;
-          try {
-            table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL));
-            d.deleteColumn(fam, qual, 123l);
+            d.addColumn(fam, qual, 123l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
-          } finally {
-            table.close();
           }
           return null;
         }
@@ -291,19 +279,16 @@ public class TestVisibilityLabelsWithDeletes {
   public void testVisibilityLabelsWithDeleteColumnsWithMultipleVersions() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
-            d.deleteColumns(fam, qual, 125l);
+            d.addColumns(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -341,10 +326,6 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -353,32 +334,28 @@ public class TestVisibilityLabelsWithDeletes {
       throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumns(fam, qual);
-            table.delete(d);
+          try (Table table = new HTable(conf, tableName)) {
+            Delete d1 = new Delete(row1);
+            d1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+            d1.addColumns(fam, qual);
 
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumns(fam, qual);
-            table.delete(d);
-            table.flushCommits();
+            table.delete(d1);
 
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
+            Delete d2 = new Delete(row1);
+            d2.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
+            d2.addColumns(fam, qual);
+            table.delete(d2);
+
+            Delete d3 = new Delete(row1);
+            d3.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + SECRET + "&" + TOPSECRET + ")"));
-            d.deleteColumns(fam, qual);
-            table.delete(d);
-            table.flushCommits();
+            d3.addColumns(fam, qual);
+            table.delete(d3);
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -391,16 +368,12 @@ public class TestVisibilityLabelsWithDeletes {
       s.setAuthorizations(new Authorizations(SECRET, PRIVATE, CONFIDENTIAL, TOPSECRET));
       ResultScanner scanner = table.getScanner(s);
       Result[] next = scanner.next(3);
-      assertTrue(next.length == 1);
+      assertEquals(1, next.length);
       CellScanner cellScanner = next[0].cellScanner();
       cellScanner.advance();
       Cell current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -410,32 +383,27 @@ public class TestVisibilityLabelsWithDeletes {
       throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
 
             d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
-            table.flushCommits();
 
             d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + SECRET + "&" + TOPSECRET + ")"));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -459,10 +427,6 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -471,32 +435,27 @@ public class TestVisibilityLabelsWithDeletes {
       throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteFamily(fam);
-            table.delete(d);
-
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteFamily(fam);
-            table.delete(d);
-            table.flushCommits();
-
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
+          try (Table table = new HTable(conf, tableName)) {
+            Delete d1 = new Delete(row1);
+            d1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+            d1.addFamily(fam);
+            table.delete(d1);
+
+            Delete d2 = new Delete(row1);
+            d2.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
+            d2.addFamily(fam);
+            table.delete(d2);
+
+            Delete d3 = new Delete(row1);
+            d3.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + SECRET + "&" + TOPSECRET + ")"));
-            d.deleteFamily(fam);
-            table.delete(d);
-            table.flushCommits();
+            d3.addFamily(fam);
+            table.delete(d3);
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -509,31 +468,25 @@ public class TestVisibilityLabelsWithDeletes {
       s.setAuthorizations(new Authorizations(SECRET, PRIVATE, CONFIDENTIAL, TOPSECRET));
       ResultScanner scanner = table.getScanner(s);
       Result[] next = scanner.next(3);
-      assertTrue(next.length == 1);
+      assertEquals(1, next.length);
       CellScanner cellScanner = next[0].cellScanner();
       cellScanner.advance();
       Cell current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
   @Test
   public void testVisibilityLabelsWithDeleteFamilyWithPutsReAppearing() throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -546,13 +499,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -573,13 +524,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -599,25 +548,19 @@ public class TestVisibilityLabelsWithDeletes {
       scanner = table.getScanner(s);
       Result[] next1 = scanner.next(3);
       assertEquals(next1.length, 0);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
   @Test
   public void testVisibilityLabelsWithDeleteColumnsWithPutsReAppearing() throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -630,13 +573,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -657,13 +598,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -683,25 +622,19 @@ public class TestVisibilityLabelsWithDeletes {
       scanner = table.getScanner(s);
       Result[] next1 = scanner.next(3);
       assertEquals(next1.length, 0);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
   @Test
   public void testVisibilityCombinations() throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, 123l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -710,23 +643,23 @@ public class TestVisibilityLabelsWithDeletes {
       put.add(fam, qual, 124l, value1);
       put.setCellVisibility(new CellVisibility(SECRET));
       table.put(put);
-      table.flushCommits();
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumns(fam, qual, 126l);
+            d.addColumns(fam, qual, 126l);
             table.delete(d);
+          } catch (Throwable t) {
+            throw new IOException(t);
+          }
 
-            table = new HTable(conf, tableName);
-            d = new Delete(row1);
+          try (Table table = new HTable(conf, tableName)) {
+            Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumn(fam, qual, 123l);
+            d.addColumn(fam, qual, 123l);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -740,57 +673,52 @@ public class TestVisibilityLabelsWithDeletes {
       ResultScanner scanner = table.getScanner(s);
       Result[] next = scanner.next(3);
       assertEquals(next.length, 0);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
   @Test
   public void testVisibilityLabelsWithDeleteColumnWithSpecificVersionWithPutsReAppearing()
       throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
-      Put put = new Put(Bytes.toBytes("row1"));
-      put.add(fam, qual, 123l, value);
-      put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-      table.put(put);
-      put = new Put(Bytes.toBytes("row1"));
-      put.add(fam, qual, 123l, value1);
-      put.setCellVisibility(new CellVisibility(SECRET));
-      table.put(put);
-      table.flushCommits();
-      //TEST_UTIL.getHBaseAdmin().flush(tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+
+    try (Table table = new HTable(conf, tableName)) {
+      Put put1 = new Put(Bytes.toBytes("row1"));
+      put1.add(fam, qual, 123l, value);
+      put1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+
+      Put put2 = new Put(Bytes.toBytes("row1"));
+      put2.add(fam, qual, 123l, value1);
+      put2.setCellVisibility(new CellVisibility(SECRET));
+      table.put(createList(put1, put2));
+
       Scan s = new Scan();
       s.setMaxVersions(5);
       s.setAuthorizations(new Authorizations(CONFIDENTIAL, SECRET));
+
       ResultScanner scanner = table.getScanner(s);
-      Result[] next = scanner.next(3);
-      assertEquals(next.length, 1);
+      assertEquals(scanner.next(3).length, 1);
+      scanner.close();
+
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumn(fam, qual, 123l);
+            d.addColumn(fam, qual, 123l);
             table.delete(d);
+          }
 
-            table = new HTable(conf, tableName);
-            d = new Delete(row1);
+          try (Table table = new HTable(conf, tableName)) {
+            Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumn(fam, qual, 123l);
+            d.addColumn(fam, qual, 123l);
             table.delete(d);
-            table.flushCommits();
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -802,12 +730,8 @@ public class TestVisibilityLabelsWithDeletes {
       s.setMaxVersions(5);
       s.setAuthorizations(new Authorizations(CONFIDENTIAL));
       scanner = table.getScanner(s);
-      next = scanner.next(3);
-      assertEquals(next.length, 0);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
+      assertEquals(scanner.next(3).length, 0);
+      scanner.close();
     }
   }
 
@@ -817,32 +741,26 @@ public class TestVisibilityLabelsWithDeletes {
       throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteFamily(fam);
-            table.delete(d);
+          Delete d1 = new Delete(row1);
+          d1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+          d1.addFamily(fam);
 
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteFamily(fam);
-            table.delete(d);
-            table.flushCommits();
+          Delete d2 = new Delete(row1);
+          d2.setCellVisibility(new CellVisibility(SECRET));
+          d2.addFamily(fam);
 
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
-                + SECRET + "&" + TOPSECRET + ")"));
-            d.deleteFamily(fam);
-            table.delete(d);
-            table.flushCommits();
+          Delete d3 = new Delete(row1);
+          d3.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
+              + SECRET + "&" + TOPSECRET + ")"));
+          d3.addFamily(fam);
+
+          try (Table table = new HTable(conf, tableName)) {
+            table.delete(createList(d1, d2, d3));
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -866,10 +784,7 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
+      scanner.close();
     }
   }
 
@@ -877,24 +792,19 @@ public class TestVisibilityLabelsWithDeletes {
   public void testDeleteFamilyAndDeleteColumnsWithAndWithoutVisibilityExp() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.deleteFamily(fam);
-            table.delete(d);
-
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumns(fam, qual);
-            table.delete(d);
-            table.flushCommits();
+          Delete d1 = new Delete(row1);
+          d1.addFamily(fam);
+
+          Delete d2 = new Delete(row1);
+          d2.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
+          d2.addColumns(fam, qual);
+          try (Table table = new HTable(conf, tableName)) {
+            table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -934,119 +844,140 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
+      scanner.close();
     }
   }
 
   private Table doPuts(TableName tableName) throws IOException, InterruptedIOException,
       RetriesExhaustedWithDetailsException, InterruptedException {
-    Table table;
     Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    table = new HTable(conf, tableName);
+
+    List<Put> puts = new ArrayList<Put>();
     Put put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 123l, value);
     put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 124l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
     + TOPSECRET + "&" + SECRET+")"));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 125l, value);
     put.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 126l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
         + TOPSECRET + "&" + SECRET+")"));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 127l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
         + TOPSECRET + "&" + SECRET+")"));
-    table.put(put);
+    puts.add(put);
+
     TEST_UTIL.getHBaseAdmin().flush(tableName);
     put = new Put(Bytes.toBytes("row2"));
     put.add(fam, qual, 127l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET
         + "&" + SECRET + ")"));
-    table.put(put);
+    puts.add(put);
+
+    Table table = new HTable(conf, tableName);
+    table.put(puts);
     return table;
   }
 
   private Table doPutsWithDiffCols(TableName tableName) throws IOException,
       InterruptedIOException, RetriesExhaustedWithDetailsException, InterruptedException {
-    Table table;
     Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    table = new HTable(conf, tableName);
+
+    List<Put> puts = new ArrayList<>();
     Put put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 123l, value);
     put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 124l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
     + TOPSECRET + "&" + SECRET+")"));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 125l, value);
     put.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual1, 126l, value);
     put.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual2, 127l, value);
     put.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
         + TOPSECRET + "&" + SECRET+")"));
-    table.put(put);
+    puts.add(put);
+
+    Table table = new HTable(conf, tableName);
+    table.put(puts);
     return table;
   }
 
   private Table doPutsWithoutVisibility(TableName tableName) throws IOException,
       InterruptedIOException, RetriesExhaustedWithDetailsException, InterruptedException {
-    Table table;
     Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    table = new HTable(conf, tableName);
+    List<Put> puts = new ArrayList<>();
     Put put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 123l, value);
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 124l, value);
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 125l, value);
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 126l, value);
-    table.put(put);
+    puts.add(put);
+
     put = new Put(Bytes.toBytes("row1"));
     put.add(fam, qual, 127l, value);
-    table.put(put);
+    puts.add(put);
+
+    Table table = new HTable(conf, tableName);
+    table.put(puts);
+
     TEST_UTIL.getHBaseAdmin().flush(tableName);
+
     put = new Put(Bytes.toBytes("row2"));
     put.add(fam, qual, 127l, value);
     table.put(put);
+
     return table;
   }
 
@@ -1056,19 +987,16 @@ public class TestVisibilityLabelsWithDeletes {
       throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
-            d.deleteColumn(fam, qual, 125l);
+            d.addColumn(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1116,10 +1044,6 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -1127,18 +1051,15 @@ public class TestVisibilityLabelsWithDeletes {
   public void testDeleteColumnWithLatestTimeStampUsingMultipleVersions() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumn(fam, qual);
+            d.addColumn(fam, qual);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1181,10 +1102,6 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -1203,11 +1120,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET ));
-            d.deleteColumn(fam, qual);
+            d.addColumn(fam, qual);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1260,7 +1176,7 @@ public class TestVisibilityLabelsWithDeletes {
       put.add(fam, qual, 129l, value);
       put.setCellVisibility(new CellVisibility(SECRET));
       table.put(put);
-      table.flushCommits();
+
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       s = new Scan();
       s.setMaxVersions(5);
@@ -1292,11 +1208,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumn(fam, qual);
+            d.addColumn(fam, qual);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1364,11 +1279,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1419,11 +1333,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumns(fam, qual, 125l);
+          Delete d = new Delete(row1);
+          d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
+          d.addColumns(fam, qual, 125l);
+          try (Table table = new HTable(conf, tableName)) {
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1475,15 +1388,13 @@ public class TestVisibilityLabelsWithDeletes {
   @Test
   public void testDeleteColumnsWithDiffColsAndTags() throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual1, 125l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -1496,17 +1407,16 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumns(fam, qual, 126l);
-            table.delete(d);
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumns(fam, qual1, 125l);
-            table.delete(d);
-            table.flushCommits();
+          Delete d1 = new Delete(row1);
+          d1.setCellVisibility(new CellVisibility(SECRET));
+          d1.addColumns(fam, qual, 126l);
+
+          Delete d2 = new Delete(row1);
+          d2.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+          d2.addColumns(fam, qual1, 125l);
+
+          try (Table table = new HTable(conf, tableName)) {
+            table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -1520,24 +1430,18 @@ public class TestVisibilityLabelsWithDeletes {
       ResultScanner scanner = table.getScanner(s);
       Result[] next = scanner.next(3);
       assertEquals(next.length, 1);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
   @Test
   public void testDeleteColumnsWithDiffColsAndTags1() throws Exception {
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual1, 125l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -1550,17 +1454,16 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
-            Delete d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(SECRET));
-            d.deleteColumns(fam, qual, 126l);
-            table.delete(d);
-            d = new Delete(row1);
-            d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteColumns(fam, qual1, 126l);
-            table.delete(d);
-            table.flushCommits();
+          Delete d1 = new Delete(row1);
+          d1.setCellVisibility(new CellVisibility(SECRET));
+          d1.addColumns(fam, qual, 126l);
+
+          Delete d2 = new Delete(row1);
+          d2.setCellVisibility(new CellVisibility(CONFIDENTIAL));
+          d2.addColumns(fam, qual1, 126l);
+
+          try (Table table = new HTable(conf, tableName)) {
+            table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
           }
@@ -1574,10 +1477,6 @@ public class TestVisibilityLabelsWithDeletes {
       ResultScanner scanner = table.getScanner(s);
       Result[] next = scanner.next(3);
       assertEquals(next.length, 1);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
   @Test
@@ -1591,10 +1490,9 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1635,11 +1533,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1704,12 +1601,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + SECRET + "&" + TOPSECRET + ")"));
-            d.deleteFamily(fam, 126l);
+            d.addFamily(fam, 126l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1765,12 +1661,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
-            d.deleteFamily(fam, 126l);
+            d.addFamily(fam, 126l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1824,12 +1719,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteFamily(fam, 125l);
+            d.addFamily(fam, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1876,12 +1770,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteFamily(fam, 127l);
+            d.addFamily(fam, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1936,13 +1829,11 @@ public class TestVisibilityLabelsWithDeletes {
     };
     VisibilityLabelsResponse response = SUPERUSER.runAs(action);
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = doPuts(tableName);
-    try {
+    try (Table table = doPuts(tableName);) {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.deleteFamilyVersion(fam, 123l);
@@ -1982,10 +1873,6 @@ public class TestVisibilityLabelsWithDeletes {
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row1, 0, row1.length));
       assertEquals(current.getTimestamp(), 124l);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -1993,17 +1880,15 @@ public class TestVisibilityLabelsWithDeletes {
   public void testSpecificDeletesFollowedByDeleteFamily() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = doPuts(tableName);
-    try {
+    try (Table table = doPuts(tableName)){
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET + ")"));
-            d.deleteColumn(fam, qual, 126l);
+            d.addColumn(fam, qual, 126l);
             table.delete(d);
             d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
@@ -2044,11 +1929,10 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2074,10 +1958,6 @@ public class TestVisibilityLabelsWithDeletes {
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row1, 0, row1.length));
       assertEquals(current.getTimestamp(), 124l);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -2097,17 +1977,15 @@ public class TestVisibilityLabelsWithDeletes {
     };
     VisibilityLabelsResponse response = SUPERUSER.runAs(action);
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = doPuts(tableName);
-    try {
+    try (Table table = doPuts(tableName)){
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET + ")"));
-            d.deleteColumn(fam, qual);
+            d.addColumn(fam, qual);
             table.delete(d);
 
             d = new Delete(row1);
@@ -2149,11 +2027,10 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2179,11 +2056,6 @@ public class TestVisibilityLabelsWithDeletes {
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row1, 0, row1.length));
       assertEquals(current.getTimestamp(), 124l);
-
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -2191,18 +2063,14 @@ public class TestVisibilityLabelsWithDeletes {
   public void testDeleteColumnSpecificTimeStampWithMulipleVersionsDoneTwice() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      // Do not flush here.
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)) {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumn(fam, qual, 125l);
+            d.addColumn(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2249,12 +2117,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteColumn(fam, qual, 127l);
+            d.addColumn(fam, qual, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2291,10 +2158,6 @@ public class TestVisibilityLabelsWithDeletes {
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
       assertEquals(current.getTimestamp(), 127l);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -2309,12 +2172,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")" +
                 "|(" + TOPSECRET + "&" + SECRET + ")"));
-            d.deleteColumn(fam, qual, 127l);
+            d.addColumn(fam, qual, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2361,11 +2223,10 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumn(fam, qual, 127l);
+            d.addColumn(fam, qual, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2424,12 +2285,11 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteColumn(fam, qual, 125l);
+            d.addColumn(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2481,12 +2341,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteColumn(fam, qual, 127l);
+            d.addColumn(fam, qual, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2546,11 +2405,10 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
-            d.deleteColumn(fam, qual, 125l);
+            d.addColumn(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2597,12 +2455,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteFamily(fam, 124l);
+            d.addFamily(fam, 124l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2661,19 +2518,16 @@ public class TestVisibilityLabelsWithDeletes {
   public void testDiffDeleteTypesForTheSameCellUsingMultipleVersions() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
+    try (Table table = doPuts(tableName)){
       // Do not flush here.
-      table = doPuts(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteColumns(fam, qual, 125l);
+            d.addColumns(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2720,12 +2574,11 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
-            d.deleteColumn(fam, qual, 127l);
+            d.addColumn(fam, qual, 127l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2761,10 +2614,6 @@ public class TestVisibilityLabelsWithDeletes {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row2, 0, row2.length));
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -2772,17 +2621,14 @@ public class TestVisibilityLabelsWithDeletes {
   public void testDeleteColumnLatestWithNoCellVisibility() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      table = doPuts(tableName);
+    try (Table table = doPuts(tableName)){
       TEST_UTIL.getHBaseAdmin().flush(tableName);
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteColumn(fam, qual, 125l);
+            d.addColumn(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2803,10 +2649,9 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteColumns(fam, qual, 125l);
+            d.addColumns(fam, qual, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2828,10 +2673,9 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteFamily(fam, 125l);
+            d.addFamily(fam, 125l);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2853,10 +2697,9 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteFamily(fam);
+            d.addFamily(fam);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2878,10 +2721,9 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteColumns(fam, qual);
+            d.addColumns(fam, qual);
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -2903,8 +2745,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
             d.deleteFamilyVersion(fam, 126l);
             table.delete(d);
@@ -2924,10 +2765,6 @@ public class TestVisibilityLabelsWithDeletes {
       next = scanner.next(3);
       assertTrue(next.length == 2);
       scanAll(next);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -2969,15 +2806,13 @@ public class TestVisibilityLabelsWithDeletes {
   public void testVisibilityExpressionWithNotEqualORCondition() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    Table table = null;
-    try {
-      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-      HColumnDescriptor colDesc = new HColumnDescriptor(fam);
-      colDesc.setMaxVersions(5);
-      HTableDescriptor desc = new HTableDescriptor(tableName);
-      desc.addFamily(colDesc);
-      hBaseAdmin.createTable(desc);
-      table = new HTable(conf, tableName);
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+    colDesc.setMaxVersions(5);
+    HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(colDesc);
+    hBaseAdmin.createTable(desc);
+    try (Table table = new HTable(conf, tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, 123l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -2990,10 +2825,9 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try {
-            Table table = new HTable(conf, tableName);
+          try (Table table = new HTable(conf, tableName)) {
             Delete d = new Delete(row1);
-            d.deleteColumn(fam, qual, 124l);
+            d.addColumn(fam, qual, 124l);
             d.setCellVisibility(new CellVisibility(PRIVATE ));
             table.delete(d);
           } catch (Throwable t) {
@@ -3022,10 +2856,6 @@ public class TestVisibilityLabelsWithDeletes {
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row1, 0, row1.length));
       assertEquals(current.getTimestamp(), 123l);
-    } finally {
-      if (table != null) {
-        table.close();
-      }
     }
   }
 
@@ -3081,4 +2911,9 @@ public class TestVisibilityLabelsWithDeletes {
     };
     SUPERUSER.runAs(action);
   }
+  
+  @SafeVarargs
+  public static <T> List<T> createList(T... ts) {
+    return new ArrayList<>(Arrays.asList(ts));
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/0311cc86/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index 604982c..5ee43b1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -1367,7 +1367,6 @@ public class TestHBaseFsck {
       hri.setSplit(true);
 
       MetaTableAccessor.addRegionToMeta(meta, hri, a, b);
-      meta.flushCommits();
       meta.close();
       admin.flush(TableName.META_TABLE_NAME);
 
@@ -1493,9 +1492,10 @@ public class TestHBaseFsck {
       undeployRegion(connection, hris.get(daughters.getFirst()), daughters.getFirst());
       undeployRegion(connection, hris.get(daughters.getSecond()), daughters.getSecond());
 
-      meta.delete(new Delete(daughters.getFirst().getRegionName()));
-      meta.delete(new Delete(daughters.getSecond().getRegionName()));
-      meta.flushCommits();
+      List<Delete> deletes = new ArrayList<>();
+      deletes.add(new Delete(daughters.getFirst().getRegionName()));
+      deletes.add(new Delete(daughters.getSecond().getRegionName()));
+      meta.delete(deletes);
 
       // Remove daughters from regionStates
       RegionStates regionStates = TEST_UTIL.getMiniHBaseCluster().getMaster().

http://git-wip-us.apache.org/repos/asf/hbase/blob/0311cc86/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
index 8319625..744240e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -39,6 +38,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Connection;
@@ -146,15 +146,16 @@ public class OfflineMetaRebuildTestCore {
 
   private void populateTable(Table tbl) throws IOException {
     byte[] values = { 'A', 'B', 'C', 'D' };
+    List<Put> puts = new ArrayList<>();
     for (int i = 0; i < values.length; i++) {
       for (int j = 0; j < values.length; j++) {
         Put put = new Put(new byte[] { values[i], values[j] });
         put.add(Bytes.toBytes("fam"), new byte[] {}, new byte[] { values[i],
             values[j] });
-        tbl.put(put);
+        puts.add(put);
       }
     }
-    tbl.flushCommits();
+    tbl.put(puts);
   }
 
   /**
@@ -252,7 +253,6 @@ public class OfflineMetaRebuildTestCore {
       }
     }
     meta.delete(dels);
-    meta.flushCommits();
     scanner.close();
     meta.close();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/0311cc86/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java
index 43d7e24..139e143 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java
@@ -90,14 +90,13 @@ public class TestWALFiltering {
                 ts + "_random_" + rand.nextLong());
             put.add(cf, qual, ts, value);
           } else if (rand.nextDouble() < 0.8) {
-            del.deleteColumn(cf, qual, ts);
+            del.addColumn(cf, qual, ts);
           } else {
-            del.deleteColumns(cf, qual, ts);
+            del.addColumn(cf, qual, ts);
           }
         }
         table.put(put);
         table.delete(del);
-        table.flushCommits();
       }
     }
     TEST_UTIL.waitUntilAllRegionsAssigned(TABLE_NAME);


Mime
View raw message