/** * Rough test that Coprocessor Environment is Read-Only. * Just check a random CP and see that it returns a read-only config. */ @Test public void testReadOnlyConfiguration() throws Exception { Configuration conf = new Configuration(CONF); HRegion region = mock(HRegion.class); when(region.getRegionInfo()).thenReturn(REGIONINFO); when(region.getTableDescriptor()).thenReturn(TABLEDESC); RegionServerServices rsServices = mock(RegionServerServices.class); RegionCoprocessorHost rcp = new RegionCoprocessorHost(region, rsServices, conf); boolean found = false; for (String cpStr: rcp.getCoprocessors()) { CoprocessorEnvironment cpenv = rcp.findCoprocessorEnvironment(cpStr); if (cpenv != null) { found = true; } Configuration c = cpenv.getConfiguration(); thrown.expect(UnsupportedOperationException.class); c.set("one.two.three", "four.five.six"); } assertTrue("Should be at least one CP found", found); } }
if (region.getRegionInfo().getRegionNameAsString().startsWith(tableName.getNameAsString())) { CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); if (env != null) { found1 = true; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); if (env != null) { found2 = true;
foundTableRegion = true; CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); found1 = found1 && (env != null); env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); found2 = found2 && (env != null); if (env != null) {
region.getCoprocessorHost().findCoprocessorEnvironment(cpName6); if (env != null) { found_6 = true;
private RegionCoprocessorEnvironment getRegionEnvrionment(String tableName) throws IOException, InterruptedException { return getUtility().getMiniHBaseCluster().getRegions(TableName.valueOf(tableName)).get(0) .getCoprocessorHost() .findCoprocessorEnvironment(UngroupedAggregateRegionObserver.class.getName()); } }
@BeforeClass public static void doSetup() throws Exception { Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(10); serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_ATTRIB, Boolean.TRUE.toString()); serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_INTERVAL_ATTRIB, Long.toString(REBUILD_INTERVAL)); serverProps.put(QueryServices.INDEX_REBUILD_DISABLE_TIMESTAMP_THRESHOLD, "50000000"); serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_PERIOD, Long.toString(REBUILD_PERIOD)); // batch at 50 seconds serverProps.put(QueryServices.INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_FORWARD_TIME_ATTRIB, Long.toString(WAIT_AFTER_DISABLED)); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1); clientProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, "2"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); indexRebuildTaskRegionEnvironment = getUtility() .getRSForFirstRegionInTable( PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME) .getRegions(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME) .get(0).getCoprocessorHost() .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName()); MetaDataRegionObserver.initRebuildIndexConnectionProps( indexRebuildTaskRegionEnvironment.getConfiguration()); }
@BeforeClass public static void doSetup() throws Exception { Map<String, String> serverProps = getServerProps(); serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString()); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.TRUE.toString()); clientProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, "2"); NUM_SLAVES_BASE = 4; setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); TableName systemTable = SchemaUtil.getPhysicalTableName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, true); indexRebuildTaskRegionEnvironment = getUtility() .getRSForFirstRegionInTable(systemTable).getRegions(systemTable).get(0).getCoprocessorHost() .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName()); MetaDataRegionObserver.initRebuildIndexConnectionProps(indexRebuildTaskRegionEnvironment.getConfiguration()); }
@BeforeClass public static void doSetup() throws Exception { Map<String, String> serverProps = getServerProps(); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2); clientProps.put(HConstants.HBASE_CLIENT_RETRIES_NUMBER, "2"); NUM_SLAVES_BASE = 4; setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); indexRebuildTaskRegionEnvironment = getUtility() .getRSForFirstRegionInTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME) .getRegions(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME).get(0).getCoprocessorHost() .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName()); MetaDataRegionObserver.initRebuildIndexConnectionProps( indexRebuildTaskRegionEnvironment.getConfiguration()); }
@BeforeClass public static void doSetup() throws Exception { SplitSystemCatalogIT.doSetup(); TaskRegionEnvironment = getUtility() .getRSForFirstRegionInTable( PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME) .getRegions(PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME) .get(0).getCoprocessorHost() .findCoprocessorEnvironment(TaskRegionObserver.class.getName()); }
.getRegions(PhoenixDatabaseMetaData.SYSTEM_CATALOG_HBASE_TABLE_NAME) .get(0).getCoprocessorHost() .findCoprocessorEnvironment(MetaDataRegionObserver.class.getName()); MetaDataRegionObserver.initRebuildIndexConnectionProps( indexRebuildTaskRegionEnvironment.getConfiguration());
/** * Rough test that Coprocessor Environment is Read-Only. * Just check a random CP and see that it returns a read-only config. */ @Test public void testReadOnlyConfiguration() throws Exception { Configuration conf = new Configuration(CONF); HRegion region = mock(HRegion.class); when(region.getRegionInfo()).thenReturn(REGIONINFO); when(region.getTableDescriptor()).thenReturn(TABLEDESC); RegionServerServices rsServices = mock(RegionServerServices.class); RegionCoprocessorHost rcp = new RegionCoprocessorHost(region, rsServices, conf); boolean found = false; for (String cpStr: rcp.getCoprocessors()) { CoprocessorEnvironment cpenv = rcp.findCoprocessorEnvironment(cpStr); if (cpenv != null) { found = true; } Configuration c = cpenv.getConfiguration(); thrown.expect(UnsupportedOperationException.class); c.set("one.two.three", "four.five.six"); } assertTrue("Should be at least one CP found", found); } }
if (region.getRegionInfo().getRegionNameAsString().startsWith(tableName.getNameAsString())) { CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); if (env != null) { found1 = true; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); if (env != null) { found2 = true;
if (region.getRegionInfo().getRegionNameAsString().startsWith(tableName.getNameAsString())) { CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); if (env != null) { found1 = true; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); if (env != null) { found2 = true;
foundTableRegion = true; CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); found1 = found1 && (env != null); env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); found2 = found2 && (env != null); if (env != null) {
foundTableRegion = true; CoprocessorEnvironment env; env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1); found1 = found1 && (env != null); env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2); found2 = found2 && (env != null); if (env != null) {
region.getCoprocessorHost().findCoprocessorEnvironment(cpName6); if (env != null) { found_6 = true;
region.getCoprocessorHost().findCoprocessorEnvironment(cpName6); if (env != null) { found_6 = true;