1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
hkernbach 2016-02-19 20:44:32 +01:00
commit adadc04e49
20 changed files with 51 additions and 49 deletions

View File

@ -69,7 +69,6 @@ Syncer::Syncer(TRI_vocbase_t* vocbase,
_barrierId(0),
_barrierUpdateTime(0),
_barrierTtl(600) {
if (configuration->_database.empty()) {
// use name of current database
_databaseName = std::string(vocbase->_name);
@ -121,8 +120,7 @@ Syncer::Syncer(TRI_vocbase_t* vocbase,
Syncer::~Syncer() {
try {
sendRemoveBarrier();
}
catch (...) {
} catch (...) {
}
// shutdown everything properly
@ -170,16 +168,16 @@ int Syncer::sendCreateBarrier(std::string& errorMsg, TRI_voc_tick_t minTick) {
_barrierId = 0;
std::string const url = BaseUrl + "/barrier";
std::string const body = "{\"ttl\":" + StringUtils::itoa(_barrierTtl) + ",\"tick\":\"" + StringUtils::itoa(minTick) + "\"}";
std::string const body = "{\"ttl\":" + StringUtils::itoa(_barrierTtl) +
",\"tick\":\"" + StringUtils::itoa(minTick) + "\"}";
// send request
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
HttpRequest::HTTP_REQUEST_POST, url, body.c_str(), body.size()));
if (response == nullptr || !response->isComplete()) {
errorMsg = "could not connect to master at " +
_masterInfo._endpoint + ": " +
_client->getErrorMessage();
errorMsg = "could not connect to master at " + _masterInfo._endpoint +
": " + _client->getErrorMessage();
return TRI_ERROR_REPLICATION_NO_RESPONSE;
}
@ -191,10 +189,9 @@ int Syncer::sendCreateBarrier(std::string& errorMsg, TRI_voc_tick_t minTick) {
if (response->wasHttpError()) {
res = TRI_ERROR_REPLICATION_MASTER_ERROR;
errorMsg = "got invalid response from master at " +
_masterInfo._endpoint + ": HTTP " +
StringUtils::itoa(response->getHttpReturnCode()) + ": " +
response->getHttpReturnMessage();
errorMsg = "got invalid response from master at " + _masterInfo._endpoint +
": HTTP " + StringUtils::itoa(response->getHttpReturnCode()) +
": " + response->getHttpReturnMessage();
} else {
std::unique_ptr<TRI_json_t> json(
TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, response->getBody().c_str()));
@ -209,7 +206,8 @@ int Syncer::sendCreateBarrier(std::string& errorMsg, TRI_voc_tick_t minTick) {
} else {
_barrierId = StringUtils::uint64(id);
_barrierUpdateTime = TRI_microtime();
LOG_TOPIC(DEBUG, Logger::REPLICATION) << "created WAL logfile barrier " << _barrierId;
LOG_TOPIC(DEBUG, Logger::REPLICATION) << "created WAL logfile barrier "
<< _barrierId;
}
}
}
@ -234,7 +232,8 @@ int Syncer::sendExtendBarrier(TRI_voc_tick_t tick) {
}
std::string const url = BaseUrl + "/barrier/" + StringUtils::itoa(_barrierId);
std::string const body = "{\"ttl\":" + StringUtils::itoa(_barrierTtl) + ",\"tick\"" + StringUtils::itoa(tick) + "\"}";
std::string const body = "{\"ttl\":" + StringUtils::itoa(_barrierTtl) +
",\"tick\"" + StringUtils::itoa(tick) + "\"}";
// send request
std::unique_ptr<SimpleHttpResult> response(_client->request(
@ -267,7 +266,8 @@ int Syncer::sendRemoveBarrier() {
}
try {
std::string const url = BaseUrl + "/barrier/" + StringUtils::itoa(_barrierId);
std::string const url =
BaseUrl + "/barrier/" + StringUtils::itoa(_barrierId);
// send request
std::unique_ptr<SimpleHttpResult> response(_client->retryRequest(
@ -518,7 +518,6 @@ int Syncer::createCollection(TRI_json_t const* json, TRI_vocbase_col_t** dst) {
return TRI_ERROR_NO_ERROR;
}
std::shared_ptr<VPackBuilder> builder =
arangodb::basics::JsonHelper::toVelocyPack(json);
@ -528,7 +527,8 @@ int Syncer::createCollection(TRI_json_t const* json, TRI_vocbase_col_t** dst) {
s.add("isSystem", VPackValue(true));
s.close();
VPackBuilder merged = VPackCollection::merge(s.slice(), builder->slice(), true);
VPackBuilder merged =
VPackCollection::merge(s.slice(), builder->slice(), true);
VocbaseCollectionInfo params(_vocbase, name.c_str(), merged.slice());
@ -710,9 +710,8 @@ int Syncer::getMasterState(std::string& errorMsg) {
_client->_retryWaitTime = retryWaitTime;
if (response == nullptr || !response->isComplete()) {
errorMsg = "could not connect to master at " +
_masterInfo._endpoint + ": " +
_client->getErrorMessage();
errorMsg = "could not connect to master at " + _masterInfo._endpoint +
": " + _client->getErrorMessage();
return TRI_ERROR_REPLICATION_NO_RESPONSE;
}
@ -722,10 +721,9 @@ int Syncer::getMasterState(std::string& errorMsg) {
if (response->wasHttpError()) {
res = TRI_ERROR_REPLICATION_MASTER_ERROR;
errorMsg = "got invalid response from master at " +
_masterInfo._endpoint + ": HTTP " +
StringUtils::itoa(response->getHttpReturnCode()) + ": " +
response->getHttpReturnMessage();
errorMsg = "got invalid response from master at " + _masterInfo._endpoint +
": HTTP " + StringUtils::itoa(response->getHttpReturnCode()) +
": " + response->getHttpReturnMessage();
} else {
std::unique_ptr<TRI_json_t> json(
TRI_JsonString(TRI_UNKNOWN_MEM_ZONE, response->getBody().c_str()));
@ -835,8 +833,8 @@ int Syncer::handleStateResponse(TRI_json_t const* json, std::string& errorMsg) {
return TRI_ERROR_REPLICATION_MASTER_INCOMPATIBLE;
}
if (major < 2 || major > 2 || (major == 2 && minor < 2)) {
// we can connect to 1.4, 2.0 and higher only
if (major == 3) {
// we can connect to 3.x onyl
errorMsg = "got incompatible master version" + endpointString + ": '" +
versionString + "'";
@ -849,7 +847,11 @@ int Syncer::handleStateResponse(TRI_json_t const* json, std::string& errorMsg) {
_masterInfo._lastLogTick = lastLogTick;
_masterInfo._active = running;
LOG_TOPIC(INFO, Logger::REPLICATION) << "connected to master at " << _masterInfo._endpoint << ", id " << _masterInfo._serverId << ", version " << _masterInfo._majorVersion << "." << _masterInfo._minorVersion << ", last log tick " << _masterInfo._lastLogTick;
LOG_TOPIC(INFO, Logger::REPLICATION)
<< "connected to master at " << _masterInfo._endpoint << ", id "
<< _masterInfo._serverId << ", version " << _masterInfo._majorVersion
<< "." << _masterInfo._minorVersion << ", last log tick "
<< _masterInfo._lastLogTick;
return TRI_ERROR_NO_ERROR;
}

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -6,7 +6,7 @@
"license": "Apache License, Version 2.0",
"isSystem": true,
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"repository": {

View File

@ -2,7 +2,7 @@
"name": "broken-controller-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "broken-controller.js"

View File

@ -2,7 +2,7 @@
"name": "broken-exports-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"exports": {
"broken": "broken-exports.js"

View File

@ -2,7 +2,7 @@
"name": "broken-if-unconfigured",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "needs-config.js"

View File

@ -2,7 +2,7 @@
"name": "minimal-working-manifest",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "controller.js"

View File

@ -2,7 +2,7 @@
"name": "itzpapalotl",
"version": "0.0.6",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"author": "jsteemann",
"description": "random aztec god service",

View File

@ -2,7 +2,7 @@
"name": "malformed-controller-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "broken-controller.js"

View File

@ -2,7 +2,7 @@
"name": "malformed-controller-name",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"?": "controller.js"

View File

@ -2,7 +2,7 @@
"name": "malformed-controller-path",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "/illegal/file/name/"

View File

@ -2,7 +2,7 @@
"name": "malformed-exports-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"exports": {
"broken": "broken-exports.js"

View File

@ -2,7 +2,7 @@
"name": "malformed-exports-path",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"exports": {
"broken": "/illegal/file/name/"

View File

@ -2,7 +2,7 @@
"name": "minimal-working-manifest",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"scripts": {
"setup": "setup.js",

View File

@ -2,7 +2,7 @@
"name": "missing-controller-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"controllers": {
"/": "does-not-exist.js"

View File

@ -2,7 +2,7 @@
"name": "missing-exports-file",
"version": "0.0.0",
"engines": {
"arangodb": "^2.8.0"
"arangodb": "^3.0.0"
},
"exports": {
"nope": "no-such-file.js"