Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ArangoAgency::version() #14476

Merged
merged 2 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -622,8 +622,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