1
0
Fork 0

fix version check (#3781)

This commit is contained in:
Jan 2017-12-06 11:05:40 +01:00 committed by GitHub
parent 9434ed55a1
commit b235af0fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 7 deletions

View File

@ -174,18 +174,23 @@ Result Syncer::sendCreateBarrier(TRI_voc_tick_t minTick) {
_barrierId = 0;
std::string const url = ReplicationUrl + "/barrier";
std::string const body = "{\"ttl\":" + StringUtils::itoa(_barrierTtl) +
",\"tick\":\"" + StringUtils::itoa(minTick) + "\"}";
VPackBuilder builder;
builder.openObject();
builder.add("ttl", VPackValue(_barrierTtl));
builder.add("tick", VPackValue(std::to_string(minTick)));
builder.close();
std::string body = builder.slice().toJson();
// send request
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
rest::RequestType::POST, url, body.c_str(), body.size()));
rest::RequestType::POST, url, body.data(), body.size()));
if (hasFailed(response.get())) {
return buildHttpError(response.get(), url);
}
VPackBuilder builder;
builder.clear();
Result r = parseResponse(builder, response.get());
if (r.fail()) {
return r;
@ -225,7 +230,7 @@ Result Syncer::sendExtendBarrier(TRI_voc_tick_t tick) {
// send request
std::unique_ptr<SimpleHttpResult> response(_client->request(
rest::RequestType::PUT, url, body.c_str(), body.size()));
rest::RequestType::PUT, url, body.data(), body.size()));
if (response == nullptr || !response->isComplete()) {
return Result(TRI_ERROR_REPLICATION_NO_RESPONSE);
@ -834,8 +839,9 @@ Result Syncer::buildHttpError(SimpleHttpResult* response, std::string const& url
bool Syncer::simulate32Client() const {
TRI_ASSERT(!_masterInfo._endpoint.empty() && _masterInfo._serverId != 0 &&
_masterInfo._majorVersion != 0);
bool is33 = _masterInfo._majorVersion >= 3 &&
_masterInfo._minorVersion >= 3;
bool is33 = (_masterInfo._majorVersion > 3 ||
(_masterInfo._majorVersion == 3 &&
_masterInfo._minorVersion >= 3));
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
// allows us to test the old replication API
return !is33 || _configuration._force32mode;