Skip to content

Commit

Permalink
close region
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Feb 23, 2024
1 parent 5d87500 commit 1dbeca2
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,26 @@ public void testSequenceId() throws IOException {
HBaseTestingUtil.closeRegionAndWAL(this.region);
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
assertEquals(0, (long) region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
// Open region again.
region = initHRegion(tableName, method, CONF, COLUMN_FAMILY_BYTES);
byte[] value = Bytes.toBytes(method);
// Make a random put against our cf.
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, null, value);
region.put(put);
// No flush yet so init numbers should still be in place.
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
assertEquals(0, (long) region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
region.flush(true);
long max = region.getMaxFlushedSeqId();
HBaseTestingUtil.closeRegionAndWAL(this.region);
assertEquals(max, region.getMaxFlushedSeqId());
this.region = null;
HRegion oldRegion = region;
try {
// Open region again.
region = initHRegion(tableName, method, CONF, COLUMN_FAMILY_BYTES);
byte[] value = Bytes.toBytes(method);
// Make a random put against our cf.
Put put = new Put(value);
put.addColumn(COLUMN_FAMILY_BYTES, null, value);
region.put(put);
// No flush yet so init numbers should still be in place.
assertEquals(HConstants.NO_SEQNUM, region.getMaxFlushedSeqId());
assertEquals(0, (long) region.getMaxStoreSeqId().get(COLUMN_FAMILY_BYTES));
region.flush(true);
long max = region.getMaxFlushedSeqId();
HBaseTestingUtil.closeRegionAndWAL(this.region);
assertEquals(max, region.getMaxFlushedSeqId());
this.region = null;
} finally {
HBaseTestingUtil.closeRegionAndWAL(oldRegion);
}
}

/**
Expand Down Expand Up @@ -7608,7 +7613,7 @@ public void run() {

holder.start();
latch.await();
region.close();
HBaseTestingUtil.closeRegionAndWAL(region);
region = null;
holder.join();

Expand Down

0 comments on commit 1dbeca2

Please sign in to comment.