1
0
Fork 0

fix potentially hanging dfdb

This commit is contained in:
jsteemann 2017-05-04 10:39:47 +02:00
parent 1ea4dcc4fd
commit 660dc39b29
2 changed files with 20 additions and 9 deletions

View File

@ -33,24 +33,25 @@ var fs = require("fs");
var printf = internal.printf;
////////////////////////////////////////////////////////////////////////////////
/// @brief unload a collection
////////////////////////////////////////////////////////////////////////////////
function UnloadCollection (collection) {
var last = Math.round(internal.time());
var tries = 0;
// unload collection if not yet unloaded (2) & not corrupted (0)
while (collection.status() !== 2 && collection.status() !== 0) {
collection.unload();
var next = Math.round(internal.time());
if (next !== last) {
printf("Trying to unload collection '%s'\n", collection.name());
last = next;
if (++tries >= 20) {
break;
}
if (tries == 1) {
printf("Trying to unload collection '%s', current status: %s\n", collection.name(), collection.status());
}
internal.wait(1, true);
}
}

View File

@ -46,8 +46,16 @@
require('@arangodb/statistics').startup();
}
// check if --server.rest-server is disabled
// in this case we do not (and should not) initialize and start Foxx
var options = internal.options();
var restServer = true;
if (options.hasOwnProperty("server.rest-server")) {
restServer = options["server.rest-server"];
}
// load all foxxes
if (internal.threadNumber === 0) {
if (internal.threadNumber === 0 && restServer) {
internal.loadStartup('server/bootstrap/foxxes.js').foxxes();
}
@ -55,7 +63,9 @@
internal.loadStartup('server/bootstrap/autoload.js').startup();
// reload routing information
internal.loadStartup('server/bootstrap/routing.js').startup();
if (restServer) {
internal.loadStartup('server/bootstrap/routing.js').startup();
}
// start the queue manager once
if (internal.threadNumber === 0) {