HBASE-22037 Re-enable TestAvoidCellReferencesIntoShippedBlocks

This commit is contained in:
Duo Zhang 2019-05-21 17:23:37 +08:00 committed by zhangduo
parent a95eb6559d
commit 2e3a3d6776
1 changed files with 5 additions and 15 deletions

View File

@ -58,7 +58,6 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
@ -292,18 +291,11 @@ public class TestAvoidCellReferencesIntoShippedBlocks {
} }
} }
/**
* TODO: not sure what do we test here but seems the test can not work together with async
* prefetch scanner. Ignore it for now, as after HBASE-21879 is landed we will have a more natural
* way to deal with reference counting...
*/
@Ignore
@Test @Test
public void testHBASE16372InReadPath() throws Exception { public void testHBASE16372InReadPath() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName()); final TableName tableName = TableName.valueOf(name.getMethodName());
// Create a table with block size as 1024 // Create a table with block size as 1024
final Table table = TEST_UTIL.createTable(tableName, FAMILIES_1, 1, 1024, null); try (Table table = TEST_UTIL.createTable(tableName, FAMILIES_1, 1, 1024, null)) {
try {
// get the block cache and region // get the block cache and region
RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName); RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName);
String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName(); String regionName = locator.getAllRegionLocations().get(0).getRegion().getEncodedName();
@ -370,7 +362,8 @@ public class TestAvoidCellReferencesIntoShippedBlocks {
// set partial as true so that the scan can send partial columns also // set partial as true so that the scan can send partial columns also
s.setAllowPartialResults(true); s.setAllowPartialResults(true);
s.setMaxResultSize(1000); s.setMaxResultSize(1000);
try (ResultScanner scanner = table.getScanner(s)) { try (ScanPerNextResultScanner scanner =
new ScanPerNextResultScanner(TEST_UTIL.getAsyncConnection().getTable(tableName), s)) {
Thread evictorThread = new Thread() { Thread evictorThread = new Thread() {
@Override @Override
public void run() { public void run() {
@ -402,9 +395,8 @@ public class TestAvoidCellReferencesIntoShippedBlocks {
s1.withStartRow(ROW3); s1.withStartRow(ROW3);
s1.withStopRow(ROW5); s1.withStopRow(ROW5);
s1.setCaching(1); s1.setCaching(1);
ResultScanner scanner;
try { try (ResultScanner scanner = table.getScanner(s1)) {
scanner = table.getScanner(s1);
int count = Iterables.size(scanner); int count = Iterables.size(scanner);
assertEquals("Count the rows", 2, count); assertEquals("Count the rows", 2, count);
int newBlockRefCount = 0; int newBlockRefCount = 0;
@ -442,8 +434,6 @@ public class TestAvoidCellReferencesIntoShippedBlocks {
} }
} }
assertEquals("Count should give all rows ", 10, count); assertEquals("Count should give all rows ", 10, count);
} finally {
table.close();
} }
} }
} }