1
0
Fork 0

Bug fix/jobs indexes (#9107)

This commit is contained in:
Simon 2019-05-28 09:38:14 +02:00 committed by Jan
parent b442f3f6ec
commit 27112a3486
3 changed files with 31 additions and 5 deletions

View File

@ -1,6 +1,8 @@
devel devel
----- -----
* The system collection '_jobs' will from now on be created with non-unique, non-sparse indexes.
* Bugfix for smart graph traversals with uniqueVertices: path, which could * Bugfix for smart graph traversals with uniqueVertices: path, which could
sometimes lead to erroneous traversal results sometimes lead to erroneous traversal results

View File

@ -298,15 +298,15 @@ bool UpgradeTasks::createJobsIndex(TRI_vocbase_t& vocbase,
"_jobs", // collection name "_jobs", // collection name
arangodb::Index::TRI_IDX_TYPE_SKIPLIST_INDEX, // index type arangodb::Index::TRI_IDX_TYPE_SKIPLIST_INDEX, // index type
{"queue", "status", "delayUntil"}, {"queue", "status", "delayUntil"},
/*unique*/ true, /*unique*/ false,
/*sparse*/ true); /*sparse*/ false);
::createIndex( ::createIndex(
vocbase, // collection vocbase vocbase, // collection vocbase
"_jobs", // collection name "_jobs", // collection name
arangodb::Index::TRI_IDX_TYPE_SKIPLIST_INDEX, // index type arangodb::Index::TRI_IDX_TYPE_SKIPLIST_INDEX, // index type
{"status", "queue", "delayUntil"}, {"status", "queue", "delayUntil"},
/*unique*/ true, /*unique*/ false,
/*sparse*/ true); /*sparse*/ false);
return true; return true;
} }

View File

@ -1,4 +1,4 @@
/*global assertEqual, assertNotEqual, assertFalse, fail */ /*global assertEqual, assertNotEqual, assertNotUndefined, assertFalse, fail */
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief test foxx queues /// @brief test foxx queues
@ -88,6 +88,30 @@ function foxxQueuesSuite () {
assertEqual(qn, queues.get(qn).name); assertEqual(qn, queues.get(qn).name);
}, },
testCheckJobIndexes : function () {
let indexes = db._jobs.getIndexes();
assertEqual(indexes.length, 3);
indexes.forEach(idx => {
switch(idx.type) {
case "primary":
break;
case "skiplist":
assertNotUndefined(idx.fields);
assertFalse(idx.unique, idx);
assertFalse(idx.sparse);
assertEqual(idx.fields.length, 3);
if (idx.fields[0] === "queue") {
assertEqual(idx.fields, ["queue", "status", "delayUntil"]);
} else {
assertEqual(idx.fields, ["status", "queue", "delayUntil"]);
}
break;
default:
fail();
}
});
},
testCreateDelayedJob : function () { testCreateDelayedJob : function () {
var delay = { delayUntil: Date.now() + 1000 * 86400 }; var delay = { delayUntil: Date.now() + 1000 * 86400 };
var queue = queues.create(qn); var queue = queues.create(qn);