diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2021-11-30 14:33:56 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2021-11-30 14:33:56 +0000 |
commit | 343e3b9956704a3b4331c06fd705e2391cb23f1d (patch) | |
tree | d79ab1e23e5bc0d44ae5ce52d14e3e427ee9528a /config/src | |
parent | 01897e85ce899c9649e9e0b60d9cca9d3c5c3273 (diff) |
Preserve changed-flag for concurrent config updates
This should avoid the following race condition between two config updates
arriving within a very short interval:
1. Config generation _n-1_ contains changes to payload
2. Subscriber thread does not apply config _n-1_ internally before
generation _n_ arrives
3. Config generation _n_ does not contain changes to payload. Overwrites
change flag of generation _n-1_
4. Change status lost, subscriber does not update internal config
Diffstat (limited to 'config/src')
-rw-r--r-- | config/src/vespa/config/subscription/configsubscription.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/src/vespa/config/subscription/configsubscription.cpp b/config/src/vespa/config/subscription/configsubscription.cpp index 4aaa30323c7..379687e1fd8 100644 --- a/config/src/vespa/config/subscription/configsubscription.cpp +++ b/config/src/vespa/config/subscription/configsubscription.cpp @@ -31,7 +31,11 @@ ConfigSubscription::nextUpdate(int64_t generation, std::chrono::milliseconds tim if (_closed || !_holder->poll()) { return false; } + auto old = std::move(_next); _next = _holder->provide(); + if (old) { + _next->merge(*old); + } if (isGenerationNewer(_next->getGeneration(), generation)) { return true; } |