logger.error("ERROR: host unavailable \"" + host + "\", black-listing it for " + suspendTimeForHostUnavailable.toString(), throwable); FilteredForestConfiguration filteredForestConfig = new FilteredForestConfiguration(existingForestConfig); if ( batcher instanceof WriteBatcher ) { filteredForestConfig = filteredForestConfig.withBlackList(host);
@Test public void testWithWriteAndQueryBatcher() throws Exception{ if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) return; ForestConfiguration forestConfig = moveMgr.readForestConfig(); long hostNum = Stream.of(forestConfig.listForests()).map(forest->forest.getPreferredHost()).distinct().count(); if ( hostNum <= 1 ) return; // we're not in a cluster, so this test isn't valid String host1 = forestConfig.listForests()[0].getPreferredHost(); FilteredForestConfiguration ffg = new FilteredForestConfiguration(forestConfig) .withRenamedHost(host1, Inet4Address.getByName(host1).getHostAddress()); runWithWriteAndQueryBatcher(ffg); ffg = new FilteredForestConfiguration(forestConfig) .withWhiteList(host1); runWithWriteAndQueryBatcher(ffg); ffg = new FilteredForestConfiguration(forestConfig) .withBlackList(host1); runWithWriteAndQueryBatcher(ffg); }
@Test public void testWithInvalidHosts() throws Exception{ if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) return; ForestConfiguration forestConfig = moveMgr.readForestConfig(); String host1 = forestConfig.listForests()[0].getPreferredHost(); FilteredForestConfiguration ffg = new FilteredForestConfiguration(forestConfig) .withRenamedHost("someInvalidHostName", "anotherInvalidHostName"); runWithWriteAndQueryBatcher(ffg); ffg = new FilteredForestConfiguration(forestConfig) .withBlackList("someInvalidHostName"); runWithWriteAndQueryBatcher(ffg); ffg = new FilteredForestConfiguration(forestConfig) .withWhiteList("someInvalidHostName") .withWhiteList(host1); runWithWriteAndQueryBatcher(ffg); }
if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) return; FilteredForestConfiguration ffg = new FilteredForestConfiguration(forests) .withBlackList("host1") .withBlackList("openReplicaHost2")
if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) return; FilteredForestConfiguration ffg = new FilteredForestConfiguration(forests) .withWhiteList("host1") .withWhiteList("openReplicaHost2")
if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) return; FilteredForestConfiguration ffg = new FilteredForestConfiguration(forests) .withRenamedHost("host1", "host1a");