Repository: hbase Updated Branches: refs/heads/0.98 5874ae0ad -> 415b8ff43 refs/heads/branch-1 158e009f4 -> f0091a903 refs/heads/master 075fd3032 -> f20fac41d
HBASE-12384 TestTags can hang on fast test hosts Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/f20fac41 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f20fac41 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f20fac41 Branch: refs/heads/master Commit: f20fac41dfdf5ef5b5e91d04796e0cc2adc49904 Parents: 075fd30 Author: Andrew Purtell <[email protected]> Authored: Thu Oct 30 10:45:02 2014 -0700 Committer: Andrew Purtell <[email protected]> Committed: Thu Oct 30 10:45:02 2014 -0700 ---------------------------------------------------------------------- .../hadoop/hbase/regionserver/TestTags.java | 94 ++++++-------------- 1 file changed, 29 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/f20fac41/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java index a613319..1c8f405 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java @@ -125,13 +125,12 @@ public class TestTags { put.setAttribute("visibility", Bytes.toBytes("myTag")); table.put(put); admin.flush(tableName); - List<HRegion> regions = TEST_UTIL.getHBaseCluster().getRegions(tableName); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 0)) { - Thread.sleep(10); - } - } + // We are lacking an API for confirming flush request compaction. + // Just sleep for a short time. We won't be able to confirm flush + // completion but the test won't hang now or in the future if + // default compaction policy causes compaction between flush and + // when we go to confirm it. + Thread.sleep(1000); Put put1 = new Put(row1); byte[] value1 = Bytes.toBytes("1000dfsdf"); @@ -139,29 +138,18 @@ public class TestTags { // put1.setAttribute("visibility", Bytes.toBytes("myTag3")); table.put(put1); admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 1)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); Put put2 = new Put(row2); byte[] value2 = Bytes.toBytes("1000dfsdf"); put2.add(fam, qual, HConstants.LATEST_TIMESTAMP, value2); put2.setAttribute("visibility", Bytes.toBytes("myTag3")); table.put(put2); - admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName.getName()); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 2)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); + result(fam, row, qual, row2, table, value, value2, row1, value1); + admin.compact(tableName); while (admin.getCompactionState(tableName) != CompactionState.NONE) { Thread.sleep(10); @@ -203,40 +191,27 @@ public class TestTags { put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value); table.put(put); admin.flush(tableName); - List<HRegion> regions = TEST_UTIL.getHBaseCluster().getRegions(tableName.getName()); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 0)) { - Thread.sleep(10); - } - } + // We are lacking an API for confirming flush request compaction. + // Just sleep for a short time. We won't be able to confirm flush + // completion but the test won't hang now or in the future if + // default compaction policy causes compaction between flush and + // when we go to confirm it. + Thread.sleep(1000); Put put1 = new Put(row1); byte[] value1 = Bytes.toBytes("1000dfsdf"); put1.add(fam, qual, HConstants.LATEST_TIMESTAMP, value1); table.put(put1); admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName.getName()); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 1)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); Put put2 = new Put(row2); byte[] value2 = Bytes.toBytes("1000dfsdf"); put2.add(fam, qual, HConstants.LATEST_TIMESTAMP, value2); table.put(put2); - admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 2)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); + Scan s = new Scan(row); ResultScanner scanner = table.getScanner(s); try { @@ -312,26 +287,20 @@ public class TestTags { put1.add(fam, qual, HConstants.LATEST_TIMESTAMP, value1); table.put(put1); admin.flush(tableName); - List<HRegion> regions = TEST_UTIL.getHBaseCluster().getRegions(tableName.getName()); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 0)) { - Thread.sleep(10); - } - } + // We are lacking an API for confirming flush request compaction. + // Just sleep for a short time. We won't be able to confirm flush + // completion but the test won't hang now or in the future if + // default compaction policy causes compaction between flush and + // when we go to confirm it. + Thread.sleep(1000); put1 = new Put(row2); value1 = Bytes.toBytes("1000dfsdf"); put1.add(fam, qual, HConstants.LATEST_TIMESTAMP, value1); table.put(put1); admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 1)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); + Put put2 = new Put(rowd); byte[] value2 = Bytes.toBytes("1000dfsdf"); put2.add(fam, qual, HConstants.LATEST_TIMESTAMP, value2); @@ -342,13 +311,8 @@ public class TestTags { put.setAttribute("visibility", Bytes.toBytes("ram")); table.put(put2); admin.flush(tableName); - regions = TEST_UTIL.getHBaseCluster().getRegions(tableName); - for (HRegion region : regions) { - Store store = region.getStore(fam); - while (!(store.getStorefilesCount() > 2)) { - Thread.sleep(10); - } - } + Thread.sleep(1000); + TestCoprocessorForTags.checkTagPresence = true; Scan s = new Scan(row); s.setCaching(1);
