protected final void verifyReplicationRequestRejection(HBaseTestingUtility utility, boolean expectedRejection) throws Exception { HRegionServer regionServer = utility.getRSForFirstRegionInTable(TABLE_NAME); ClusterConnection connection = regionServer.getClusterConnection(); Entry[] entries = new Entry[10]; for (int i = 0; i < entries.length; i++) { entries[i] = new Entry(new WALKeyImpl(HConstants.EMPTY_BYTE_ARRAY, TABLE_NAME, 0), new WALEdit()); } if (!expectedRejection) { ReplicationProtbufUtil.replicateWALEntry(connection.getAdmin(regionServer.getServerName()), entries, null, null, null); } else { try { ReplicationProtbufUtil.replicateWALEntry(connection.getAdmin(regionServer.getServerName()), entries, null, null, null); fail("Should throw IOException when sync-replication state is in A or DA"); } catch (DoNotRetryIOException e) { assertTrue(e.getMessage().contains("Reject to apply to sink cluster")); assertTrue(e.getMessage().contains(TABLE_NAME.toString())); } } }
} catch (DoNotRetryIOException e) { if (i >= 30 || !e.getMessage().contains("File does not exist")) { throw e;
@Test public void testInvalidSplitKey() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); RegionInfo [] regions = MasterProcedureTestingUtility.createTable( procExec, tableName, null, ColumnFamilyName1, ColumnFamilyName2); insertData(tableName); assertTrue("not able to find a splittable region", regions != null); assertTrue("not able to find a splittable region", regions.length == 1); // collect AM metrics before test collectAssignmentManagerMetrics(); // Split region of the table with null split key try { long procId1 = procExec.submitProcedure( new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], null)); ProcedureTestingUtility.waitProcedure(procExec, procId1); fail("unexpected procedure start with invalid split-key"); } catch (DoNotRetryIOException e) { LOG.debug("Expected Split procedure construction failure: " + e.getMessage()); } assertEquals(splitSubmittedCount, splitProcMetrics.getSubmittedCounter().getCount()); assertEquals(splitFailedCount, splitProcMetrics.getFailedCounter().getCount()); }
/** * Make sure that SYSTEM.CATALOG cannot be split if QueryServices.SYSTEM_CATALOG_SPLITTABLE is false */ @Test public void testSystemTableSplit() throws Exception { testUtil = getUtility(); for (int i=0; i<10; i++) { createTable("schema"+i+".table_"+i); } TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG"); RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog); assertEquals(rl.getAllRegionLocations().size(), 1); try { // now attempt to split SYSTEM.CATALOG testUtil.getAdmin().split(systemCatalog); // make sure the split finishes (there's no synchronous splitting before HBase 2.x) testUtil.getAdmin().disableTable(systemCatalog); testUtil.getAdmin().enableTable(systemCatalog); } catch (DoNotRetryIOException e) { // table is not splittable assert (e.getMessage().contains("NOT splittable")); } // test again... Must still be exactly one region. rl = testUtil.getConnection().getRegionLocator(systemCatalog); assertEquals(1, rl.getAllRegionLocations().size()); }
} catch (DoNotRetryIOException e) { if (i >= 30 || !e.getMessage().contains("File does not exist")) { throw e;
OperationStatusCode.SANITY_CHECK_FAILURE, fsce.getMessage()); lastIndexExclusive++; continue;
Assert.fail(); } catch (DoNotRetryIOException e) { Assert.assertTrue(e.getMessage().indexOf("is preserved by themis when THEMIS_ENABLE is true") >= 0); admin.createTable(tableDesc); } catch (DoNotRetryIOException e) { Assert.assertTrue(e.getMessage().indexOf("can not set MaxVersion for family") >= 0); admin.createTable(tableDesc); } catch (DoNotRetryIOException e) { Assert.assertTrue(e.getMessage().indexOf("can not set TTL for family") >= 0);
@Test public void testInvalidSplitKey() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); RegionInfo [] regions = MasterProcedureTestingUtility.createTable( procExec, tableName, null, ColumnFamilyName1, ColumnFamilyName2); insertData(tableName); assertTrue("not able to find a splittable region", regions != null); assertTrue("not able to find a splittable region", regions.length == 1); // collect AM metrics before test collectAssignmentManagerMetrics(); // Split region of the table with null split key try { long procId1 = procExec.submitProcedure( new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], null)); ProcedureTestingUtility.waitProcedure(procExec, procId1); fail("unexpected procedure start with invalid split-key"); } catch (DoNotRetryIOException e) { LOG.debug("Expected Split procedure construction failure: " + e.getMessage()); } assertEquals(splitSubmittedCount, splitProcMetrics.getSubmittedCounter().getCount()); assertEquals(splitFailedCount, splitProcMetrics.getFailedCounter().getCount()); }