Skip to content

Commit

Permalink
Fix ArangoAgency::version() (#14476)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jsteemann authored and maierlars committed Jul 8, 2021
1 parent 2bc0d5f commit 0c67ac1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
devel
-----

* 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.

* Fixed an issue in index selection, when the selectivty estimate of another
prefix index was used without checking if the other index covered the
FILTER condition.
Expand Down
10 changes: 8 additions & 2 deletions arangod/Agency/AgencyComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,14 @@ std::string AgencyComm::version() {
AgencyCommHelper::CONNECTION_OPTIONS._requestTimeout,
"/_api/version", VPackSlice::noneSlice());

if (result.successful() && result.slice().isString()) {
return result.slice().copyString();
if (result.successful()) {
VPackSlice r = result.slice();
if (r.isObject()) {
r = r.get("version");
}
if (r.isString()) {
return r.copyString();
}
}

return "";
Expand Down
2 changes: 1 addition & 1 deletion arangod/Cluster/ClusterFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ void ClusterFeature::start() {
<< (_forceOneShard ? " with one-shard mode" : "")
<< ". Agency version: " << version << ", Agency endpoints: " << endpoints
<< ", server id: '" << myId << "', internal endpoint / address: " << _myEndpoint
<< "', advertised endpoint: " << _myAdvertisedEndpoint << ", role: " << role;
<< "', advertised endpoint: " << _myAdvertisedEndpoint << ", role: " << ServerState::roleToString(role);

auto [acb, idx] = _agencyCache->read(
std::vector<std::string>{AgencyCommHelper::path("Sync/HeartbeatIntervalMs")});
Expand Down
7 changes: 6 additions & 1 deletion tests/js/server/shell/shell-cluster-agency.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*jshint globalstrict:false, strict:false */
/*global fail, assertFalse, assertTrue, assertEqual, ArangoAgency */
/*global fail, assertFalse, assertTrue, assertEqual, assertMatch, ArangoAgency */

////////////////////////////////////////////////////////////////////////////////
/// @brief test the agency communication layer
Expand Down Expand Up @@ -65,6 +65,11 @@ function AgencySuite () {
catch (err) {
}
},

testVersion : function () {
let result = agency.version();
assertMatch(/^\d\.\d/, result);
},

////////////////////////////////////////////////////////////////////////////////
/// @brief test set
Expand Down

0 comments on commit 0c67ac1

Please sign in to comment.