diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-20 23:26:55 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-20 23:34:51 +0000 |
commit | acbdc8385fef981a9bc5cbfb46483c54c953dc04 (patch) | |
tree | 1d9c02e4e9476510dd32131cad01940969493806 /searchcore | |
parent | 1cfea65b9bc71b472e9dc3370b120cf428b6ece0 (diff) |
Make ConfigUri constructors explicit and use same context where possible in proton.
Diffstat (limited to 'searchcore')
5 files changed, 16 insertions, 14 deletions
diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index d7e073c9a56..61536f924a5 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -185,7 +185,9 @@ App::Main() LOG(debug, "identity: '%s'", params.identity.c_str()); LOG(debug, "serviceidentity: '%s'", params.serviceidentity.c_str()); LOG(debug, "subscribeTimeout: '%" PRIu64 "'", params.subscribeTimeout); - protonUP = std::make_unique<proton::Proton>(params.identity, _argc > 0 ? _argv[0] : "proton", std::chrono::milliseconds(params.subscribeTimeout)); + std::chrono::milliseconds subscribeTimeout(params.subscribeTimeout); + config::ConfigUri identityUri(params.identity); + protonUP = std::make_unique<proton::Proton>(identityUri, _argc > 0 ? _argv[0] : "proton", subscribeTimeout); proton::Proton & proton = *protonUP; proton::BootstrapConfig::SP configSnapshot = proton.init(); if (proton.hasAbortedInit()) { @@ -200,13 +202,14 @@ App::Main() } configSnapshot.reset(); std::unique_ptr<ProtonServiceLayerProcess> spiProton; + if ( ! params.serviceidentity.empty()) { - spiProton = std::make_unique<ProtonServiceLayerProcess>(params.serviceidentity, proton); - spiProton->setupConfig(std::chrono::milliseconds(params.subscribeTimeout)); + spiProton = std::make_unique<ProtonServiceLayerProcess>(identityUri.createWithNewId(params.serviceidentity), proton); + spiProton->setupConfig(subscribeTimeout); spiProton->createNode(); EV_STARTED("servicelayer"); } else { - proton.getMetricManager().init(params.identity, proton.getThreadPool()); + proton.getMetricManager().init(identityUri, proton.getThreadPool()); } EV_STARTED("proton"); while (!(SIG::INT.check() || SIG::TERM.check() || (spiProton && spiProton->getNode().attemptedStopped()))) { diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index 5c22c0b4196..827b9a04e36 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -118,7 +118,7 @@ public: std::string rtcPattern3 = "*/search/*/realtimecontroller"; try { - slobrok::ConfiguratorFactory sbcfg("client"); + slobrok::ConfiguratorFactory sbcfg(config::ConfigUri("client")); slobrok::api::MirrorAPI sbmirror(_frt->supervisor(), sbcfg); for (int timeout = 1; timeout < 20; timeout++) { if (!sbmirror.ready()) { @@ -170,7 +170,7 @@ public: std::string rtcPattern = "search/cluster.*/c*/r*/realtimecontroller"; try { - slobrok::ConfiguratorFactory sbcfg("client"); + slobrok::ConfiguratorFactory sbcfg(config::ConfigUri("client")); slobrok::api::MirrorAPI sbmirror(_frt->supervisor(), sbcfg); for (int timeout = 1; timeout < 20; timeout++) { if (!sbmirror.ready()) { diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 0aa0e1fb2ba..642f8746587 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -340,9 +340,8 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) initializeThreads.reset(); _prepareRestartHandler = std::make_unique<PrepareRestartHandler>(*_flushEngine); - RPCHooks::Params rpcParams(*this, protonConfig.rpcport, _configUri.getConfigId(), + RPCHooks::Params rpcParams(*this, protonConfig.rpcport, _configUri, protonConfig.slobrokconfigid, std::max(2u, computeRpcTransportThreads(protonConfig, hwInfo.cpu()))); - rpcParams.slobrok_config = _configUri.createWithNewId(protonConfig.slobrokconfigid); _rpcHooks = std::make_unique<RPCHooks>(rpcParams); _metricsEngine->addExternalMetrics(_rpcHooks->proto_rpc_adapter_metrics()); diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp index b7fb4ecdd92..441829d0d4c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp @@ -166,11 +166,11 @@ RPCHooksBase::initRPC() rb.ReturnDesc("success", "Whether or not prepare for restart was triggered."); } -RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const vespalib::string &ident, - uint32_t transportThreads) +RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const config::ConfigUri & configUri, + vespalib::stringref slobrokId, uint32_t transportThreads) : proton(parent), - slobrok_config(config::ConfigUri("client")), - identity(ident), + slobrok_config(configUri.createWithNewId(slobrokId)), + identity(configUri.getConfigId()), rtcPort(port), numTranportThreads(transportThreads) { } diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h index 19805da6610..4faa2c55b79 100644 --- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h +++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h @@ -85,8 +85,8 @@ public: uint32_t rtcPort; uint32_t numTranportThreads; - Params(Proton &parent, uint32_t port, const vespalib::string &ident, - uint32_t numTransportThreads); + Params(Proton &parent, uint32_t port, const config::ConfigUri & configUri, + vespalib::stringref slobrokId, uint32_t numTransportThreads); ~Params(); }; RPCHooksBase(const RPCHooksBase &) = delete; |