10000 Rdb index background (preliminary) by graetzer · Pull Request #7644 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Rdb index background (preliminary) #7644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3f6967c
Initial commit
graetzer Dec 3, 2018
38b3500
make sure index is hidden
graetzer Dec 3, 2018
0ddb321
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rdb…
graetzer Dec 4, 2018
9bcc737
last changes
graetzer Dec 4, 2018
c57de4f
fix a bug
graetzer Dec 4, 2018
c798357
reduce conflicts
graetzer Dec 5, 2018
4766900
fix background indexing
graetzer Dec 6, 2018
b525712
remove unused code
graetzer Dec 6, 2018
0515650
fix link creation
graetzer Dec 6, 2018
70ef2f1
fix unique constraint violations
graetzer Dec 6, 2018
e6d23c1
fixed arangosearch cluster reporting
graetzer Dec 6, 2018
13bcd44
added test
graetzer Dec 6, 2018
9e5f960
fix test
graetzer Dec 6, 2018
6bfd840
make noncluster for now
graetzer Dec 6, 2018
3d20521
fix jslint
graetzer Dec 7, 2018
38005e0
Some test adjustments.
Dec 10, 2018
dc041fb
Merge branch 'devel' into feature/rdb-index-background
Dec 10, 2018
a7ae28a
Fix merge error.
Dec 10, 2018
db46a40
changes
graetzer Dec 10, 2018
9db5709
Merge branch 'feature/rdb-index-background' of github.com:arangodb/ar…
graetzer Dec 10, 2018
ef4bb05
adding inBackground flag
graetzer Dec 11, 2018
5546745
Merge branch 'devel' into feature/rdb-index-background
Dec 11, 2018
2ebf591
Fix merge errors.
Dec 11, 2018
2082f78
adding some docs
graetzer Dec 12, 2018
3efc632
Merge branch 'devel' into feature/rdb-index-background
Dec 12, 2018
98ddd16
Some small changes.
Dec 12, 2018
ee51fa5
Fixed removal bug and added test.
Dec 12, 2018
422e0ce
Added update test.
Dec 17, 2018
31d9d7b
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rdb…
graetzer Dec 18, 2018
a34f928
forgot to comment out docs
graetzer Dec 18, 2018
021453c
fixing some code
graetzer Dec 19, 2018
f61b5e9
fix jslint
graetzer Dec 19, 2018
b013b15
remove some code
graetzer Dec 19, 2018
82f4b6e
fix reporting of unfinished indexes
graetzer Dec 20, 2018
b7d6a9d
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rdb…
graetzer Dec 20, 2018
2f1cc80
fixing fillIndex for iresearch
graetzer Dec 21, 2018
371c738
revert a change
graetzer Dec 21, 2018
7f4e2e7
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rdb…
graetzer Dec 21, 2018
3f46816
fixng a deadlock
graetzer Dec 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some test adjustments.
  • Loading branch information
Dan Larkin-York committed Dec 10, 2018
commit 38005e04c031fc7630760f0911cf2ed42f8d589c
2 changes: 1 addition & 1 deletion lib/Basics/RocksDBUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ arangodb::Result convertStatus(rocksdb::Status const& status, StatusHint hint, s
// should actually not occur with our RocksDB configuration
return {TRI_ERROR_RESOURCE_LIMIT, prefix + "failed to acquire lock due to lock number limit"+ postfix };
}
return {TRI_ERROR_ARANGO_CONFLICT};
return {TRI_ERROR_ARANGO_CONFLICT, "write-write conflict"};
case rocksdb::Status::Code::kExpired:
return {TRI_ERROR_INTERNAL, prefix + "key expired; TTL was set in error"+ postfix};
case rocksdb::Status::Code::kTryAgain:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,26 @@ const db = internal.db;

