Merge pull request #942 from metamx/fix-tiered-selector-naming

fix tiered selector service name usage
This commit is contained in:
Fangjin Yang 2014-12-08 12:09:45 -07:00
commit 3a7f571aeb
1 changed files with 4 additions and 3 deletions

View File

@ -28,6 +28,7 @@ import com.metamx.common.lifecycle.LifecycleStart;
import com.metamx.common.lifecycle.LifecycleStop; import com.metamx.common.lifecycle.LifecycleStop;
import com.metamx.emitter.EmittingLogger; import com.metamx.emitter.EmittingLogger;
import io.druid.client.selector.HostSelector; import io.druid.client.selector.HostSelector;
import io.druid.curator.discovery.CuratorServiceUtils;
import io.druid.curator.discovery.ServerDiscoveryFactory; import io.druid.curator.discovery.ServerDiscoveryFactory;
import io.druid.curator.discovery.ServerDiscoverySelector; import io.druid.curator.discovery.ServerDiscoverySelector;
import io.druid.query.Query; import io.druid.query.Query;
@ -183,7 +184,7 @@ public class TieredBrokerHostSelector<T> implements HostSelector<T>
brokerServiceName = tierConfig.getDefaultBrokerServiceName(); brokerServiceName = tierConfig.getDefaultBrokerServiceName();
} }
ServerDiscoverySelector retVal = selectorMap.get(brokerServiceName); ServerDiscoverySelector retVal = selectorMap.get(CuratorServiceUtils.makeCanonicalServiceName(brokerServiceName));
if (retVal == null) { if (retVal == null) {
log.error( log.error(
@ -191,7 +192,7 @@ public class TieredBrokerHostSelector<T> implements HostSelector<T>
brokerServiceName, brokerServiceName,
tierConfig.getDefaultBrokerServiceName() tierConfig.getDefaultBrokerServiceName()
); );
retVal = selectorMap.get(tierConfig.getDefaultBrokerServiceName()); retVal = selectorMap.get(CuratorServiceUtils.makeCanonicalServiceName(tierConfig.getDefaultBrokerServiceName()));
} }
return new Pair<>(brokerServiceName, retVal); return new Pair<>(brokerServiceName, retVal);
@ -200,7 +201,7 @@ public class TieredBrokerHostSelector<T> implements HostSelector<T>
public Pair<String, ServerDiscoverySelector> getDefaultLookup() public Pair<String, ServerDiscoverySelector> getDefaultLookup()
{ {
final String brokerServiceName = tierConfig.getDefaultBrokerServiceName(); final String brokerServiceName = tierConfig.getDefaultBrokerServiceName();
final ServerDiscoverySelector retVal = selectorMap.get(brokerServiceName); final ServerDiscoverySelector retVal = selectorMap.get(CuratorServiceUtils.makeCanonicalServiceName(brokerServiceName));
return new Pair<>(brokerServiceName, retVal); return new Pair<>(brokerServiceName, retVal);
} }
} }