8000 Fix ArangoAgency::version() (#14476) · RtiWeb/arangodb@c6931da · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit c6931da

Browse files
authored
Fix ArangoAgency::version() (arangodb#14476)
* Fix ArangoAgency::version(), which always returned an empty string instead of the agency's correctly reported version. This also fixes the agency version in the startup log messages of the cluster.
1 parent b7b58a0 commit c6931da

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

CHANGELOG

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

4+
* Fix ArangoAgency::version(), which always returned an empty string instead
5+
of the agency's correctly reported version. This also fixes the agency
6+
version in the startup log messages of the cluster.
7+
48
* Fixed an issue in index selection, when the selectivty estimate of another
59
prefix index was used without checking if the other index covered the
610
FILTER condition.

arangod/Agency/AgencyComm.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,14 @@ std::string AgencyComm::version() {
622622
AgencyCommHelper::CONNECTION_OPTIONS._requestTimeout,
623623
"/_api/version", VPackSlice::noneSlice());
624624

625-
if (result.successful() && result.slice().isString()) {
626-
return result.slice().copyString();
625+
if (result.successful()) {
626+
VPackSlice r = result.slice();
627+
if (r.isObject()) {
628+
r = r.get("version");
629+
}
630+
if (r.isString()) {
631+
return r.copyString();
632+
}
627633
}
628634

629635
return "";

arangod/Cluster/ClusterFeature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ void ClusterFeature::start() {
623623
<< (_forceOneShard ? " with one-shard mode" : "")
624624
<< ". Agency version: " << version << ", Agency endpoints: " << endpoints
625625
<< ", server id: '" << myId << "', internal endpoint / address: " << _myEndpoint
626-
<< "', advertised endpoint: " << _myAdvertisedEndpoint << ", role: " << role;
626+
<< "', advertised endpoint: " << _myAdvertisedEndpoint << ", role: " << ServerState::roleToString(role);
627627

628628
auto [acb, idx] = _agencyCache->read(
629629
std::vector<std::string>{AgencyCommHelper::path("Sync/HeartbeatIntervalMs")});

tests/js/server/shell/shell-cluster-agency.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*jshint globalstrict:false, strict:false */
2-
/*global fail, assertFalse, assertTrue, assertEqual, ArangoAgency */
2+
/*global fail, assertFalse, assertTrue, assertEqual, assertMatch, ArangoAgency */
33

44
////////////////////////////////////////////////////////////////////////////////
55
/// @brief test the agency communication layer
@@ -65,6 +65,11 @@ function AgencySuite () {
6565
catch (err) {
6666
}
6767
},
68+
69+
testVersion : function () {
70+
let result = agency.version();
71+
assertMatch(/^\d\.\d/, result);
72+
},
6873

6974
////////////////////////////////////////////////////////////////////////////////
7075
/// @brief test set

0 commit comments

Comments
 (0)
0