function backgroundIndexSuite() {
'use strict';
let cn = "UnitTestsCollectionIdx";
let tasks = require("@arangodb/tasks");
const cn = "UnitTestsCollectionIdx";
const tasks = require("@arangodb/tasks");
const tasksCompleted = () => {
return 0 == tasks.get().filter((task) => {
return (task.id.match(/^UnitTest/) || task.name.match(/^UnitTest/))
}).length;
};
const waitForTasks = () => {
const time = require("internal").time;
const start = time();
while (!tasksCompleted()) {
if (time() - start > 300) { // wait for 5 minutes maximum
fail("Timeout creating documents after 5 minutes: " + c.count());
}
require("internal").wait(0.5, false);
}
require('internal').wal.flush(true, true);
// wait an extra second for good measure
require("internal").wait(1.0, false);
};

return {

Expand Down Expand Up @@ -74,8 +92,9 @@ function backgroundIndexSuite() {
let n = 9;
for (let i = 0; i < n; ++i) {
let command = `let c = require("internal").db._collection("${cn}");
let x = 10; while(x-- > 0) {
let docs = [];
let x = 10;
while(x-- > 0) {
let docs = [];
for(let i = 0; i < 1000; i++) {
docs.push({value:i})
}
Expand All @@ -87,41 +106,36 @@ function backgroundIndexSuite() {
// create the index on the main thread
c.ensureIndex({type: 'hash', fields: ['value'], unique: false});

let time = require("internal").time;
let start = time();
while (true) {
if (c.count() === 100000) {
break;
}
if (time() - start > 300) { // wait for 5 minutes maximum
fail("Timeout creating documents after 5 minutes: " + c.count());
}
require("internal").wait(0.5, false);
}
// wait for insertion tasks to complete
waitForTasks();

// sanity check
assertEqual(c.count(), 100000);

// 250 entries of each value [0,999]
for (let i = 0; i < 1000; i++) {
// 100 entries of each value [0,999]
/*for (let i = 0; i < 1000; i++) {
let cursor = db._query("FOR doc IN @@coll FILTER doc.value == @val RETURN 1",
{'@coll': cn, 'val': i}, {count:true});
assertEqual(cursor.count(), 100);
}

const estimate = 1000.0 / 100000.0;
}*/

internal.waitForEstimatorSync(); // make sure estimates are consistent
let indexes = c.getIndexes(true);
for (let i of indexes) {
switch (i.type) {
case 'primary':
break;
case 'hash':
assertEqual(i.selectivityEstimate, estimate);
assertEqual(i.selectivityEstimate, 0.01);
break;
default:
fail();
}
}
},

// if we run this in isolation, it passes, but the count is off otherwise.
// the slow part of the test is the individual sanity checks
testInsertParallelUnique: function () {
let c = require("internal").db._collection(cn);
// first lets add some initial documents
Expand All @@ -139,36 +153,36 @@ function backgroundIndexSuite() {
let command = `let c = require("internal").db._collection("${cn}");
let x = ${i} * 10000;
while(x < ${i + 1} * 10000) {
let docs = [];
for(let i = 0; i < 1000; i++) {
docs.push({value: x++})
}
c.save(docs);
}`;
let docs = [];
for(let i = 0; i < 1000; i++) {
docs.push({value: x++})
}
let res = c.save(docs);
res.map((obj) => {
if (obj.error) {
require('internal').print(JSON.stringify(obj));
}
});
}`;
tasks.register({ name: "UnitTestsIndexInsert" + i, command: command });
}

// create the index on the main thread
c.ensureIndex({type: 'hash', fields: ['value'], unique: true});

let time = require("internal").time;
let start = time();
while (true) {
if (c.count() === 50000) {
break;
}
if (time() - start > 300) { // wait for 5 minutes maximum
fail("Timeout creating documents after 5 minutes: " + c.count());
}
require("internal").wait(0.5, false);
}

// 250 entries of each value [0,999]
// wait for insertion tasks to complete
waitForTasks();

// sanity checks
const scanDocs = db._query("FOR doc IN @@coll RETURN doc",
{'@coll': cn}, {count:true, optimizer: {rules: ["-use-indexes"]}}).toArray();
assertEqual(scanDocs.length, 50000);
for (let i = 0; i < 50000; i++) {
let cursor = db._query("FOR doc IN @@coll FILTER doc.value == @val RETURN 1",
const cursor = db._query("FOR doc IN @@coll FILTER doc.value == @val RETURN 1",
{'@coll': cn, 'val': i}, {count:true});
assertEqual(cursor.count(), 1);
}
assertEqual(c.count(), 50000);*/

let indexes = c.getIndexes(true);
for (let i of indexes) {
Expand Down Expand Up @@ -201,17 +215,17 @@ function backgroundIndexSuite() {
let command = `let c = require("internal").db._collection("${cn}");
let x = ${i} * 10000;
while(x < ${i + 1} * 10000) {
let docs = [];
for(let i = 0; i < 1000; i++) {
docs.push({value: x++})
}
c.save(docs);
}`;
let docs = [];
for(let i = 0; i < 1000; i++) {
docs.push({value: x++})
}
c.save(docs);
}`;
tasks.register({ name: "UnitTestsIndexInsert" + i, command: command });
}

c.save({value: 1 }); // now trigger a conflict
//tasks.register({ name: "UnitTestsIndexInsert6" + i, command: `require("internal").db._collection("${cn}").save({value: 1 });` });
// now insert a document that will cause a conflict while indexing
c.save({value: 1 });

try {
// create the index on the main thread
Expand All @@ -221,17 +235,11 @@ function backgroundIndexSuite() {
assertEqual(errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code, err.errorNum, err);
}

let time = require("internal").time;
let start = time();
while (true) {
if (c.count() === 50001) {
break;
}
if (time() - start > 300) { // wait for 5 minutes maximum
fail("Timeout creating documents after 5 minutes: " + c.count());
}
require("internal").wait(0.5, false);
}
// wait for insertion tasks to complete
waitForTasks();

// sanity checks
assertEqual(c.count(), 50001);

let indexes = c.getIndexes();
for (let i of indexes) {
Expand Down
0