HBASE-16725 Don't let flushThread hang in TestHRegion
This commit is contained in:
parent
d4b5645a4e
commit
df57859258
@ -3751,8 +3751,8 @@ public class TestHRegion {
|
|||||||
|
|
||||||
String method = "testFlushCacheWhileScanning";
|
String method = "testFlushCacheWhileScanning";
|
||||||
this.region = initHRegion(tableName, method, CONF, family);
|
this.region = initHRegion(tableName, method, CONF, family);
|
||||||
try {
|
|
||||||
FlushThread flushThread = new FlushThread();
|
FlushThread flushThread = new FlushThread();
|
||||||
|
try {
|
||||||
flushThread.start();
|
flushThread.start();
|
||||||
|
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
@ -3771,7 +3771,7 @@ public class TestHRegion {
|
|||||||
region.put(put);
|
region.put(put);
|
||||||
|
|
||||||
if (i != 0 && i % compactInterval == 0) {
|
if (i != 0 && i % compactInterval == 0) {
|
||||||
// System.out.println("iteration = " + i);
|
LOG.debug("iteration = " + i+ " ts="+System.currentTimeMillis());
|
||||||
region.compact(true);
|
region.compact(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3790,15 +3790,20 @@ public class TestHRegion {
|
|||||||
if (!toggle) {
|
if (!toggle) {
|
||||||
flushThread.flush();
|
flushThread.flush();
|
||||||
}
|
}
|
||||||
assertEquals("i=" + i, expectedCount, res.size());
|
assertEquals("toggle="+toggle+"i=" + i + " ts="+System.currentTimeMillis(),
|
||||||
|
expectedCount, res.size());
|
||||||
toggle = !toggle;
|
toggle = !toggle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
flushThread.done();
|
flushThread.done();
|
||||||
flushThread.join();
|
flushThread.join();
|
||||||
flushThread.checkNoError();
|
flushThread.checkNoError();
|
||||||
} finally {
|
} catch (InterruptedException ie) {
|
||||||
|
LOG.warn("Caught exception when joining with flushThread", ie);
|
||||||
|
}
|
||||||
HRegion.closeHRegion(this.region);
|
HRegion.closeHRegion(this.region);
|
||||||
this.region = null;
|
this.region = null;
|
||||||
}
|
}
|
||||||
@ -3888,12 +3893,12 @@ public class TestHRegion {
|
|||||||
|
|
||||||
String method = "testWritesWhileScanning";
|
String method = "testWritesWhileScanning";
|
||||||
this.region = initHRegion(tableName, method, CONF, families);
|
this.region = initHRegion(tableName, method, CONF, families);
|
||||||
try {
|
FlushThread flushThread = new FlushThread();
|
||||||
PutThread putThread = new PutThread(numRows, families, qualifiers);
|
PutThread putThread = new PutThread(numRows, families, qualifiers);
|
||||||
|
try {
|
||||||
putThread.start();
|
putThread.start();
|
||||||
putThread.waitForFirstPut();
|
putThread.waitForFirstPut();
|
||||||
|
|
||||||
FlushThread flushThread = new FlushThread();
|
|
||||||
flushThread.start();
|
flushThread.start();
|
||||||
|
|
||||||
Scan scan = new Scan(Bytes.toBytes("row0"), Bytes.toBytes("row1"));
|
Scan scan = new Scan(Bytes.toBytes("row0"), Bytes.toBytes("row1"));
|
||||||
@ -3928,18 +3933,21 @@ public class TestHRegion {
|
|||||||
prevTimestamp = timestamp;
|
prevTimestamp = timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
putThread.done();
|
putThread.done();
|
||||||
|
|
||||||
region.flush(true);
|
region.flush(true);
|
||||||
|
|
||||||
putThread.join();
|
} finally {
|
||||||
putThread.checkNoError();
|
try {
|
||||||
|
|
||||||
flushThread.done();
|
flushThread.done();
|
||||||
flushThread.join();
|
flushThread.join();
|
||||||
flushThread.checkNoError();
|
flushThread.checkNoError();
|
||||||
} finally {
|
|
||||||
|
putThread.join();
|
||||||
|
putThread.checkNoError();
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
LOG.warn("Caught exception when joining with flushThread", ie);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LOG.info("Before close: " + this.region.getMVCC());
|
LOG.info("Before close: " + this.region.getMVCC());
|
||||||
HRegion.closeHRegion(this.region);
|
HRegion.closeHRegion(this.region);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user