mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'spdvpk' of github.com:arangodb/arangodb into spdvpk
This commit is contained in:
commit
91c98d479d
|
@ -195,8 +195,7 @@ bool Agent::recvAppendEntriesRPC (term_t term, id_t leaderId, index_t prevIndex,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
append_entries_t Agent::sendAppendEntriesRPC (
|
append_entries_t Agent::sendAppendEntriesRPC (id_t slave_id) {
|
||||||
id_t slave_id/*, collect_ret_t const& entries*/) {
|
|
||||||
|
|
||||||
index_t last_confirmed = _confirmed[slave_id];
|
index_t last_confirmed = _confirmed[slave_id];
|
||||||
std::vector<log_t> unconfirmed = _state.get(last_confirmed);
|
std::vector<log_t> unconfirmed = _state.get(last_confirmed);
|
||||||
|
@ -224,6 +223,9 @@ append_entries_t Agent::sendAppendEntriesRPC (
|
||||||
}
|
}
|
||||||
builder.close();
|
builder.close();
|
||||||
|
|
||||||
|
LOG_TOPIC(WARN,Logger::AGENCY) << _config.end_points[slave_id] << path.str();
|
||||||
|
LOG_TOPIC(WARN,Logger::AGENCY) << builder.slice().toJson();
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
if (unconfirmed.size() > 1) {
|
if (unconfirmed.size() > 1) {
|
||||||
LOG_TOPIC(INFO, Logger::AGENCY) << "Appending " << unconfirmed.size() << " entries up to index "
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Appending " << unconfirmed.size() << " entries up to index "
|
||||||
|
|
|
@ -36,7 +36,7 @@ using namespace arangodb::rest;
|
||||||
|
|
||||||
ApplicationAgency::ApplicationAgency()
|
ApplicationAgency::ApplicationAgency()
|
||||||
: ApplicationFeature("agency"), _size(1), _min_election_timeout(0.1),
|
: ApplicationFeature("agency"), _size(1), _min_election_timeout(0.1),
|
||||||
_max_election_timeout(1.0), _election_call_rate_mul(0.85),
|
_max_election_timeout(1.0), _election_call_rate_mul(0.85), _notify(false),
|
||||||
_agent_id(std::numeric_limits<uint32_t>::max()) {
|
_agent_id(std::numeric_limits<uint32_t>::max()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ bool ApplicationAgency::prepare() {
|
||||||
|
|
||||||
|
|
||||||
if (_size % 2 == 0) {
|
if (_size % 2 == 0) {
|
||||||
LOG_TOPIC(ERR, Logger::AGENCY) << "AGENCY: agency must have odd number of members";
|
LOG_TOPIC(ERR, Logger::AGENCY)
|
||||||
|
<< "AGENCY: agency must have odd number of members";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,20 +90,24 @@ bool ApplicationAgency::prepare() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_min_election_timeout <= 0.) {
|
if (_min_election_timeout <= 0.) {
|
||||||
LOG_TOPIC(ERR, Logger::AGENCY) << "agency.election-timeout-min must not be negative!";
|
LOG_TOPIC(ERR, Logger::AGENCY)
|
||||||
|
<< "agency.election-timeout-min must not be negative!";
|
||||||
return false;
|
return false;
|
||||||
} else if (_min_election_timeout < .15) {
|
} else if (_min_election_timeout < .15) {
|
||||||
LOG(WARN) << "very short agency.election-timeout-min!";
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
|
<< "very short agency.election-timeout-min!";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_max_election_timeout <= _min_election_timeout) {
|
if (_max_election_timeout <= _min_election_timeout) {
|
||||||
LOG_TOPIC(ERR, Logger::AGENCY) << "agency.election-timeout-max must not be shorter than or"
|
LOG_TOPIC(ERR, Logger::AGENCY)
|
||||||
<< "equal to agency.election-timeout-min.";
|
<< "agency.election-timeout-max must not be shorter than or"
|
||||||
|
<< "equal to agency.election-timeout-min.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_max_election_timeout <= 2*_min_election_timeout) {
|
if (_max_election_timeout <= 2*_min_election_timeout) {
|
||||||
LOG_TOPIC(WARN, Logger::AGENCY) << "agency.election-timeout-max should probably be chosen longer!";
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
|
<< "agency.election-timeout-max should probably be chosen longer!";
|
||||||
}
|
}
|
||||||
|
|
||||||
_agency_endpoints.resize(_size);
|
_agency_endpoints.resize(_size);
|
||||||
|
@ -121,7 +126,6 @@ bool ApplicationAgency::start() {
|
||||||
if (_disabled) {
|
if (_disabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_agent->start();
|
_agent->start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1640,7 +1640,7 @@ int InitialSyncer::handleCollection(VPackSlice const& parameters,
|
||||||
return TRI_ERROR_REPLICATION_APPLIER_STOPPED;
|
return TRI_ERROR_REPLICATION_APPLIER_STOPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parameters.isObject() || !indexes.isObject()) {
|
if (!parameters.isObject() || !indexes.isArray()) {
|
||||||
return TRI_ERROR_REPLICATION_INVALID_RESPONSE;
|
return TRI_ERROR_REPLICATION_INVALID_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ExplicitTransaction : public Transaction {
|
||||||
ExplicitTransaction(std::shared_ptr<V8TransactionContext> transactionContext,
|
ExplicitTransaction(std::shared_ptr<V8TransactionContext> transactionContext,
|
||||||
std::vector<std::string> const& readCollections,
|
std::vector<std::string> const& readCollections,
|
||||||
std::vector<std::string> const& writeCollections,
|
std::vector<std::string> const& writeCollections,
|
||||||
double lockTimeout, bool waitForSync, bool embed,
|
double lockTimeout, bool waitForSync,
|
||||||
bool allowImplicitCollections)
|
bool allowImplicitCollections)
|
||||||
: Transaction(transactionContext, 0) {
|
: Transaction(transactionContext, 0) {
|
||||||
this->addHint(TRI_TRANSACTION_HINT_LOCK_ENTIRELY, false);
|
this->addHint(TRI_TRANSACTION_HINT_LOCK_ENTIRELY, false);
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#ifndef ARANGOD_V8_SERVER_V8_TRAVERSER_H
|
#ifndef ARANGOD_V8_SERVER_V8_TRAVERSER_H
|
||||||
#define ARANGOD_V8_SERVER_V8_TRAVERSER_H 1
|
#define ARANGOD_V8_SERVER_V8_TRAVERSER_H 1
|
||||||
|
|
||||||
#include "Utils/ExplicitTransaction.h"
|
|
||||||
#include "VocBase/ExampleMatcher.h"
|
#include "VocBase/ExampleMatcher.h"
|
||||||
#include "VocBase/Traverser.h"
|
#include "VocBase/Traverser.h"
|
||||||
|
|
||||||
|
|
|
@ -28,21 +28,20 @@
|
||||||
#include "Aql/QueryList.h"
|
#include "Aql/QueryList.h"
|
||||||
#include "Aql/QueryRegistry.h"
|
#include "Aql/QueryRegistry.h"
|
||||||
#include "Basics/conversions.h"
|
#include "Basics/conversions.h"
|
||||||
#include "Basics/json-utilities.h"
|
|
||||||
#include "Basics/MutexLocker.h"
|
#include "Basics/MutexLocker.h"
|
||||||
#include "Basics/ScopeGuard.h"
|
#include "Basics/ScopeGuard.h"
|
||||||
#include "Basics/tri-strings.h"
|
#include "Basics/tri-strings.h"
|
||||||
#include "Basics/Utf8Helper.h"
|
#include "Basics/Utf8Helper.h"
|
||||||
#include "Cluster/AgencyComm.h"
|
|
||||||
#include "Cluster/ClusterComm.h"
|
#include "Cluster/ClusterComm.h"
|
||||||
#include "Cluster/ClusterInfo.h"
|
#include "Cluster/ClusterInfo.h"
|
||||||
#include "Cluster/ClusterMethods.h"
|
#include "Cluster/ClusterMethods.h"
|
||||||
#include "Cluster/ServerState.h"
|
#include "Cluster/ServerState.h"
|
||||||
#include "Indexes/Index.h"
|
|
||||||
#include "HttpServer/ApplicationEndpointServer.h"
|
#include "HttpServer/ApplicationEndpointServer.h"
|
||||||
#include "RestServer/ConsoleThread.h"
|
#include "RestServer/ConsoleThread.h"
|
||||||
#include "RestServer/VocbaseContext.h"
|
#include "RestServer/VocbaseContext.h"
|
||||||
#include "Rest/Version.h"
|
#include "Rest/Version.h"
|
||||||
|
#include "Utils/ExplicitTransaction.h"
|
||||||
|
#include "Utils/V8TransactionContext.h"
|
||||||
#include "V8/JSLoader.h"
|
#include "V8/JSLoader.h"
|
||||||
#include "V8/v8-conv.h"
|
#include "V8/v8-conv.h"
|
||||||
#include "V8/v8-utils.h"
|
#include "V8/v8-utils.h"
|
||||||
|
@ -339,11 +338,11 @@ static void JS_Transaction(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||||
TRI_V8_THROW_EXCEPTION_PARAMETER(actionError);
|
TRI_V8_THROW_EXCEPTION_PARAMETER(actionError);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto transactionContext = std::make_shared<V8TransactionContext>(vocbase, false);
|
auto transactionContext = std::make_shared<V8TransactionContext>(vocbase, embed);
|
||||||
|
|
||||||
// start actual transaction
|
// start actual transaction
|
||||||
ExplicitTransaction trx(transactionContext, readCollections, writeCollections,
|
ExplicitTransaction trx(transactionContext, readCollections, writeCollections,
|
||||||
lockTimeout, waitForSync, embed,
|
lockTimeout, waitForSync,
|
||||||
allowImplicitCollections);
|
allowImplicitCollections);
|
||||||
|
|
||||||
int res = trx.begin();
|
int res = trx.begin();
|
||||||
|
@ -1756,13 +1755,12 @@ static ExplicitTransaction* BeginTransaction(
|
||||||
// IHHF isCoordinator
|
// IHHF isCoordinator
|
||||||
double lockTimeout =
|
double lockTimeout =
|
||||||
(double)(TRI_TRANSACTION_DEFAULT_LOCK_TIMEOUT / 1000000ULL);
|
(double)(TRI_TRANSACTION_DEFAULT_LOCK_TIMEOUT / 1000000ULL);
|
||||||
bool embed = true;
|
|
||||||
bool waitForSync = false;
|
bool waitForSync = false;
|
||||||
|
|
||||||
// Start Transaction to collect all parts of the path
|
// Start Transaction to collect all parts of the path
|
||||||
auto trx = std::make_unique<ExplicitTransaction>(
|
auto trx = std::make_unique<ExplicitTransaction>(
|
||||||
transactionContext, readCollections, writeCollections, lockTimeout, waitForSync,
|
transactionContext, readCollections, writeCollections, lockTimeout, waitForSync,
|
||||||
embed, true);
|
true);
|
||||||
|
|
||||||
int res = trx->begin();
|
int res = trx->begin();
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
|
|
@ -611,16 +611,12 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
return std::string("/_api/edge?collection=" + ARANGOB->collection() +
|
return std::string("/_api/document?collection=" + ARANGOB->collection());
|
||||||
"&from=" + ARANGOB->collection() + "%2Ftestfrom" +
|
|
||||||
StringUtils::itoa(globalCounter) + "&to=" +
|
|
||||||
ARANGOB->collection() + "%2Ftestto" +
|
|
||||||
StringUtils::itoa(globalCounter));
|
|
||||||
} else {
|
} else {
|
||||||
size_t keyId = (size_t)(globalCounter / 4);
|
size_t keyId = (size_t)(globalCounter / 4);
|
||||||
std::string const key = "testkey" + StringUtils::itoa(keyId);
|
std::string const key = "testkey" + StringUtils::itoa(keyId);
|
||||||
|
|
||||||
return std::string("/_api/edge/" + ARANGOB->collection() + "/" + key);
|
return std::string("/_api/document/" + ARANGOB->collection() + "/" + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,6 +662,19 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
||||||
TRI_AppendStringStringBuffer(buffer, key.c_str());
|
TRI_AppendStringStringBuffer(buffer, key.c_str());
|
||||||
TRI_AppendStringStringBuffer(buffer, "\"");
|
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||||
|
|
||||||
|
if (mod == 0) {
|
||||||
|
// append edge information
|
||||||
|
TRI_AppendStringStringBuffer(buffer, ",\"_from\":\"");
|
||||||
|
TRI_AppendStringStringBuffer(buffer, ARANGOB->collection().c_str());
|
||||||
|
TRI_AppendStringStringBuffer(buffer, "/testfrom");
|
||||||
|
TRI_AppendUInt64StringBuffer(buffer, globalCounter);
|
||||||
|
TRI_AppendStringStringBuffer(buffer, "\",\"_to\":\"");
|
||||||
|
TRI_AppendStringStringBuffer(buffer, ARANGOB->collection().c_str());
|
||||||
|
TRI_AppendStringStringBuffer(buffer, "/testto");
|
||||||
|
TRI_AppendUInt64StringBuffer(buffer, globalCounter);
|
||||||
|
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||||
|
}
|
||||||
|
|
||||||
for (uint64_t i = 1; i <= n; ++i) {
|
for (uint64_t i = 1; i <= n; ++i) {
|
||||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||||
TRI_AppendUInt64StringBuffer(buffer, i);
|
TRI_AppendUInt64StringBuffer(buffer, i);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*jshint globalstrict:false, strict:false */
|
/*jshint globalstrict:false, strict:false */
|
||||||
/*global assertEqual, assertTypeOf, assertNotEqual, assertTrue, assertFalse, assertNull, assertUndefined, fail */
|
/*global assertEqual, assertTypeOf, assertNotEqual, assertTrue, assertFalse, assertUndefined, fail */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test the collection interface
|
/// @brief test the collection interface
|
||||||
|
@ -36,7 +36,6 @@ var internal = require("internal");
|
||||||
var ArangoCollection = arangodb.ArangoCollection;
|
var ArangoCollection = arangodb.ArangoCollection;
|
||||||
var db = arangodb.db;
|
var db = arangodb.db;
|
||||||
var ERRORS = arangodb.errors;
|
var ERRORS = arangodb.errors;
|
||||||
var testHelper = require("@arangodb/test-helper").Helper;
|
|
||||||
|
|
||||||
var compareStringIds = function (l, r) {
|
var compareStringIds = function (l, r) {
|
||||||
var i;
|
var i;
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
|
|
||||||
var jsunity = require("jsunity");
|
var jsunity = require("jsunity");
|
||||||
var internal = require("internal");
|
var internal = require("internal");
|
||||||
var errors = internal.errors;
|
|
||||||
var testHelper = require("@arangodb/test-helper").Helper;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test suite: Creation
|
/// @brief test suite: Creation
|
||||||
|
@ -42,22 +40,6 @@ function HashIndexSuite() {
|
||||||
var cn = "UnitTestsCollectionHash";
|
var cn = "UnitTestsCollectionHash";
|
||||||
var collection = null;
|
var collection = null;
|
||||||
|
|
||||||
var sorter = function (l, r) {
|
|
||||||
var i;
|
|
||||||
if (l.length !== r.length) {
|
|
||||||
return l.length - r.length < 0 ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// length is equal
|
|
||||||
for (i = 0; i < l.length; ++i) {
|
|
||||||
if (l[i] !== r[i]) {
|
|
||||||
return l[i] < r[i] ? -1 : 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*jshint globalstrict:false, strict:false */
|
/*jshint globalstrict:false, strict:false */
|
||||||
/*global fail, assertEqual, assertNotNull, assertNull, assertTrue, assertMatch,
|
/*global assertEqual, assertNotNull, assertNull, assertTrue, assertMatch,
|
||||||
assertFalse */
|
assertFalse */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -2099,7 +2099,6 @@ function SimpleQuerySparseRangeSuite () {
|
||||||
var collection = null;
|
var collection = null;
|
||||||
var age = function(d) { return d.age; };
|
var age = function(d) { return d.age; };
|
||||||
var ageSort = function(l, r) { if (l !== r) { if (l < r) { return -1; } return 1; } return 0; };
|
var ageSort = function(l, r) { if (l !== r) { if (l < r) { return -1; } return 1; } return 0; };
|
||||||
var errors = require("@arangodb").errors;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
@ -2235,7 +2234,6 @@ function SimpleQueryUniqueSparseRangeSuite () {
|
||||||
var collection = null;
|
var collection = null;
|
||||||
var age = function(d) { return d.age; };
|
var age = function(d) { return d.age; };
|
||||||
var ageSort = function(l, r) { if (l !== r) { if (l < r) { return -1; } return 1; } return 0; };
|
var ageSort = function(l, r) { if (l !== r) { if (l < r) { return -1; } return 1; } return 0; };
|
||||||
var errors = require("@arangodb").errors;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue