diff options
Diffstat (limited to 'config/src/vespa/config/frt')
31 files changed, 53 insertions, 39 deletions
diff --git a/config/src/vespa/config/frt/CMakeLists.txt b/config/src/vespa/config/frt/CMakeLists.txt index 74a3916e168..af2b09592fb 100644 --- a/config/src/vespa/config/frt/CMakeLists.txt +++ b/config/src/vespa/config/frt/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_library(config_frt OBJECT SOURCES frtsource.cpp diff --git a/config/src/vespa/config/frt/compressioninfo.cpp b/config/src/vespa/config/frt/compressioninfo.cpp index f87c5f5d4d2..a5c0426774a 100644 --- a/config/src/vespa/config/frt/compressioninfo.cpp +++ b/config/src/vespa/config/frt/compressioninfo.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "compressioninfo.h" #include <vespa/config/frt/protocol.h> #include <vespa/vespalib/data/slime/inspector.h> diff --git a/config/src/vespa/config/frt/compressioninfo.h b/config/src/vespa/config/frt/compressioninfo.h index 1f74f8c3cf1..a5dc756d29d 100644 --- a/config/src/vespa/config/frt/compressioninfo.h +++ b/config/src/vespa/config/frt/compressioninfo.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/frt/protocol.h> diff --git a/config/src/vespa/config/frt/connection.h b/config/src/vespa/config/frt/connection.h index 328e9ede67a..cc5165036b4 100644 --- a/config/src/vespa/config/frt/connection.h +++ b/config/src/vespa/config/frt/connection.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/stllike/string.h> diff --git a/config/src/vespa/config/frt/connectionfactory.h b/config/src/vespa/config/frt/connectionfactory.h index eb7ca10fa0d..fc38c6f05f1 100644 --- a/config/src/vespa/config/frt/connectionfactory.h +++ b/config/src/vespa/config/frt/connectionfactory.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <memory> diff --git a/config/src/vespa/config/frt/frtconfigagent.cpp b/config/src/vespa/config/frt/frtconfigagent.cpp index 07f33104013..6a5b1ed09ea 100644 --- a/config/src/vespa/config/frt/frtconfigagent.cpp +++ b/config/src/vespa/config/frt/frtconfigagent.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigagent.h" #include "frtconfigrequestv3.h" #include <vespa/config/common/trace.h> diff --git a/config/src/vespa/config/frt/frtconfigagent.h b/config/src/vespa/config/frt/frtconfigagent.h index a2a91320d0e..16d13a3e550 100644 --- a/config/src/vespa/config/frt/frtconfigagent.h +++ b/config/src/vespa/config/frt/frtconfigagent.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/common/configstate.h> diff --git a/config/src/vespa/config/frt/frtconfigrequest.cpp b/config/src/vespa/config/frt/frtconfigrequest.cpp index e7da9f53e97..a4ffbe420fe 100644 --- a/config/src/vespa/config/frt/frtconfigrequest.cpp +++ b/config/src/vespa/config/frt/frtconfigrequest.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigrequest.h" #include "frtconfigresponse.h" #include "connection.h" diff --git a/config/src/vespa/config/frt/frtconfigrequest.h b/config/src/vespa/config/frt/frtconfigrequest.h index 4bcab2c6377..5f28983c898 100644 --- a/config/src/vespa/config/frt/frtconfigrequest.h +++ b/config/src/vespa/config/frt/frtconfigrequest.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/common/configrequest.h> diff --git a/config/src/vespa/config/frt/frtconfigrequestfactory.cpp b/config/src/vespa/config/frt/frtconfigrequestfactory.cpp index 28bfb80a299..38a495d79eb 100644 --- a/config/src/vespa/config/frt/frtconfigrequestfactory.cpp +++ b/config/src/vespa/config/frt/frtconfigrequestfactory.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigrequestfactory.h" #include "frtconfigrequestv3.h" #include <vespa/config/common/trace.h> diff --git a/config/src/vespa/config/frt/frtconfigrequestfactory.h b/config/src/vespa/config/frt/frtconfigrequestfactory.h index d2db71ffa6d..e50294b7449 100644 --- a/config/src/vespa/config/frt/frtconfigrequestfactory.h +++ b/config/src/vespa/config/frt/frtconfigrequestfactory.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/common/compressiontype.h> diff --git a/config/src/vespa/config/frt/frtconfigrequestv3.cpp b/config/src/vespa/config/frt/frtconfigrequestv3.cpp index fe8ec2a0403..7ba4f2e8411 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv3.cpp +++ b/config/src/vespa/config/frt/frtconfigrequestv3.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigrequestv3.h" #include "frtconfigresponsev3.h" #include "connection.h" diff --git a/config/src/vespa/config/frt/frtconfigrequestv3.h b/config/src/vespa/config/frt/frtconfigrequestv3.h index a3f765eeb19..8ccf5152768 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv3.h +++ b/config/src/vespa/config/frt/frtconfigrequestv3.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "slimeconfigrequest.h" diff --git a/config/src/vespa/config/frt/frtconfigresponse.cpp b/config/src/vespa/config/frt/frtconfigresponse.cpp index 28c2825f71c..523126ee835 100644 --- a/config/src/vespa/config/frt/frtconfigresponse.cpp +++ b/config/src/vespa/config/frt/frtconfigresponse.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigresponse.h" #include <vespa/fnet/frt/rpcrequest.h> diff --git a/config/src/vespa/config/frt/frtconfigresponse.h b/config/src/vespa/config/frt/frtconfigresponse.h index 2b9a4d34ccf..0591999ab18 100644 --- a/config/src/vespa/config/frt/frtconfigresponse.h +++ b/config/src/vespa/config/frt/frtconfigresponse.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/common/configresponse.h> diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp index 351f0fc8136..70d6456d433 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp +++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigresponsev3.h" #include "compressioninfo.h" #include <vespa/fnet/frt/values.h> diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.h b/config/src/vespa/config/frt/frtconfigresponsev3.h index 2f9b9e83d03..46f69f8b20d 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.h +++ b/config/src/vespa/config/frt/frtconfigresponsev3.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "slimeconfigresponse.h" diff --git a/config/src/vespa/config/frt/frtconnection.cpp b/config/src/vespa/config/frt/frtconnection.cpp index 4f1bf1c280c..d9b48bc8bbe 100644 --- a/config/src/vespa/config/frt/frtconnection.cpp +++ b/config/src/vespa/config/frt/frtconnection.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconnection.h" #include <vespa/config/common/errorcode.h> #include <vespa/fnet/frt/supervisor.h> diff --git a/config/src/vespa/config/frt/frtconnection.h b/config/src/vespa/config/frt/frtconnection.h index a0901514e92..c49c9369bbe 100644 --- a/config/src/vespa/config/frt/frtconnection.h +++ b/config/src/vespa/config/frt/frtconnection.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "connection.h" diff --git a/config/src/vespa/config/frt/frtconnectionpool.cpp b/config/src/vespa/config/frt/frtconnectionpool.cpp index b73a28483e6..d531a759004 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.cpp +++ b/config/src/vespa/config/frt/frtconnectionpool.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconnectionpool.h" #include <vespa/vespalib/util/host_name.h> diff --git a/config/src/vespa/config/frt/frtconnectionpool.h b/config/src/vespa/config/frt/frtconnectionpool.h index 5d97f2ae338..2356af672c5 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.h +++ b/config/src/vespa/config/frt/frtconnectionpool.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "frtconnection.h" diff --git a/config/src/vespa/config/frt/frtsource.cpp b/config/src/vespa/config/frt/frtsource.cpp index 6030b27da02..b160984e0e8 100644 --- a/config/src/vespa/config/frt/frtsource.cpp +++ b/config/src/vespa/config/frt/frtsource.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigrequest.h" #include "frtconfigresponse.h" #include "frtsource.h" @@ -39,7 +39,7 @@ FRTSource::FRTSource(std::shared_ptr<ConnectionFactory> connectionFactory, const _lock(), _inflight(), _task(std::make_unique<GetConfigTask>(_connectionFactory->getScheduler(), this)), - _closed(false) + _state(State::OPEN) { LOG(spam, "New source!"); } @@ -68,6 +68,9 @@ FRTSource::getConfig() FRT_RPCRequest * req = request->getRequest(); { std::lock_guard guard(_lock); + if (_state != State::OPEN) { + return; + } _inflight[req] = std::move(request); } connection->invoke(req, clientTimeout, this); @@ -126,11 +129,19 @@ FRTSource::close() { RequestMap inflight; { - std::lock_guard guard(_lock); - if (_closed) + std::unique_lock guard(_lock); + if (_state != State::OPEN) { + while (_state != State::CLOSED) { + _cond.wait(guard); // Wait for first close to finish + } return; - LOG(spam, "Killing task"); - _task->Kill(); + } + _state = State::CLOSING; + } + LOG(spam, "Killing task"); + _task->Kill(); + { + std::lock_guard guard(_lock); inflight = _inflight; } LOG(spam, "Aborting"); @@ -144,14 +155,17 @@ FRTSource::close() _cond.wait(guard); } LOG(spam, "closed"); + _state = State::CLOSED; + _cond.notify_all(); } void FRTSource::scheduleNextGetConfig() { std::lock_guard guard(_lock); - if (_closed) + if (_state != State::OPEN) { return; + } double sec = vespalib::to_s(_agent->getWaitTime()); LOG(debug, "Scheduling task in %f seconds", sec); _task->Schedule(sec); diff --git a/config/src/vespa/config/frt/frtsource.h b/config/src/vespa/config/frt/frtsource.h index ceb0484a6bb..92aa6a7370d 100644 --- a/config/src/vespa/config/frt/frtsource.h +++ b/config/src/vespa/config/frt/frtsource.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/config/common/configkey.h> @@ -37,11 +37,11 @@ private: const FRTConfigRequestFactory & _requestFactory; std::unique_ptr<ConfigAgent> _agent; const ConfigKey _key; - std::mutex _lock; // Protects _inflight, _task and _closed + std::mutex _lock; // Protects _inflight, _task and _state std::condition_variable _cond; RequestMap _inflight; std::unique_ptr<FNET_Task> _task; - bool _closed; + enum class State : uint8_t { OPEN, CLOSING, CLOSED } _state; }; } // namespace config diff --git a/config/src/vespa/config/frt/frtsourcefactory.cpp b/config/src/vespa/config/frt/frtsourcefactory.cpp index 1c740534730..23aa7e41037 100644 --- a/config/src/vespa/config/frt/frtsourcefactory.cpp +++ b/config/src/vespa/config/frt/frtsourcefactory.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtsourcefactory.h" #include "frtsource.h" diff --git a/config/src/vespa/config/frt/frtsourcefactory.h b/config/src/vespa/config/frt/frtsourcefactory.h index 19cf6241481..4a3577c3cbb 100644 --- a/config/src/vespa/config/frt/frtsourcefactory.h +++ b/config/src/vespa/config/frt/frtsourcefactory.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "frtconfigrequestfactory.h" diff --git a/config/src/vespa/config/frt/protocol.cpp b/config/src/vespa/config/frt/protocol.cpp index 17e4da5bf09..6a7e807f187 100644 --- a/config/src/vespa/config/frt/protocol.cpp +++ b/config/src/vespa/config/frt/protocol.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "protocol.h" #include <lz4.h> #include <vespa/vespalib/util/stringfmt.h> diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h index b8d7a5ff7fc..82afbe0882f 100644 --- a/config/src/vespa/config/frt/protocol.h +++ b/config/src/vespa/config/frt/protocol.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include <vespa/vespalib/data/memory.h> diff --git a/config/src/vespa/config/frt/slimeconfigrequest.cpp b/config/src/vespa/config/frt/slimeconfigrequest.cpp index 6f83840f13a..19a6e4c6efd 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.cpp +++ b/config/src/vespa/config/frt/slimeconfigrequest.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "slimeconfigrequest.h" #include "connection.h" #include <vespa/config/common/configkey.h> diff --git a/config/src/vespa/config/frt/slimeconfigrequest.h b/config/src/vespa/config/frt/slimeconfigrequest.h index 70d35ce0e99..3508a495dcd 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.h +++ b/config/src/vespa/config/frt/slimeconfigrequest.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "frtconfigrequest.h" diff --git a/config/src/vespa/config/frt/slimeconfigresponse.cpp b/config/src/vespa/config/frt/slimeconfigresponse.cpp index c1f3df7f674..543376033c1 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.cpp +++ b/config/src/vespa/config/frt/slimeconfigresponse.cpp @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "slimeconfigresponse.h" #include <vespa/config/common/misc.h> #include <vespa/fnet/frt/values.h> diff --git a/config/src/vespa/config/frt/slimeconfigresponse.h b/config/src/vespa/config/frt/slimeconfigresponse.h index 87320f48dd4..d3b88a124ee 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.h +++ b/config/src/vespa/config/frt/slimeconfigresponse.h @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "frtconfigresponse.h" |