[08/30] hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi
HBASE-19965 Fix flaky TestAsyncRegionAdminApi Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cf57ea15 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cf57ea15 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cf57ea15 Branch: refs/heads/HBASE-19064 Commit: cf57ea15f1044d69fcfc8edee3c6f710ed78a7e0 Parents: f8c3d45 Author: Michael StackAuthored: Mon Feb 12 22:24:50 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:27:12 2018 -0800 -- .../hbase/client/TestAsyncRegionAdminApi.java | 195 +-- .../hbase/client/TestAsyncRegionAdminApi2.java | 241 +++ 2 files changed, 245 insertions(+), 191 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/cf57ea15/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java index b9afb68..fbb87bb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.hbase.client; -import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -27,14 +26,10 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; -import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.HMaster; @@ -60,30 +55,17 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous region admin operations. + * @see TestAsyncRegionAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { - @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestAsyncRegionAdminApi.class); @Test - public void testGetRegionLocation() throws Exception { -RawAsyncHBaseAdmin rawAdmin = (RawAsyncHBaseAdmin) ASYNC_CONN.getAdmin(); -TEST_UTIL.createMultiRegionTable(tableName, HConstants.CATALOG_FAMILY); -AsyncTableRegionLocator locator = ASYNC_CONN.getRegionLocator(tableName); -HRegionLocation regionLocation = locator.getRegionLocation(Bytes.toBytes("mmm")).get(); -RegionInfo region = regionLocation.getRegion(); -byte[] regionName = regionLocation.getRegion().getRegionName(); -HRegionLocation location = rawAdmin.getRegionLocation(regionName).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); -location = rawAdmin.getRegionLocation(region.getEncodedNameAsBytes()).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); - } - - @Test public void testAssignRegionAndUnassignRegion() throws Exception { createTableWithDefaultConf(tableName); @@ -259,175 +241,6 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { assertEquals(0, regionServer.getOnlineRegion(hri.getRegionName()).getMemStoreSize()); } - @Test - public void testSplitSwitch() throws Exception { -createTableWithDefaultConf(tableName); -byte[][] families = { FAMILY }; -final int rows = 1; -loadData(tableName, families, rows); - -AsyncTable metaTable = ASYNC_CONN.getTable(META_TABLE_NAME); -List regionLocations = -AsyncMetaTableAccessor.getTableHRegionLocations(metaTable, Optional.of(tableName)).get(); -int originalCount = regionLocations.size(); - -initSplitMergeSwitch(); -assertTrue(admin.splitSwitch(false).get()); -try { - admin.split(tableName, Bytes.toBytes(rows / 2)).join(); -} catch (Exception e){ - //Expected -} -int count = admin.getRegions(tableName).get().size(); -assertTrue(originalCount == count); - -assertFalse(admin.splitSwitch(true).get()); -
[09/30] hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI
HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b4622ffa Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b4622ffa Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b4622ffa Branch: refs/heads/HBASE-19064 Commit: b4622ffad7011b3d29bce6376edb896de6df9f6e Parents: cf57ea1 Author: Michael StackAuthored: Mon Feb 12 22:52:56 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:52:56 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 249 +-- .../hbase/client/TestAsyncTableAdminApi2.java | 299 +++ 2 files changed, 301 insertions(+), 247 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/b4622ffa/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index 597a3d7..a3129f8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -30,11 +30,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.regex.Pattern; -import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; @@ -43,12 +41,9 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; -import org.apache.hadoop.hbase.master.MasterFileSystem; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.FSTableDescriptors; -import org.apache.hadoop.hbase.util.FSUtils; import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; @@ -58,6 +53,8 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous table admin operations. + * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -591,161 +588,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { } @Test - public void testDisableCatalogTable() throws Exception { -try { - this.admin.disableTable(TableName.META_TABLE_NAME).join(); - fail("Expected to throw ConstraintException"); -} catch (Exception e) { -} -// Before the fix for HBASE-6146, the below table creation was failing as the hbase:meta table -// actually getting disabled by the disableTable() call. -createTableWithDefaultConf(tableName); - } - - @Test - public void testAddColumnFamily() throws Exception { -// Create a table with two families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -verifyTableDescriptor(tableName, FAMILY_0, FAMILY_1); - } - - @Test - public void testAddSameColumnFamilyTwice() throws Exception { -// Create a table with one families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -verifyTableDescriptor(tableName, FAMILY_0, FAMILY_1); - -try { - // Add same column family again -
[15/30] hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2)
HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6e35f5ea Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6e35f5ea Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6e35f5ea Branch: refs/heads/HBASE-19064 Commit: 6e35f5eab9799e5d1450f97dec9335800dd39c03 Parents: 39e191e Author: Michael StackAuthored: Tue Feb 13 21:04:50 2018 -0800 Committer: Michael Stack Committed: Tue Feb 13 21:06:00 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 234 +-- .../hbase/client/TestAsyncTableAdminApi3.java | 282 +++ 2 files changed, 284 insertions(+), 232 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/6e35f5ea/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index a3129f8..bc3a651 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -31,20 +31,16 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; -import java.util.regex.Pattern; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -55,6 +51,7 @@ import org.junit.runners.Parameterized; * Class to test asynchronous table admin operations. * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our * ten minute timeout so they were split. + * @see TestAsyncTableAdminApi3 Another split out from this class so each runs under ten minutes. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -65,82 +62,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { HBaseClassTestRule.forClass(TestAsyncTableAdminApi.class); @Test - public void testTableExist() throws Exception { -boolean exist; -exist = admin.tableExists(tableName).get(); -assertEquals(false, exist); -TEST_UTIL.createTable(tableName, FAMILY); -exist = admin.tableExists(tableName).get(); -assertEquals(true, exist); -exist = admin.tableExists(TableName.META_TABLE_NAME).get(); -assertEquals(true, exist); - } - - @Test - public void testListTables() throws Exception { -int numTables = admin.listTableDescriptors().get().size(); -final TableName tableName1 = TableName.valueOf(tableName.getNameAsString() + "1"); -final TableName tableName2 = TableName.valueOf(tableName.getNameAsString() + "2"); -final TableName tableName3 = TableName.valueOf(tableName.getNameAsString() + "3"); -TableName[] tables = new TableName[] { tableName1, tableName2, tableName3 }; -for (int i = 0; i < tables.length; i++) { - createTableWithDefaultConf(tables[i]); -} - -List tableDescs = admin.listTableDescriptors().get(); -int size = tableDescs.size(); -assertTrue(size >= tables.length); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if (tableDescs.get(j).getTableName().equals(tables[i])) { - found = true; - break; -} - } - assertTrue("Not found: " + tables[i], found); -} - -List tableNames = admin.listTableNames().get(); -size = tableNames.size(); -assertTrue(size == (numTables + tables.length)); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if (tableNames.get(j).equals(tables[i])) { - found = true; -
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2)
Repository: hbase Updated Branches: refs/heads/master 39e191e55 -> 6e35f5eab HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6e35f5ea Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6e35f5ea Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6e35f5ea Branch: refs/heads/master Commit: 6e35f5eab9799e5d1450f97dec9335800dd39c03 Parents: 39e191e Author: Michael StackAuthored: Tue Feb 13 21:04:50 2018 -0800 Committer: Michael Stack Committed: Tue Feb 13 21:06:00 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 234 +-- .../hbase/client/TestAsyncTableAdminApi3.java | 282 +++ 2 files changed, 284 insertions(+), 232 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/6e35f5ea/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index a3129f8..bc3a651 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -31,20 +31,16 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; -import java.util.regex.Pattern; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -55,6 +51,7 @@ import org.junit.runners.Parameterized; * Class to test asynchronous table admin operations. * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our * ten minute timeout so they were split. + * @see TestAsyncTableAdminApi3 Another split out from this class so each runs under ten minutes. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -65,82 +62,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { HBaseClassTestRule.forClass(TestAsyncTableAdminApi.class); @Test - public void testTableExist() throws Exception { -boolean exist; -exist = admin.tableExists(tableName).get(); -assertEquals(false, exist); -TEST_UTIL.createTable(tableName, FAMILY); -exist = admin.tableExists(tableName).get(); -assertEquals(true, exist); -exist = admin.tableExists(TableName.META_TABLE_NAME).get(); -assertEquals(true, exist); - } - - @Test - public void testListTables() throws Exception { -int numTables = admin.listTableDescriptors().get().size(); -final TableName tableName1 = TableName.valueOf(tableName.getNameAsString() + "1"); -final TableName tableName2 = TableName.valueOf(tableName.getNameAsString() + "2"); -final TableName tableName3 = TableName.valueOf(tableName.getNameAsString() + "3"); -TableName[] tables = new TableName[] { tableName1, tableName2, tableName3 }; -for (int i = 0; i < tables.length; i++) { - createTableWithDefaultConf(tables[i]); -} - -List tableDescs = admin.listTableDescriptors().get(); -int size = tableDescs.size(); -assertTrue(size >= tables.length); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if (tableDescs.get(j).getTableName().equals(tables[i])) { - found = true; - break; -} - } - assertTrue("Not found: " + tables[i], found); -} - -List tableNames = admin.listTableNames().get(); -size = tableNames.size(); -assertTrue(size == (numTables + tables.length)); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2)
Repository: hbase Updated Branches: refs/heads/branch-2 4594f7156 -> 1f3c13137 HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI AGAIN (make TestAsyncTableAdminAPI3... already an TestAsyncTableAdminAPI2) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1f3c1313 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1f3c1313 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1f3c1313 Branch: refs/heads/branch-2 Commit: 1f3c131371fb9dff52c41833dc35615a5a8039be Parents: 4594f71 Author: Michael StackAuthored: Tue Feb 13 21:04:50 2018 -0800 Committer: Michael Stack Committed: Tue Feb 13 21:05:34 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 234 +-- .../hbase/client/TestAsyncTableAdminApi3.java | 282 +++ 2 files changed, 284 insertions(+), 232 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/1f3c1313/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index a3129f8..bc3a651 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -31,20 +31,16 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; -import java.util.regex.Pattern; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -55,6 +51,7 @@ import org.junit.runners.Parameterized; * Class to test asynchronous table admin operations. * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our * ten minute timeout so they were split. + * @see TestAsyncTableAdminApi3 Another split out from this class so each runs under ten minutes. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -65,82 +62,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { HBaseClassTestRule.forClass(TestAsyncTableAdminApi.class); @Test - public void testTableExist() throws Exception { -boolean exist; -exist = admin.tableExists(tableName).get(); -assertEquals(false, exist); -TEST_UTIL.createTable(tableName, FAMILY); -exist = admin.tableExists(tableName).get(); -assertEquals(true, exist); -exist = admin.tableExists(TableName.META_TABLE_NAME).get(); -assertEquals(true, exist); - } - - @Test - public void testListTables() throws Exception { -int numTables = admin.listTableDescriptors().get().size(); -final TableName tableName1 = TableName.valueOf(tableName.getNameAsString() + "1"); -final TableName tableName2 = TableName.valueOf(tableName.getNameAsString() + "2"); -final TableName tableName3 = TableName.valueOf(tableName.getNameAsString() + "3"); -TableName[] tables = new TableName[] { tableName1, tableName2, tableName3 }; -for (int i = 0; i < tables.length; i++) { - createTableWithDefaultConf(tables[i]); -} - -List tableDescs = admin.listTableDescriptors().get(); -int size = tableDescs.size(); -assertTrue(size >= tables.length); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if (tableDescs.get(j).getTableName().equals(tables[i])) { - found = true; - break; -} - } - assertTrue("Not found: " + tables[i], found); -} - -List tableNames = admin.listTableNames().get(); -size = tableNames.size(); -assertTrue(size == (numTables + tables.length)); -for (int i = 0; i < tables.length && i < size; i++) { - boolean found = false; - for (int j = 0; j < size; j++) { -if
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI
Repository: hbase Updated Branches: refs/heads/master cf57ea15f -> b4622ffad HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b4622ffa Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b4622ffa Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b4622ffa Branch: refs/heads/master Commit: b4622ffad7011b3d29bce6376edb896de6df9f6e Parents: cf57ea1 Author: Michael StackAuthored: Mon Feb 12 22:52:56 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:52:56 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 249 +-- .../hbase/client/TestAsyncTableAdminApi2.java | 299 +++ 2 files changed, 301 insertions(+), 247 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/b4622ffa/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index 597a3d7..a3129f8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -30,11 +30,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.regex.Pattern; -import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; @@ -43,12 +41,9 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; -import org.apache.hadoop.hbase.master.MasterFileSystem; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.FSTableDescriptors; -import org.apache.hadoop.hbase.util.FSUtils; import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; @@ -58,6 +53,8 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous table admin operations. + * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -591,161 +588,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { } @Test - public void testDisableCatalogTable() throws Exception { -try { - this.admin.disableTable(TableName.META_TABLE_NAME).join(); - fail("Expected to throw ConstraintException"); -} catch (Exception e) { -} -// Before the fix for HBASE-6146, the below table creation was failing as the hbase:meta table -// actually getting disabled by the disableTable() call. -createTableWithDefaultConf(tableName); - } - - @Test - public void testAddColumnFamily() throws Exception { -// Create a table with two families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -verifyTableDescriptor(tableName, FAMILY_0, FAMILY_1); - } - - @Test - public void testAddSameColumnFamilyTwice() throws Exception { -// Create a table with one families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -verifyTableDescriptor(tableName,
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI
Repository: hbase Updated Branches: refs/heads/branch-2 7104364a4 -> 5b95ea01d HBASE-19965 Fix flaky TestAsyncRegionAdminApi; ADDENDUM do same to TestAsyncTableAdminAPI Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5b95ea01 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5b95ea01 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5b95ea01 Branch: refs/heads/branch-2 Commit: 5b95ea01dab379ce71adbf9d04bec69b3b8cd5ab Parents: 7104364 Author: Michael StackAuthored: Mon Feb 12 22:52:56 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:53:29 2018 -0800 -- .../hbase/client/TestAsyncTableAdminApi.java| 249 +-- .../hbase/client/TestAsyncTableAdminApi2.java | 299 +++ 2 files changed, 301 insertions(+), 247 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/5b95ea01/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java index 597a3d7..a3129f8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableAdminApi.java @@ -30,11 +30,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.regex.Pattern; -import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; @@ -43,12 +41,9 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.TableDescriptorBuilder.ModifyableTableDescriptor; import org.apache.hadoop.hbase.master.LoadBalancer; -import org.apache.hadoop.hbase.master.MasterFileSystem; import org.apache.hadoop.hbase.testclassification.ClientTests; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.FSTableDescriptors; -import org.apache.hadoop.hbase.util.FSUtils; import org.junit.Assert; import org.junit.ClassRule; import org.junit.Test; @@ -58,6 +53,8 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous table admin operations. + * @see TestAsyncTableAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) @@ -591,161 +588,6 @@ public class TestAsyncTableAdminApi extends TestAsyncAdminBase { } @Test - public void testDisableCatalogTable() throws Exception { -try { - this.admin.disableTable(TableName.META_TABLE_NAME).join(); - fail("Expected to throw ConstraintException"); -} catch (Exception e) { -} -// Before the fix for HBASE-6146, the below table creation was failing as the hbase:meta table -// actually getting disabled by the disableTable() call. -createTableWithDefaultConf(tableName); - } - - @Test - public void testAddColumnFamily() throws Exception { -// Create a table with two families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -verifyTableDescriptor(tableName, FAMILY_0, FAMILY_1); - } - - @Test - public void testAddSameColumnFamilyTwice() throws Exception { -// Create a table with one families -TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName); -builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY_0)); -admin.createTable(builder.build()).join(); -admin.disableTable(tableName).join(); -// Verify the table descriptor -verifyTableDescriptor(tableName, FAMILY_0); - -// Modify the table removing one family and verify the descriptor -admin.addColumnFamily(tableName, ColumnFamilyDescriptorBuilder.of(FAMILY_1)).join(); -
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi
Repository: hbase Updated Branches: refs/heads/master f8c3d4568 -> cf57ea15f HBASE-19965 Fix flaky TestAsyncRegionAdminApi Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cf57ea15 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cf57ea15 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cf57ea15 Branch: refs/heads/master Commit: cf57ea15f1044d69fcfc8edee3c6f710ed78a7e0 Parents: f8c3d45 Author: Michael StackAuthored: Mon Feb 12 22:24:50 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:27:12 2018 -0800 -- .../hbase/client/TestAsyncRegionAdminApi.java | 195 +-- .../hbase/client/TestAsyncRegionAdminApi2.java | 241 +++ 2 files changed, 245 insertions(+), 191 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/cf57ea15/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java index b9afb68..fbb87bb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.hbase.client; -import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -27,14 +26,10 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; -import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.HMaster; @@ -60,30 +55,17 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous region admin operations. + * @see TestAsyncRegionAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { - @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestAsyncRegionAdminApi.class); @Test - public void testGetRegionLocation() throws Exception { -RawAsyncHBaseAdmin rawAdmin = (RawAsyncHBaseAdmin) ASYNC_CONN.getAdmin(); -TEST_UTIL.createMultiRegionTable(tableName, HConstants.CATALOG_FAMILY); -AsyncTableRegionLocator locator = ASYNC_CONN.getRegionLocator(tableName); -HRegionLocation regionLocation = locator.getRegionLocation(Bytes.toBytes("mmm")).get(); -RegionInfo region = regionLocation.getRegion(); -byte[] regionName = regionLocation.getRegion().getRegionName(); -HRegionLocation location = rawAdmin.getRegionLocation(regionName).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); -location = rawAdmin.getRegionLocation(region.getEncodedNameAsBytes()).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); - } - - @Test public void testAssignRegionAndUnassignRegion() throws Exception { createTableWithDefaultConf(tableName); @@ -259,175 +241,6 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { assertEquals(0, regionServer.getOnlineRegion(hri.getRegionName()).getMemStoreSize()); } - @Test - public void testSplitSwitch() throws Exception { -createTableWithDefaultConf(tableName); -byte[][] families = { FAMILY }; -final int rows = 1; -loadData(tableName, families, rows); - -AsyncTable metaTable = ASYNC_CONN.getTable(META_TABLE_NAME); -List regionLocations = -AsyncMetaTableAccessor.getTableHRegionLocations(metaTable, Optional.of(tableName)).get(); -int originalCount = regionLocations.size(); - -initSplitMergeSwitch(); -assertTrue(admin.splitSwitch(false).get()); -try { - admin.split(tableName, Bytes.toBytes(rows / 2)).join(); -} catch (Exception e){ - //Expected -} -int count = admin.getRegions(tableName).get().size(); -
hbase git commit: HBASE-19965 Fix flaky TestAsyncRegionAdminApi
Repository: hbase Updated Branches: refs/heads/branch-2 6f35b5393 -> 7104364a4 HBASE-19965 Fix flaky TestAsyncRegionAdminApi Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7104364a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7104364a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7104364a Branch: refs/heads/branch-2 Commit: 7104364a4d220830457feb7e0cd4c7f308071cd2 Parents: 6f35b53 Author: Michael StackAuthored: Mon Feb 12 22:24:50 2018 -0800 Committer: Michael Stack Committed: Mon Feb 12 22:24:50 2018 -0800 -- .../hbase/client/TestAsyncRegionAdminApi.java | 195 +-- .../hbase/client/TestAsyncRegionAdminApi2.java | 241 +++ 2 files changed, 245 insertions(+), 191 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hbase/blob/7104364a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java -- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java index b9afb68..fbb87bb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java @@ -17,7 +17,6 @@ */ package org.apache.hadoop.hbase.client; -import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -27,14 +26,10 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; -import org.apache.hadoop.hbase.AsyncMetaTableAccessor; import org.apache.hadoop.hbase.HBaseClassTestRule; -import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.HMaster; @@ -60,30 +55,17 @@ import org.junit.runners.Parameterized; /** * Class to test asynchronous region admin operations. + * @see TestAsyncRegionAdminApi2 This test and it used to be joined it was taking longer than our + * ten minute timeout so they were split. */ @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { - @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestAsyncRegionAdminApi.class); @Test - public void testGetRegionLocation() throws Exception { -RawAsyncHBaseAdmin rawAdmin = (RawAsyncHBaseAdmin) ASYNC_CONN.getAdmin(); -TEST_UTIL.createMultiRegionTable(tableName, HConstants.CATALOG_FAMILY); -AsyncTableRegionLocator locator = ASYNC_CONN.getRegionLocator(tableName); -HRegionLocation regionLocation = locator.getRegionLocation(Bytes.toBytes("mmm")).get(); -RegionInfo region = regionLocation.getRegion(); -byte[] regionName = regionLocation.getRegion().getRegionName(); -HRegionLocation location = rawAdmin.getRegionLocation(regionName).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); -location = rawAdmin.getRegionLocation(region.getEncodedNameAsBytes()).get(); -assertTrue(Bytes.equals(regionName, location.getRegion().getRegionName())); - } - - @Test public void testAssignRegionAndUnassignRegion() throws Exception { createTableWithDefaultConf(tableName); @@ -259,175 +241,6 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase { assertEquals(0, regionServer.getOnlineRegion(hri.getRegionName()).getMemStoreSize()); } - @Test - public void testSplitSwitch() throws Exception { -createTableWithDefaultConf(tableName); -byte[][] families = { FAMILY }; -final int rows = 1; -loadData(tableName, families, rows); - -AsyncTable metaTable = ASYNC_CONN.getTable(META_TABLE_NAME); -List regionLocations = -AsyncMetaTableAccessor.getTableHRegionLocations(metaTable, Optional.of(tableName)).get(); -int originalCount = regionLocations.size(); - -initSplitMergeSwitch(); -assertTrue(admin.splitSwitch(false).get()); -try { - admin.split(tableName, Bytes.toBytes(rows / 2)).join(); -} catch (Exception e){ - //Expected -} -int count = admin.getRegions(tableName).get().size(); -