clean up failure scenarios

This commit is contained in:
fjy 2014-03-19 10:30:52 -07:00
parent 76ef9d192c
commit a96dfc7742
1 changed files with 7 additions and 9 deletions

View File

@ -84,12 +84,12 @@ public class TierAwareQueryRunner<T> implements QueryRunner<T>
String brokerServiceName = brokerSelector.select(query); String brokerServiceName = brokerSelector.select(query);
if (brokerServiceName == null) { if (brokerServiceName == null) {
log.error( log.makeAlert(
"WTF?! No brokerServiceName found for datasource[%s], intervals[%s]. Using default[%s].", "WTF?! No brokerServiceName found for datasource[%s], intervals[%s]. Using default[%s].",
query.getDataSource(), query.getDataSource(),
query.getIntervals(), query.getIntervals(),
tierConfig.getDefaultBrokerServiceName() tierConfig.getDefaultBrokerServiceName()
); ).emit();
brokerServiceName = tierConfig.getDefaultBrokerServiceName(); brokerServiceName = tierConfig.getDefaultBrokerServiceName();
} }
@ -97,11 +97,11 @@ public class TierAwareQueryRunner<T> implements QueryRunner<T>
Server server; Server server;
if (selector == null) { if (selector == null) {
log.error( log.makeAlert(
"WTF?! No selector found for brokerServiceName[%s]. Using default selector for[%s]", "WTF?! No selector found for brokerServiceName[%s]. Using default selector for[%s]",
brokerServiceName, brokerServiceName,
tierConfig.getDefaultBrokerServiceName() tierConfig.getDefaultBrokerServiceName()
); ).emit();
selector = selectorMap.get(tierConfig.getDefaultBrokerServiceName()); selector = selectorMap.get(tierConfig.getDefaultBrokerServiceName());
if (selector != null) { if (selector != null) {
@ -122,11 +122,11 @@ public class TierAwareQueryRunner<T> implements QueryRunner<T>
server = serverBackup.get(brokerServiceName); server = serverBackup.get(brokerServiceName);
if (server == null) { if (server == null) {
log.error( log.makeAlert(
"WTF?! No backup found for brokerServiceName[%s]. Using default[%s]", "WTF?! No backup found for brokerServiceName[%s]. Using default[%s]",
brokerServiceName, brokerServiceName,
tierConfig.getDefaultBrokerServiceName() tierConfig.getDefaultBrokerServiceName()
); ).emit();
server = serverBackup.get(tierConfig.getDefaultBrokerServiceName()); server = serverBackup.get(tierConfig.getDefaultBrokerServiceName());
} }
@ -144,10 +144,8 @@ public class TierAwareQueryRunner<T> implements QueryRunner<T>
if (server == null) { if (server == null) {
log.makeAlert( log.makeAlert(
"Catastrophic failure! No servers found for default broker [%s]!", "Catastrophic failure! No servers found at all! Failing request!"
tierConfig.getDefaultBrokerServiceName()
).emit(); ).emit();
return Sequences.empty(); return Sequences.empty();
} }