diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2017-02-21 11:56:21 +0100 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2017-02-21 11:56:21 +0100 |
commit | 98dc2eb38faabd8317be8a061c3fe4ea0629fcd5 (patch) | |
tree | c29539816e080baa28bcecee4491c6e3c7d2f1c8 /messagebus/src | |
parent | d2b7f9a40696b6b985d26f55af74ff88744531dc (diff) |
log more details when network setup fails
Diffstat (limited to 'messagebus/src')
-rw-r--r-- | messagebus/src/vespa/messagebus/network/rpcnetwork.cpp | 22 | ||||
-rw-r--r-- | messagebus/src/vespa/messagebus/network/rpcnetwork.h | 1 |
2 files changed, 21 insertions, 2 deletions
diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp index a5caaa127c3..21a63cc9060 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp @@ -106,8 +106,9 @@ RPCNetwork::RPCNetwork(const RPCNetworkParams ¶ms) : _targetPool(params.getConnectionExpireSecs()), _targetPoolTask(_scheduler, _targetPool), _servicePool(*this, 4096), - _mirror(std::make_unique<slobrok::api::MirrorAPI>(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig()))), - _regAPI(std::make_unique<slobrok::api::RegisterAPI>(_orb, slobrok::ConfiguratorFactory(params.getSlobrokConfig()))), + _slobrokCfgFactory(params.getSlobrokConfig()), + _mirror(std::make_unique<slobrok::api::MirrorAPI>(_orb, _slobrokCfgFactory)), + _regAPI(std::make_unique<slobrok::api::RegisterAPI>(_orb, _slobrokCfgFactory)), _oosManager(_orb, *_mirror, params.getOOSServerPattern()), _requestedPort(params.getListenPort()), _sendV1(), @@ -215,15 +216,32 @@ RPCNetwork::start() return true; } + + bool RPCNetwork::waitUntilReady(double seconds) const { + slobrok::api::SlobrokList brokerList; + slobrok::Configurator::UP configurator = _slobrokCfgFactory.create(brokerList); + bool hasConfig = false; for (uint32_t i = 0; i < seconds * 100; ++i) { + if (configurator->poll()) { + hasConfig = true; + } if (_mirror->ready() && _oosManager.isReady()) { return true; } FastOS_Thread::Sleep(10); } + if (! hasConfig) { + LOG(error, "failed to get config for slobroks in %d seconds", (int)seconds); + } else if (! _mirror->ready()) { + std::string brokers = brokerList.logString(); + LOG(error, "mirror (of %s) failed to become ready in %d seconds", + brokers.c_str(), (int)seconds); + } else if (! _oosManager.isReady()) { + LOG(error, "OOS manager failed to become ready in %d seconds", (int)seconds); + } return false; } diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.h b/messagebus/src/vespa/messagebus/network/rpcnetwork.h index 4196a5c89a5..674fb579b61 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.h +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.h @@ -60,6 +60,7 @@ private: RPCTargetPool _targetPool; TargetPoolTask _targetPoolTask; RPCServicePool _servicePool; + slobrok::ConfiguratorFactory _slobrokCfgFactory; std::unique_ptr<slobrok::api::IMirrorAPI> _mirror; std::unique_ptr<slobrok::api::RegisterAPI> _regAPI; OOSManager _oosManager; |