mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
40e1f9991d
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
test -d logs || mkdir logs
|
||||||
|
|
||||||
|
rspec --color --format d \
|
||||||
|
api-replication-spec.rb
|
|
@ -560,9 +560,9 @@ unittests-import:
|
||||||
### starts two servers (master & slave) and checks for data drift
|
### starts two servers (master & slave) and checks for data drift
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
.PHONY: unittests-replication unittests-replication-data unittests-replication-logger
|
.PHONY: unittests-replication unittests-replication-common unittests-replication-http unittests-replication-data unittests-replication-logger
|
||||||
|
|
||||||
unittests-replication: unittests-replication-common unittests-replication-data unittests-replication-logger
|
unittests-replication: unittests-replication-common unittests-replication-data unittests-replication-http unittests-replication-logger
|
||||||
|
|
||||||
unittests-replication-common:
|
unittests-replication-common:
|
||||||
@echo
|
@echo
|
||||||
|
@ -579,6 +579,25 @@ unittests-replication-common:
|
||||||
@rm -rf "$(VOCDIR)"
|
@rm -rf "$(VOCDIR)"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
unittests-replication-http:
|
||||||
|
$(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint tcp://$(VOCHOST):$(VOCPORT) --server.disable-authentication true" PROTO=http
|
||||||
|
|
||||||
|
@echo
|
||||||
|
@echo "================================================================================"
|
||||||
|
@echo "<< REPLICATION SERVER TESTS >>"
|
||||||
|
@echo "================================================================================"
|
||||||
|
@echo
|
||||||
|
|
||||||
|
cd @top_srcdir@/UnitTests/HttpInterface && ARANGO_SERVER="$(VOCHOST):$(VOCPORT)" ARANGO_SSL=0 ARANGO_USER="$(USERNAME)" ARANGO_PASSWORD="$(PASSWORD)" ./run-tests-replication || test "x$(FORCE)" == "x1"
|
||||||
|
|
||||||
|
kill `cat $(PIDFILE)`
|
||||||
|
|
||||||
|
while test -f $(PIDFILE); do sleep 1; done
|
||||||
|
@if [ "$(VALGRIND)" != "" ]; then sleep 60; fi
|
||||||
|
|
||||||
|
@rm -rf "$(VOCDIR)"
|
||||||
|
@echo
|
||||||
|
|
||||||
unittests-replication-data:
|
unittests-replication-data:
|
||||||
$(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint tcp://$(VOCHOST):$(VOCPORT) --server.disable-authentication true" PROTO=http
|
$(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint tcp://$(VOCHOST):$(VOCPORT) --server.disable-authentication true" PROTO=http
|
||||||
$(MAKE) start-slave PID=$(PID) SERVER_START="--server.endpoint tcp://$(SLAVEHOST):$(SLAVEPORT) --server.disable-authentication true" PROTO=http
|
$(MAKE) start-slave PID=$(PID) SERVER_START="--server.endpoint tcp://$(SLAVEHOST):$(SLAVEPORT) --server.disable-authentication true" PROTO=http
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
#include "V8/v8-utils.h"
|
#include "V8/v8-utils.h"
|
||||||
#include "V8Server/ApplicationV8.h"
|
#include "V8Server/ApplicationV8.h"
|
||||||
#include "VocBase/auth.h"
|
#include "VocBase/auth.h"
|
||||||
|
#include "VocBase/replication-common.h"
|
||||||
|
|
||||||
#include "RestServer/VocbaseManager.h"
|
#include "RestServer/VocbaseManager.h"
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
||||||
_removeOnDrop(true),
|
_removeOnDrop(true),
|
||||||
_replicationEnableLogger(false),
|
_replicationEnableLogger(false),
|
||||||
_replicationLogRemoteChanges(false),
|
_replicationLogRemoteChanges(false),
|
||||||
_replicationMaxEvents(1048576),
|
_replicationMaxEvents(TRI_REPLICATION_LOGGER_EVENTS_DEFAULT),
|
||||||
_replicationMaxEventsSize(0),
|
_replicationMaxEventsSize(0),
|
||||||
_vocbase(0) {
|
_vocbase(0) {
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,12 @@ extern "C" {
|
||||||
|
|
||||||
#define TRI_REPLICATION_LOGGER_EVENTS_MIN 4096
|
#define TRI_REPLICATION_LOGGER_EVENTS_MIN 4096
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief default number of log events to keep
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_REPLICATION_LOGGER_EVENTS_DEFAULT 1048576
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief minimum cumulated size of log events to keep (lower bound for logger
|
/// @brief minimum cumulated size of log events to keep (lower bound for logger
|
||||||
/// config)
|
/// config)
|
||||||
|
|
|
@ -265,9 +265,14 @@ static TRI_replication_operation_e TranslateDocumentOperation (TRI_voc_document_
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void FreeCap (TRI_replication_logger_t* logger) {
|
static void FreeCap (TRI_replication_logger_t* logger) {
|
||||||
|
assert(logger != NULL);
|
||||||
|
|
||||||
if (logger->_cap != NULL) {
|
if (logger->_cap != NULL) {
|
||||||
TRI_primary_collection_t* primary;
|
TRI_primary_collection_t* primary;
|
||||||
|
|
||||||
|
assert(logger->_trxCollection != NULL);
|
||||||
|
assert(logger->_trxCollection->_collection != NULL);
|
||||||
|
|
||||||
primary = logger->_trxCollection->_collection->_collection;
|
primary = logger->_trxCollection->_collection->_collection;
|
||||||
assert(primary != NULL);
|
assert(primary != NULL);
|
||||||
|
|
||||||
|
@ -276,8 +281,6 @@ static void FreeCap (TRI_replication_logger_t* logger) {
|
||||||
TRI_GetServerId());
|
TRI_GetServerId());
|
||||||
|
|
||||||
logger->_cap = NULL;
|
logger->_cap = NULL;
|
||||||
logger->_configuration._maxEvents = 0;
|
|
||||||
logger->_configuration._maxEventsSize = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,22 +1012,22 @@ static int StopReplicationLogger (TRI_replication_logger_t* logger) {
|
||||||
|
|
||||||
res = LogEvent(logger, 0, true, REPLICATION_STOP, buffer);
|
res = LogEvent(logger, 0, true, REPLICATION_STOP, buffer);
|
||||||
|
|
||||||
|
// destroy cap constraint
|
||||||
|
FreeCap(logger);
|
||||||
|
|
||||||
TRI_CommitTransaction(logger->_trx, 0);
|
TRI_CommitTransaction(logger->_trx, 0);
|
||||||
|
|
||||||
TRI_FreeTransaction(logger->_trx);
|
TRI_FreeTransaction(logger->_trx);
|
||||||
|
|
||||||
LOG_INFO("stopped replication logger for database '%s', last tick: %llu",
|
LOG_INFO("stopped replication logger for database '%s', last tick: %llu",
|
||||||
logger->_databaseName,
|
logger->_databaseName,
|
||||||
(unsigned long long) lastTick);
|
(unsigned long long) lastTick);
|
||||||
|
|
||||||
|
|
||||||
logger->_trx = NULL;
|
logger->_trx = NULL;
|
||||||
logger->_trxCollection = NULL;
|
logger->_trxCollection = NULL;
|
||||||
logger->_state._lastLogTick = 0;
|
logger->_state._lastLogTick = 0;
|
||||||
logger->_state._active = false;
|
logger->_state._active = false;
|
||||||
|
|
||||||
// destroy cap constraint
|
|
||||||
FreeCap(logger);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2293,7 +2293,7 @@ function ReplicationApplierSuite () {
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
assertEqual(errors.ERROR_REPLICATION_INVALID_CONFIGURATION.code, err.errorNum);
|
assertEqual(errors.ERROR_REPLICATION_INVALID_APPLIER_CONFIGURATION.code, err.errorNum);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2373,7 +2373,7 @@ function ReplicationApplierSuite () {
|
||||||
replication.applier.properties({ });
|
replication.applier.properties({ });
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
assertEqual(errors.ERROR_REPLICATION_INVALID_CONFIGURATION.code, err.errorNum);
|
assertEqual(errors.ERROR_REPLICATION_INVALID_APPLIER_CONFIGURATION.code, err.errorNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
replication.applier.properties({
|
replication.applier.properties({
|
||||||
|
|
Loading…
Reference in New Issue