8000 Make agency watertight against illegal agents with new UUIDs - BTS-11… · cloudhub-js/arangodb@e09e7d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit e09e7d3

Browse files
authored
Make agency watertight against illegal agents with new UUIDs - BTS-1185 (arangodb#17919)
* Make agency watertight. This is about an agent trying to get into the agency with a new ID. This must be prevented, since it confuses the existing agency configuration. * CHANGELOG.
1 parent 9c6b1d8 commit e09e7d3

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
devel
22
-----
33

4+
* Prevent agency configuration confusion by an agent which comes back without
5+
its data directory and thus without its UUID.
6+
47
* APM-592: In batched query results, when executing requests for `/_api/cursor`,
58
there might be a connection error and the user might not be able to retrieve
69
the latest batch from the cursor. For that, a query option flag `allowRetry` was

arangod/Agency/AgentConfiguration.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ query_t config_t::poolToBuilder() const {
403403

404404
bool config_t::updateEndpoint(std::string const& id, std::string const& ep) {
405405
WRITE_LOCKER(readLocker, _lock);
406+
auto it = _pool.find(id);
407+
if (it == _pool.end() && _pool.size() == _agencySize) {
408+
return false;
409+
}
406410
if (_pool[id] != ep) {
407411
_pool[id] = ep;
408412
++_version;

arangod/Agency/State.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,15 @@ bool State::loadOrPersistConfiguration() {
10471047
LOG_TOPIC("504da", DEBUG, Logger::AGENCY)
10481048
<< "Merging configuration " << conf.toJson();
10491049
_agent->mergeConfiguration(conf);
1050-
1050+
auto pool = _agent->config().pool();
1051+
auto it = pool.find(_agent->config().id());
1052+
if (it == pool.end()) {
1053+
LOG_TOPIC("6acd3", FATAL, Logger::AGENCY)
1054+
<< "Ended up with a pool of agents which does not include "
1055+
"ourselves, configuration: "
1056+
<< _agent->config().toBuilder()->slice().toJson();
1057+
FATAL_ERROR_EXIT();
1058+
}
10511059
} catch (std::exception const& e) {
10521060
LOG_TOPIC("6acd2", FATAL, Logger::AGENCY)
10531061
<< "Failed to merge persisted configuration into runtime "

0 commit comments

Comments
 (0)
0