HBASE-21173 Remove the duplicate HRegion#close in TestHRegion

Signed-off-by: tedyu <yuzhihong@gmail.com>
Signed-off-by: Mingliang Liu <liuml07@apache.org>
This commit is contained in:
Guangxu Cheng 2018-09-11 11:06:23 +08:00
parent 2aae247e3f
commit bea26e98e6
1 changed files with 13 additions and 10 deletions

View File

@ -266,7 +266,7 @@ public class TestHRegion {
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId()); assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
// Weird. This returns 0 if no store files or no edits. Afraid to change it. // Weird. This returns 0 if no store files or no edits. Afraid to change it.
assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES)); assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
region.close(); HBaseTestingUtility.closeRegionAndWAL(this.region);
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId()); assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES)); assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
// Open region again. // Open region again.
@ -281,8 +281,9 @@ public class TestHRegion {
assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES)); assertEquals(0, (long)region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
region.flush(true); region.flush(true);
long max = region.getMaxFlushedSeqId(); long max = region.getMaxFlushedSeqId();
region.close(); HBaseTestingUtility.closeRegionAndWAL(this.region);
assertEquals(max, region.getMaxFlushedSeqId()); assertEquals(max, region.getMaxFlushedSeqId());
this.region = null;
} }
/** /**
@ -312,9 +313,9 @@ public class TestHRegion {
put.addColumn(COLUMN_FAMILY_BYTES, Bytes.toBytes("abc"), value); put.addColumn(COLUMN_FAMILY_BYTES, Bytes.toBytes("abc"), value);
region.put(put); region.put(put);
// Close with something in memstore and something in the snapshot. Make sure all is cleared. // Close with something in memstore and something in the snapshot. Make sure all is cleared.
region.close();
assertEquals(0, region.getMemStoreDataSize());
HBaseTestingUtility.closeRegionAndWAL(region); HBaseTestingUtility.closeRegionAndWAL(region);
assertEquals(0, region.getMemStoreDataSize());
region = null;
} }
/* /*
@ -575,7 +576,8 @@ public class TestHRegion {
p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null)); p2.add(new KeyValue(row, COLUMN_FAMILY_BYTES, qual3, 3, (byte[])null));
region.put(p2); region.put(p2);
// Now try close on top of a failing flush. // Now try close on top of a failing flush.
region.close(); HBaseTestingUtility.closeRegionAndWAL(region);
region = null;
fail(); fail();
} catch (DroppedSnapshotException dse) { } catch (DroppedSnapshotException dse) {
// Expected // Expected
@ -948,7 +950,7 @@ public class TestHRegion {
// close the region now, and reopen again // close the region now, and reopen again
region.getTableDescriptor(); region.getTableDescriptor();
region.getRegionInfo(); region.getRegionInfo();
region.close(); HBaseTestingUtility.closeRegionAndWAL(this.region);
try { try {
region = HRegion.openHRegion(region, null); region = HRegion.openHRegion(region, null);
} catch (WrongRegionException wre) { } catch (WrongRegionException wre) {
@ -1078,9 +1080,8 @@ public class TestHRegion {
} }
} }
// close the region now, and reopen again // close the region now, and reopen again
region.close(); HBaseTestingUtility.closeRegionAndWAL(this.region);
region = HRegion.openHRegion(region, null); region = HRegion.openHRegion(region, null);
// now check whether we have can read back the data from region // now check whether we have can read back the data from region
@ -1277,6 +1278,7 @@ public class TestHRegion {
} finally { } finally {
if (this.region != null) { if (this.region != null) {
HBaseTestingUtility.closeRegionAndWAL(this.region); HBaseTestingUtility.closeRegionAndWAL(this.region);
this.region = null;
} }
} }
done.set(true); done.set(true);
@ -1557,6 +1559,7 @@ public class TestHRegion {
Thread.sleep(10); Thread.sleep(10);
startingClose.countDown(); startingClose.countDown();
HBaseTestingUtility.closeRegionAndWAL(region); HBaseTestingUtility.closeRegionAndWAL(region);
region = null;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -4172,6 +4175,8 @@ public class TestHRegion {
// Verify that the .regioninfo file is still there // Verify that the .regioninfo file is still there
assertTrue(HRegionFileSystem.REGION_INFO_FILE + " should be present in the region dir", assertTrue(HRegionFileSystem.REGION_INFO_FILE + " should be present in the region dir",
fs.exists(new Path(regionDir, HRegionFileSystem.REGION_INFO_FILE))); fs.exists(new Path(regionDir, HRegionFileSystem.REGION_INFO_FILE)));
region = null;
} }
/** /**
@ -6230,8 +6235,6 @@ public class TestHRegion {
assertTrue(plugins.contains(replicationCoprocessorClass)); assertTrue(plugins.contains(replicationCoprocessorClass));
assertTrue(region.getCoprocessorHost(). assertTrue(region.getCoprocessorHost().
getCoprocessors().contains(ReplicationObserver.class.getSimpleName())); getCoprocessors().contains(ReplicationObserver.class.getSimpleName()));
region.close();
} }
/** /**