mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
1fd155edc4
|
@ -855,6 +855,7 @@ unittests-arangob:
|
|||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 500 --concurrency 3 --test aqltrx --complexity 1 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --concurrency 3 --test counttrx || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 500 --concurrency 3 --test multitrx || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 500 --concurrency 3 --test import-document --complexity 500 || test "x$(FORCE)" == "x1"
|
||||
|
||||
|
||||
kill `cat $(PIDFILE)`
|
||||
|
|
|
@ -761,6 +761,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int ArangoServer::startupServer () {
|
||||
OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions());
|
||||
|
||||
// .............................................................................
|
||||
// prepare the various parts of the Arango server
|
||||
|
@ -783,8 +784,21 @@ int ArangoServer::startupServer () {
|
|||
assert(vocbase != 0);
|
||||
|
||||
// initialise V8
|
||||
size_t concurrency = _dispatcherThreads;
|
||||
|
||||
if (mode == OperationMode::MODE_CONSOLE) {
|
||||
// one V8 instance is taken by the console
|
||||
++concurrency;
|
||||
}
|
||||
else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) {
|
||||
if (concurrency == 1) {
|
||||
// at least two to allow the test-runner and the scheduler to use a V8
|
||||
concurrency = 2;
|
||||
}
|
||||
}
|
||||
|
||||
_applicationV8->setVocbase(vocbase);
|
||||
_applicationV8->setConcurrency(_dispatcherThreads);
|
||||
_applicationV8->setConcurrency(concurrency);
|
||||
|
||||
if (_applicationServer->programOptions().has("upgrade")) {
|
||||
_applicationV8->performUpgrade();
|
||||
|
@ -855,8 +869,6 @@ int ArangoServer::startupServer () {
|
|||
|
||||
LOG_INFO("ArangoDB (version " TRI_VERSION_FULL ") is ready for business. Have fun!");
|
||||
|
||||
OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions());
|
||||
|
||||
int res;
|
||||
|
||||
if (mode == OperationMode::MODE_CONSOLE) {
|
||||
|
|
|
@ -90,19 +90,20 @@ void ConsoleThread::run () {
|
|||
|
||||
try {
|
||||
inner();
|
||||
_applicationV8->exitContext(_context);
|
||||
_done = 1;
|
||||
}
|
||||
catch (const char*) {
|
||||
_applicationV8->exitContext(_context);
|
||||
_done = 1;
|
||||
}
|
||||
catch (...) {
|
||||
_applicationV8->exitContext(_context);
|
||||
_done = 1;
|
||||
_applicationServer->beginShutdown();
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
_applicationV8->exitContext(_context);
|
||||
_done = 1;
|
||||
_applicationServer->beginShutdown();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -156,7 +157,6 @@ void ConsoleThread::inner () {
|
|||
|
||||
if (input == 0) {
|
||||
_userAborted = true;
|
||||
_applicationServer->beginShutdown();
|
||||
|
||||
// this will be caught by "run"
|
||||
throw "user aborted";
|
||||
|
|
|
@ -96,7 +96,6 @@ namespace triagens {
|
|||
|
||||
void userAbort () {
|
||||
_userAborted = true;
|
||||
TRI_CLOSE(0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -746,6 +746,25 @@ bool ApplicationV8::start () {
|
|||
void ApplicationV8::close () {
|
||||
_stopping = 1;
|
||||
_contextCondition.broadcast();
|
||||
|
||||
// unregister all tasks
|
||||
if (_scheduler != nullptr) {
|
||||
_scheduler->scheduler()->unregisterUserTasks();
|
||||
}
|
||||
|
||||
// wait for all contexts to finish
|
||||
for (size_t n = 0; n < 10 * 5; ++n) {
|
||||
CONDITION_LOCKER(guard, _contextCondition);
|
||||
|
||||
if (_busyContexts.empty()) {
|
||||
LOG_DEBUG("no busy V8 contexts");
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_DEBUG("waiting for %d busy V8 contexts to finish", (int) _busyContexts.size());
|
||||
|
||||
guard.wait(100000);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -753,9 +772,26 @@ void ApplicationV8::close () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ApplicationV8::stop () {
|
||||
// unregister all tasks
|
||||
if (_scheduler != nullptr) {
|
||||
_scheduler->scheduler()->unregisterUserTasks();
|
||||
|
||||
//send all busy contexts a termate signal
|
||||
{
|
||||
CONDITION_LOCKER(guard, _contextCondition);
|
||||
|
||||
for (auto it = _busyContexts.begin(); it != _busyContexts.end(); ++it) {
|
||||
LOG_WARNING("sending termination signal to V8 context");
|
||||
v8::V8::TerminateExecution((*it)->_isolate);
|
||||
}
|
||||
}
|
||||
|
||||
// wait for one minute
|
||||
for (size_t n = 0; n < 10 * 60; ++n) {
|
||||
CONDITION_LOCKER(guard, _contextCondition);
|
||||
|
||||
if (_busyContexts.empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
guard.wait(100000);
|
||||
}
|
||||
|
||||
// stop GC
|
||||
|
|
|
@ -114,7 +114,7 @@ static bool SyncDatafile (const TRI_datafile_t* const datafile,
|
|||
return true;
|
||||
}
|
||||
|
||||
assert(datafile->_fd > 0);
|
||||
assert(datafile->_fd >= 0);
|
||||
|
||||
if (begin == end) {
|
||||
// no need to sync
|
||||
|
@ -146,7 +146,7 @@ static int TruncateDatafile (TRI_datafile_t* const datafile, const off_t length)
|
|||
|
||||
static int CreateSparseFile (char const* filename,
|
||||
const TRI_voc_size_t maximalSize) {
|
||||
off_t offset;
|
||||
TRI_lseek_t offset;
|
||||
char zero;
|
||||
ssize_t res;
|
||||
int fd;
|
||||
|
@ -162,9 +162,9 @@ static int CreateSparseFile (char const* filename,
|
|||
}
|
||||
|
||||
// create sparse file
|
||||
offset = TRI_LSEEK(fd, maximalSize - 1, SEEK_SET);
|
||||
offset = TRI_LSEEK(fd, (TRI_lseek_t) (maximalSize - 1), SEEK_SET);
|
||||
|
||||
if (offset == (off_t) -1) {
|
||||
if (offset == (TRI_lseek_t) -1) {
|
||||
TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
|
@ -192,7 +192,6 @@ static int CreateSparseFile (char const* filename,
|
|||
return fd;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises a datafile
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -212,7 +211,7 @@ static void InitDatafile (TRI_datafile_t* datafile,
|
|||
assert(fd == -1);
|
||||
}
|
||||
else {
|
||||
assert(fd > 0);
|
||||
assert(fd >= 0);
|
||||
}
|
||||
|
||||
datafile->_state = TRI_DF_STATE_READ;
|
||||
|
@ -266,7 +265,6 @@ static int TruncateAndSealDatafile (TRI_datafile_t* datafile,
|
|||
int fd;
|
||||
int res;
|
||||
size_t maximalSize;
|
||||
off_t offset;
|
||||
void* data;
|
||||
void* mmHandle;
|
||||
|
||||
|
@ -295,9 +293,9 @@ static int TruncateAndSealDatafile (TRI_datafile_t* datafile,
|
|||
}
|
||||
|
||||
// create sparse file
|
||||
offset = TRI_LSEEK(fd, (TRI_lseek_t) maximalSize - 1, SEEK_SET);
|
||||
TRI_lseek_t offset = TRI_LSEEK(fd, (TRI_lseek_t) (maximalSize - 1), SEEK_SET);
|
||||
|
||||
if (offset == (off_t) -1) {
|
||||
if (offset == (TRI_lseek_t) -1) {
|
||||
TRI_set_errno(TRI_ERROR_SYS_ERROR);
|
||||
TRI_CLOSE(fd);
|
||||
|
||||
|
|
|
@ -133,7 +133,186 @@
|
|||
expect(window.modalView.show).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should stop an events propagination", function() {
|
||||
var e = {
|
||||
stopPropagation: function(){}
|
||||
};
|
||||
spyOn(e, "stopPropagation");
|
||||
tile1.noop(e);
|
||||
expect(e.stopPropagation).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should load a collection", function() {
|
||||
spyOn(tile1.model, "loadCollection");
|
||||
spyOn(tile1, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.loadCollection();
|
||||
expect(tile1.model.loadCollection).toHaveBeenCalled();
|
||||
expect(tile1.render).toHaveBeenCalled();
|
||||
expect(window.modalView.hide).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should unload a collection", function() {
|
||||
spyOn(tile1.model, "unloadCollection");
|
||||
spyOn(tile1, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.unloadCollection();
|
||||
expect(tile1.model.unloadCollection).toHaveBeenCalled();
|
||||
expect(tile1.render).toHaveBeenCalled();
|
||||
expect(window.modalView.hide).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should delete a collection with success", function() {
|
||||
spyOn(tile1.model, "destroy");
|
||||
spyOn(tile1.collectionsView, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.deleteCollection();
|
||||
expect(tile1.model.destroy).toHaveBeenCalled();
|
||||
expect(tile1.collectionsView.render).toHaveBeenCalled();
|
||||
expect(window.modalView.hide).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should save a modified collection (unloaded collection, save error)", function() {
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(arangoHelper, "arangoError");
|
||||
spyOn(tile1.model, "renameCollection");
|
||||
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
expect(arangoHelper.arangoError).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should save a modified collection (loaded collection, save error)", function() {
|
||||
tile1.model.set('status', "loaded");
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(arangoHelper, "arangoError");
|
||||
spyOn(tile1.model, "renameCollection");
|
||||
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
expect(arangoHelper.arangoError).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("should save a modified collection (unloaded collection, success)", function() {
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(tile1.model, "renameCollection").andReturn(true);
|
||||
spyOn(tile1.collectionsView, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(window.modalView.hide).toHaveBeenCalled();
|
||||
expect(tile1.collectionsView.render).toHaveBeenCalled();
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should save a modified collection (loaded collection, success)", function() {
|
||||
tile1.model.set('status', "loaded");
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var tempdiv = document.createElement("div");
|
||||
tempdiv.id = "change-collection-size";
|
||||
document.body.appendChild(tempdiv);
|
||||
$('#change-collection-size').val(123123123123);
|
||||
|
||||
spyOn(tile1.model, "changeCollection").andReturn(true);
|
||||
spyOn(tile1.model, "renameCollection").andReturn(true);
|
||||
spyOn(tile1.collectionsView, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(window.modalView.hide).toHaveBeenCalled();
|
||||
expect(tile1.collectionsView.render).toHaveBeenCalled();
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
|
||||
document.body.removeChild(tempdiv);
|
||||
});
|
||||
|
||||
it("should not save a modified collection (invalid data, result)", function() {
|
||||
tile1.model.set('status', "loaded");
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var tempdiv = document.createElement("div");
|
||||
tempdiv.id = "change-collection-size";
|
||||
document.body.appendChild(tempdiv);
|
||||
$('#change-collection-size').val(123123123123);
|
||||
|
||||
spyOn(arangoHelper, "arangoError");
|
||||
spyOn(arangoHelper, "arangoNotification");
|
||||
spyOn(tile1.model, "changeCollection").andReturn(false);
|
||||
spyOn(tile1.model, "renameCollection").andReturn(false);
|
||||
spyOn(tile1.collectionsView, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(window.modalView.hide).not.toHaveBeenCalled();
|
||||
expect(tile1.collectionsView.render).not.toHaveBeenCalled();
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
expect(arangoHelper.arangoError).toHaveBeenCalled();
|
||||
|
||||
document.body.removeChild(tempdiv);
|
||||
});
|
||||
|
||||
it("should not save a modified collection (invalid data, result)", function() {
|
||||
tile1.model.set('status', "loaded");
|
||||
window.App = {
|
||||
notificationList: {
|
||||
add: function() {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var tempdiv = document.createElement("div");
|
||||
tempdiv.id = "change-collection-size";
|
||||
document.body.appendChild(tempdiv);
|
||||
$('#change-collection-size').val(123123123123);
|
||||
|
||||
spyOn(arangoHelper, "arangoError");
|
||||
spyOn(arangoHelper, "arangoNotification");
|
||||
spyOn(tile1.model, "changeCollection").andReturn(false);
|
||||
spyOn(tile1.model, "renameCollection").andReturn(true);
|
||||
spyOn(tile1.collectionsView, "render");
|
||||
spyOn(window.modalView, "hide");
|
||||
tile1.saveModifiedCollection();
|
||||
|
||||
expect(window.modalView.hide).not.toHaveBeenCalled();
|
||||
expect(tile1.collectionsView.render).not.toHaveBeenCalled();
|
||||
expect(tile1.model.renameCollection).toHaveBeenCalled();
|
||||
expect(arangoHelper.arangoNotification).toHaveBeenCalled();
|
||||
|
||||
document.body.removeChild(tempdiv);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -674,7 +674,7 @@ typedef unsigned char bool;
|
|||
#define TRI_CLOSE _close
|
||||
#define TRI_CREATE(a,b,c) TRI_createFile((a), (b), (c))
|
||||
#define TRI_GETCWD _getcwd
|
||||
#define TRI_LSEEK _lseek
|
||||
#define TRI_LSEEK _lseeki64
|
||||
#define TRI_MKDIR(a,b) _mkdir((a))
|
||||
#define TRI_OPEN(a,b) TRI_OPEN_WIN32((a), (b))
|
||||
#define TRI_READ _read
|
||||
|
@ -682,9 +682,9 @@ typedef unsigned char bool;
|
|||
#define TRI_UNLINK _unlink
|
||||
#define TRI_WRITE _write
|
||||
|
||||
#define TRI_write_t unsigned long
|
||||
#define TRI_read_t unsigned long
|
||||
#define TRI_lseek_t long
|
||||
#define TRI_write_t unsigned int
|
||||
#define TRI_read_t unsigned int
|
||||
#define TRI_lseek_t __int64
|
||||
|
||||
#define TRI_LAST_ERROR_STR strerror(errno)
|
||||
|
||||
|
|
|
@ -214,6 +214,16 @@ bool ApplicationDispatcher::open () {
|
|||
/// {@inheritDoc}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ApplicationDispatcher::close () {
|
||||
if (_dispatcher != 0) {
|
||||
_dispatcher->beginShutdown();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// {@inheritDoc}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ApplicationDispatcher::stop () {
|
||||
if (_dispatcherReporterTask != 0) {
|
||||
_dispatcherReporterTask = 0;
|
||||
|
@ -222,8 +232,6 @@ void ApplicationDispatcher::stop () {
|
|||
if (_dispatcher != 0) {
|
||||
static size_t const MAX_TRIES = 50; // 10 seconds (50 * 200 ms)
|
||||
|
||||
_dispatcher->beginShutdown();
|
||||
|
||||
for (size_t count = 0; count < MAX_TRIES && _dispatcher->isRunning(); ++count) {
|
||||
LOG_TRACE("waiting for dispatcher to stop");
|
||||
usleep(200 * 1000);
|
||||
|
|
|
@ -136,6 +136,12 @@ namespace triagens {
|
|||
|
||||
bool open ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// {@inheritDoc}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void close ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// {@inheritDoc}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue