You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by gx...@apache.org on 2018/09/11 09:49:21 UTC

hbase git commit: HBASE-21173 Remove the duplicate HRegion#close in TestHRegion

Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 b3aa1c199 -> aa28cf7e9


HBASE-21173 Remove the duplicate HRegion#close in TestHRegion

Signed-off-by: tedyu <yu...@gmail.com>
Signed-off-by: Mingliang Liu <li...@apache.org>


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

Branch: refs/heads/branch-1.4
Commit: aa28cf7e91fefe920007f415442cd62eca0418fb
Parents: b3aa1c1
Author: Guangxu Cheng <gu...@gmail.com>
Authored: Tue Sep 11 11:42:07 2018 +0800
Committer: Guangxu Cheng <gu...@gmail.com>
Committed: Tue Sep 11 17:48:32 2018 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/TestHRegion.java  | 25 +++++++++++++-------
 1 file changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/aa28cf7e/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
index c5d1238..bb92877 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
@@ -256,7 +256,7 @@ public class TestHRegion {
     assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
     // Weird. This returns 0 if no store files or no edits. Afraid to change it.
     assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
-    region.close();
+    HBaseTestingUtility.closeRegionAndWAL(this.region);
     assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
     assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
     // Open region again.
@@ -271,7 +271,9 @@ public class TestHRegion {
     assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
     region.flush(true);
     long max = region.getMaxFlushedSeqId();
+    HBaseTestingUtility.closeRegionAndWAL(this.region);
     assertEquals(max, region.getMaxFlushedSeqId());
+    this.region = null;
   }
 
   /**
@@ -301,8 +303,9 @@ public class TestHRegion {
     put.add(COLUMN_FAMILY_BYTES, Bytes.toBytes("abc"), value);
     region.put(put);
     // Close with something in memstore and something in the snapshot.  Make sure all is cleared.
-    region.close();
+    HBaseTestingUtility.closeRegionAndWAL(region);
     assertEquals(0, region.getMemstoreSize());
+    region = null;
   }
 
   /*
@@ -561,7 +564,8 @@ public class TestHRegion {
           p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null));
           region.put(p2);
           // Now try close on top of a failing flush.
-          region.close();
+          HBaseTestingUtility.closeRegionAndWAL(region);
+          region = null;
           fail();
         } catch (IOException dse) {
           // Expected
@@ -943,7 +947,7 @@ public class TestHRegion {
       // close the region now, and reopen again
       region.getTableDesc();
       region.getRegionInfo();
-      region.close();
+      HBaseTestingUtility.closeRegionAndWAL(this.region);
       try {
         region = HRegion.openHRegion(region, null);
       } catch (WrongRegionException wre) {
@@ -1074,9 +1078,8 @@ public class TestHRegion {
         }
       }
 
-
       // close the region now, and reopen again
-      region.close();
+      HBaseTestingUtility.closeRegionAndWAL(this.region);
       region = HRegion.openHRegion(region, null);
 
       // now check whether we have can read back the data from region
@@ -1087,7 +1090,7 @@ public class TestHRegion {
         assertArrayEquals(Bytes.toBytes(i), value);
       }
     } finally {
-      HRegion.closeHRegion(this.region);
+      HBaseTestingUtility.closeRegionAndWAL(this.region);
       this.region = null;
       wals.close();
     }
@@ -1275,7 +1278,8 @@ public class TestHRegion {
       }
     } finally {
       if (this.region != null) {
-        HRegion.closeHRegion(this.region);
+        HBaseTestingUtility.closeRegionAndWAL(this.region);
+        this.region = null;
       }
     }
     done.set(true);
@@ -1577,6 +1581,7 @@ public class TestHRegion {
           Thread.sleep(10);
           startingClose.countDown();
           HBaseTestingUtility.closeRegionAndWAL(region);
+          region = null;
         } catch (IOException e) {
           throw new RuntimeException(e);
         } catch (InterruptedException e) {
@@ -4333,6 +4338,8 @@ public class TestHRegion {
     // Verify that the .regioninfo file is still there
     assertTrue(HRegionFileSystem.REGION_INFO_FILE + " should be present in the region dir",
         fs.exists(new Path(regionDir, HRegionFileSystem.REGION_INFO_FILE)));
+
+    region = null;
   }
 
   /**
@@ -5781,7 +5788,7 @@ public class TestHRegion {
     // create a file in fam1 for the region before opening in OpenRegionHandler
     region.put(new Put(Bytes.toBytes("a")).add(fam1, fam1, fam1));
     region.flush(true);
-    region.close();
+    HBaseTestingUtility.closeRegionAndWAL(region);
 
     ArgumentCaptor<WALEdit> editCaptor = ArgumentCaptor.forClass(WALEdit.class);