1
0
Fork 0

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

This commit is contained in:
Wilfried Goesgens 2016-09-01 16:42:59 +02:00
commit d79e23de97
8 changed files with 78 additions and 51 deletions

View File

@ -1,6 +1,9 @@
devel devel
----- -----
* added --cluster.system-replication-factor in order to adjust the
replication factor for new system collections
* fixed issue #2012 * fixed issue #2012
* added a memory expection in case V8 memory gets too low * added a memory expection in case V8 memory gets too low

View File

@ -38,6 +38,7 @@
#include "ProgramOptions/Section.h" #include "ProgramOptions/Section.h"
#include "RestServer/DatabaseServerFeature.h" #include "RestServer/DatabaseServerFeature.h"
#include "SimpleHttpClient/ConnectionManager.h" #include "SimpleHttpClient/ConnectionManager.h"
#include "V8Server/V8DealerFeature.h"
#include "VocBase/server.h" #include "VocBase/server.h"
using namespace arangodb; using namespace arangodb;
@ -126,6 +127,10 @@ void ClusterFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
options->addOption("--cluster.coordinator-config", options->addOption("--cluster.coordinator-config",
"path to the coordinator configuration", "path to the coordinator configuration",
new StringParameter(&_coordinatorConfig)); new StringParameter(&_coordinatorConfig));
options->addOption("--cluster.system-replication-factor",
"replication factor for system collections",
new UInt32Parameter(&_systemReplicationFactor));
} }
void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) { void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
@ -180,6 +185,12 @@ void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
FATAL_ERROR_EXIT(); FATAL_ERROR_EXIT();
} }
} }
// validate system-replication-factor
if (_systemReplicationFactor == 0) {
LOG(FATAL) << "system replication factor must be greater 0";
FATAL_ERROR_EXIT();
}
} }
void ClusterFeature::prepare() { void ClusterFeature::prepare() {
@ -190,6 +201,12 @@ void ClusterFeature::prepare() {
ServerState::instance()->setDBserverConfig(_dbserverConfig); ServerState::instance()->setDBserverConfig(_dbserverConfig);
ServerState::instance()->setCoordinatorConfig(_coordinatorConfig); ServerState::instance()->setCoordinatorConfig(_coordinatorConfig);
V8DealerFeature* v8Dealer =
ApplicationServer::getFeature<V8DealerFeature>("V8Dealer");
v8Dealer->defineDouble("SYS_DEFAULT_REPLICATION_FACTOR_SYSTEM",
_systemReplicationFactor);
// create callback registery // create callback registery
_agencyCallbackRegistry.reset( _agencyCallbackRegistry.reset(
new AgencyCallbackRegistry(agencyCallbacksPath())); new AgencyCallbackRegistry(agencyCallbacksPath()));
@ -204,7 +221,8 @@ void ClusterFeature::prepare() {
ClusterComm::instance(); ClusterComm::instance();
AgencyFeature* agency = AgencyFeature* agency =
application_features::ApplicationServer::getFeature<AgencyFeature>("Agency"); application_features::ApplicationServer::getFeature<AgencyFeature>(
"Agency");
if (agency->isEnabled() || _enableCluster) { if (agency->isEnabled() || _enableCluster) {
// initialize ClusterComm library, must call initialize only once // initialize ClusterComm library, must call initialize only once
@ -335,12 +353,11 @@ void ClusterFeature::prepare() {
<< "' specified for --cluster.my-address"; << "' specified for --cluster.my-address";
FATAL_ERROR_EXIT(); FATAL_ERROR_EXIT();
} }
} }
//YYY #ifdef ARANGODB_ENABLE_MAINTAINER_MODE // YYY #ifdef ARANGODB_ENABLE_MAINTAINER_MODE
//YYY #warning FRANK split into methods // YYY #warning FRANK split into methods
//YYY #endif // YYY #endif
void ClusterFeature::start() { void ClusterFeature::start() {
// return if cluster is disabled // return if cluster is disabled
@ -371,21 +388,18 @@ void ClusterFeature::start() {
AgencyCommResult result = comm.getValues("Sync/HeartbeatIntervalMs"); AgencyCommResult result = comm.getValues("Sync/HeartbeatIntervalMs");
if (result.successful()) { if (result.successful()) {
velocypack::Slice HeartbeatIntervalMs = velocypack::Slice HeartbeatIntervalMs =
result.slice()[0].get(std::vector<std::string>( result.slice()[0].get(std::vector<std::string>(
{AgencyComm::prefix(), "Sync", "HeartbeatIntervalMs"})); {AgencyComm::prefix(), "Sync", "HeartbeatIntervalMs"}));
if (HeartbeatIntervalMs.isInteger()) { if (HeartbeatIntervalMs.isInteger()) {
try { try {
_heartbeatInterval = HeartbeatIntervalMs.getUInt(); _heartbeatInterval = HeartbeatIntervalMs.getUInt();
LOG(INFO) << "using heartbeat interval value '" << _heartbeatInterval LOG(INFO) << "using heartbeat interval value '" << _heartbeatInterval
<< " ms' from agency"; << " ms' from agency";
} } catch (...) {
catch (...) {
// Ignore if it is not a small int or uint // Ignore if it is not a small int or uint
} }
} }
} }
@ -417,7 +431,6 @@ void ClusterFeature::start() {
AgencyCommResult result; AgencyCommResult result;
while (true) { while (true) {
VPackBuilder builder; VPackBuilder builder;
try { try {
VPackObjectBuilder b(&builder); VPackObjectBuilder b(&builder);
@ -503,19 +516,17 @@ void ClusterFeature::unprepare() {
// Remove from role // Remove from role
if (role == ServerState::ROLE_PRIMARY) { if (role == ServerState::ROLE_PRIMARY) {
unreg.operations.push_back( unreg.operations.push_back(AgencyOperation(
AgencyOperation("Current/DBServers/" + _myId, "Current/DBServers/" + _myId, AgencySimpleOperationType::DELETE_OP));
AgencySimpleOperationType::DELETE_OP));
} else if (role == ServerState::ROLE_COORDINATOR) { } else if (role == ServerState::ROLE_COORDINATOR) {
unreg.operations.push_back( unreg.operations.push_back(AgencyOperation(
AgencyOperation("Current/Coordinators/" + _myId, "Current/Coordinators/" + _myId, AgencySimpleOperationType::DELETE_OP));
AgencySimpleOperationType::DELETE_OP));
} }
// Unregister // Unregister
unreg.operations.push_back( unreg.operations.push_back(
AgencyOperation("Current/ServersRegistered/" + _myId, AgencyOperation("Current/ServersRegistered/" + _myId,
AgencySimpleOperationType::DELETE_OP)); AgencySimpleOperationType::DELETE_OP));
comm.sendTransactionWithFailover(unreg, 120.0); comm.sendTransactionWithFailover(unreg, 120.0);

View File

@ -58,6 +58,7 @@ class ClusterFeature : public application_features::ApplicationFeature {
std::string _arangodPath; std::string _arangodPath;
std::string _dbserverConfig; std::string _dbserverConfig;
std::string _coordinatorConfig; std::string _coordinatorConfig;
uint32_t _systemReplicationFactor = 2;
public: public:
AgencyCallbackRegistry* agencyCallbackRegistry() const { AgencyCallbackRegistry* agencyCallbackRegistry() const {

View File

@ -478,10 +478,10 @@ function analyzeServerCrash (arangod, options, checkStr) {
var cpf = "/proc/sys/kernel/core_pattern"; var cpf = "/proc/sys/kernel/core_pattern";
if (fs.isFile(cpf)) { if (fs.isFile(cpf)) {
var matchApport=/.*apport.*/ var matchApport = /.*apport.*/;
var matchVarTmp=/\/var\/tmp/ var matchVarTmp = /\/var\/tmp/;
var corePattern = fs.readBuffer(cpf); var corePattern = fs.readBuffer(cpf);
var cp = corePattern.asciiSlice(0, corePattern.length) var cp = corePattern.asciiSlice(0, corePattern.length);
if (matchApport.exec(cp) != null) { if (matchApport.exec(cp) != null) {
print(RED + "apport handles corefiles on your system. Uninstall it if you want us to get corefiles for analysis."); print(RED + "apport handles corefiles on your system. Uninstall it if you want us to get corefiles for analysis.");

View File

@ -44,6 +44,8 @@ var mountAppRegEx = /\/APP(\/|$)/i;
var mountNumberRegEx = /^\/[\d\-%]/; var mountNumberRegEx = /^\/[\d\-%]/;
var pathRegex = /^((\.{0,2}(\/|\\))|(~\/)|[a-zA-Z]:\\)/; var pathRegex = /^((\.{0,2}(\/|\\))|(~\/)|[a-zA-Z]:\\)/;
const DEFAULT_REPLICATION_FACTOR_SYSTEM = internal.DEFAULT_REPLICATION_FACTOR_SYSTEM;
var getReadableName = function (name) { var getReadableName = function (name) {
return name.split(/([-_]|\s)+/).map(function (token) { return name.split(/([-_]|\s)+/).map(function (token) {
return token.slice(0, 1).toUpperCase() + token.slice(1); return token.slice(0, 1).toUpperCase() + token.slice(1);
@ -53,7 +55,7 @@ var getReadableName = function (name) {
var getStorage = function () { var getStorage = function () {
var c = db._collection('_apps'); var c = db._collection('_apps');
if (c === null) { if (c === null) {
c = db._create('_apps', {isSystem: true, replicationFactor: 2, c = db._create('_apps', {isSystem: true, replicationFactor: DEFAULT_REPLICATION_FACTOR_SYSTEM,
distributeShardsLike: '_graphs', journalSize: 4 * 1024 * 1024}); distributeShardsLike: '_graphs', journalSize: 4 * 1024 * 1024});
c.ensureIndex({ type: 'hash', fields: [ 'mount' ], unique: true }); c.ensureIndex({ type: 'hash', fields: [ 'mount' ], unique: true });
} }

View File

@ -346,4 +346,13 @@
exports.sendChunk = global.SYS_SEND_CHUNK; exports.sendChunk = global.SYS_SEND_CHUNK;
delete global.SYS_SEND_CHUNK; delete global.SYS_SEND_CHUNK;
} }
// //////////////////////////////////////////////////////////////////////////////
// / @brief default replication factor
// //////////////////////////////////////////////////////////////////////////////
if (global.SYS_DEFAULT_REPLICATION_FACTOR_SYSTEM) {
exports.DEFAULT_REPLICATION_FACTOR_SYSTEM = global.SYS_DEFAULT_REPLICATION_FACTOR_SYSTEM;
delete global.SYS_DEFAULT_REPLICATION_FACTOR_SYSTEM;
}
}()); }());

View File

@ -27,9 +27,10 @@
// / @author Copyright 2014, triAGENS GmbH, Cologne, Germany // / @author Copyright 2014, triAGENS GmbH, Cologne, Germany
// ////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////
var internal = require('internal'); const internal = require('internal');
var cluster = require('@arangodb/cluster'); const cluster = require('@arangodb/cluster');
var db = internal.db; const db = internal.db;
const DEFAULT_REPLICATION_FACTOR_SYSTEM = internal.DEFAULT_REPLICATION_FACTOR_SYSTEM;
// ////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////
// / @brief initialized // / @brief initialized
@ -51,7 +52,7 @@ function createStatisticsCollection (name) {
try { try {
r = db._create(name, { isSystem: true, waitForSync: false, r = db._create(name, { isSystem: true, waitForSync: false,
replicationFactor: 2, replicationFactor: DEFAULT_REPLICATION_FACTOR_SYSTEM,
journalSize: 8 * 1024 * 1024, journalSize: 8 * 1024 * 1024,
distributeShardsLike: '_graphs' }); distributeShardsLike: '_graphs' });
} catch (err) {} } catch (err) {}

View File

@ -48,7 +48,7 @@
function upgrade () { function upgrade () {
// default replication factor for system collections // default replication factor for system collections
const DEFAULT_REPLICATION_FACTOR_SYSTEM = 2; const DEFAULT_REPLICATION_FACTOR_SYSTEM = internal.DEFAULT_REPLICATION_FACTOR_SYSTEM;
// system database only // system database only
const DATABASE_SYSTEM = 1000; const DATABASE_SYSTEM = 1000;