@Test public void testRegionDoubleCreation() throws Exception { // NOTE: RegionInfo sort by table first, so we are relying on that final TableName TABLE_NAME_A = TableName.valueOf("testOrderedByTableA"); final TableName TABLE_NAME_B = TableName.valueOf("testOrderedByTableB"); final TableName TABLE_NAME_C = TableName.valueOf("testOrderedByTableC"); final RegionStates stateMap = new RegionStates(); final int NRUNS = 1000; final int NSMALL_RUNS = 3; // add some regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } // re-add the regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } waitExecutorService(NRUNS * 2); // add two other tables A and C that will be placed before and after table B (sort order) for (int i = 0; i < NSMALL_RUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_A, i); addRegionNode(stateMap, TABLE_NAME_C, i); } waitExecutorService(NSMALL_RUNS * 2); // check for the list of regions of the 3 tables checkTableRegions(stateMap, TABLE_NAME_A, NSMALL_RUNS); checkTableRegions(stateMap, TABLE_NAME_B, NRUNS); checkTableRegions(stateMap, TABLE_NAME_C, NSMALL_RUNS); }
@Test public void testRegionDoubleCreation() throws Exception { // NOTE: RegionInfo sort by table first, so we are relying on that final TableName TABLE_NAME_A = TableName.valueOf("testOrderedByTableA"); final TableName TABLE_NAME_B = TableName.valueOf("testOrderedByTableB"); final TableName TABLE_NAME_C = TableName.valueOf("testOrderedByTableC"); final RegionStates stateMap = new RegionStates(); final int NRUNS = 1000; final int NSMALL_RUNS = 3; // add some regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } // re-add the regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } waitExecutorService(NRUNS * 2); // add two other tables A and C that will be placed before and after table B (sort order) for (int i = 0; i < NSMALL_RUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_A, i); addRegionNode(stateMap, TABLE_NAME_C, i); } waitExecutorService(NSMALL_RUNS * 2); // check for the list of regions of the 3 tables checkTableRegions(stateMap, TABLE_NAME_A, NSMALL_RUNS); checkTableRegions(stateMap, TABLE_NAME_B, NRUNS); checkTableRegions(stateMap, TABLE_NAME_C, NSMALL_RUNS); }