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
-----
* added --cluster.system-replication-factor in order to adjust the
replication factor for new system collections
* fixed issue #2012
* added a memory expection in case V8 memory gets too low

View File

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

View File

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

View File

@ -478,10 +478,10 @@ function analyzeServerCrash (arangod, options, checkStr) {
var cpf = "/proc/sys/kernel/core_pattern";
if (fs.isFile(cpf)) {
var matchApport=/.*apport.*/
var matchVarTmp=/\/var\/tmp/
var matchApport = /.*apport.*/;
var matchVarTmp = /\/var\/tmp/;
var corePattern = fs.readBuffer(cpf);
var cp = corePattern.asciiSlice(0, corePattern.length)
var cp = corePattern.asciiSlice(0, corePattern.length);
if (matchApport.exec(cp) != null) {
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 pathRegex = /^((\.{0,2}(\/|\\))|(~\/)|[a-zA-Z]:\\)/;
const DEFAULT_REPLICATION_FACTOR_SYSTEM = internal.DEFAULT_REPLICATION_FACTOR_SYSTEM;
var getReadableName = function (name) {
return name.split(/([-_]|\s)+/).map(function (token) {
return token.slice(0, 1).toUpperCase() + token.slice(1);
@ -53,7 +55,7 @@ var getReadableName = function (name) {
var getStorage = function () {
var c = db._collection('_apps');
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});
c.ensureIndex({ type: 'hash', fields: [ 'mount' ], unique: true });
}

View File

@ -346,4 +346,13 @@
exports.sendChunk = 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
// //////////////////////////////////////////////////////////////////////////////
var internal = require('internal');
var cluster = require('@arangodb/cluster');
var db = internal.db;
const internal = require('internal');
const cluster = require('@arangodb/cluster');
const db = internal.db;
const DEFAULT_REPLICATION_FACTOR_SYSTEM = internal.DEFAULT_REPLICATION_FACTOR_SYSTEM;
// //////////////////////////////////////////////////////////////////////////////
// / @brief initialized
@ -51,7 +52,7 @@ function createStatisticsCollection (name) {
try {
r = db._create(name, { isSystem: true, waitForSync: false,
replicationFactor: 2,
replicationFactor: DEFAULT_REPLICATION_FACTOR_SYSTEM,
journalSize: 8 * 1024 * 1024,
distributeShardsLike: '_graphs' });
} catch (err) {}

View File

@ -48,7 +48,7 @@
function upgrade () {
// 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
const DATABASE_SYSTEM = 1000;