1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into devel

This commit is contained in:
Kaveh Vahedipour 2016-12-13 15:36:23 +01:00
commit 1c6837d0d9
4 changed files with 107 additions and 10 deletions

View File

@ -26,13 +26,39 @@ edge attribute `label`.
* process.stdout.isTTY now returns `true` in arangosh and when running arangod with the `--console` flag
v3.1.4 (XXXX-XX-XX)
v3.1.5 (XXXX-XX-XX)
-------------------
* fixed issue #2217
* Foxx router.get/post/etc handler argument can no longer accidentally omitted
* fixed issue #2217
v3.1.4 (2016-12-08)
-------------------
* fixed issue #2211
* fixed issue #2204
* at cluster start, coordinators wait until at least one DBserver is there,
and either at least two DBservers are there or 15s have passed, before they
initiate the bootstrap of system collections.
* more robust agency startup from devel
* supervision's AddFollower adds many followers at once
* supervision has new FailedFollower job
* agency's Node has new method getArray
* agency RAFT timing estimates more conservative in waitForSync
scenario
* agency RAFT timing estimates capped at maximum 2.0/10.0 for low/high
v3.1.3 (2016-12-02)
-------------------

View File

@ -464,14 +464,20 @@ void EdgeIndex::toVelocyPack(VPackBuilder& builder, bool withFigures) const {
/// @brief return a VelocyPack representation of the index figures
void EdgeIndex::toVelocyPackFigures(VPackBuilder& builder) const {
Index::toVelocyPackFigures(builder);
builder.add("buckets", VPackValue(_numBuckets));
builder.add("from", VPackValue(VPackValueType::Object));
_edgesFrom->appendToVelocyPack(builder);
builder.close();
builder.add("to", VPackValue(VPackValueType::Object));
_edgesTo->appendToVelocyPack(builder);
builder.close();
//builder.add("buckets", VPackValue(_numBuckets));
}
int EdgeIndex::insert(arangodb::Transaction* trx, TRI_voc_rid_t revisionId,
VPackSlice const& doc, bool isRollback) {
SimpleIndexElement fromElement(buildFromElement(revisionId, doc));
SimpleIndexElement toElement(buildToElement(revisionId, doc));
ManagedDocumentResult result(trx);
IndexLookupContext context(trx, _collection, &result, 1);
_edgesFrom->insert(&context, fromElement, true, isRollback);

View File

@ -3116,12 +3116,10 @@ int LogicalCollection::updateDocument(
res = insertSecondaryIndexes(trx, newRevisionId, newDoc, false);
if (res != TRI_ERROR_NO_ERROR) {
// TODO: move down
removeRevision(newRevisionId, false);
// rollback
deleteSecondaryIndexes(trx, newRevisionId, newDoc, true);
insertSecondaryIndexes(trx, oldRevisionId, oldDoc, true);
removeRevision(newRevisionId, false);
return res;
}
@ -3235,7 +3233,7 @@ int LogicalCollection::insertSecondaryIndexes(
}
}
}
return result;
}
@ -3271,7 +3269,7 @@ int LogicalCollection::deleteSecondaryIndexes(
result = res;
}
}
return result;
}

View File

@ -694,7 +694,6 @@ function getIndexesSuite() {
};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: return value of getIndexes for an edge collection
////////////////////////////////////////////////////////////////////////////////
@ -712,7 +711,7 @@ function getIndexesEdgesSuite() {
setUp : function () {
internal.db._drop(cn);
collection = internal.db._createEdgeCollection(cn, { waitForSync : false });
collection = internal.db._createEdgeCollection(cn);
},
////////////////////////////////////////////////////////////////////////////////
@ -1049,6 +1048,73 @@ function getIndexesEdgesSuite() {
};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: test multi-index rollback
////////////////////////////////////////////////////////////////////////////////
function multiIndexRollbackSuite() {
'use strict';
var cn = "UnitTestsCollectionIdx";
var collection = null;
return {
////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
internal.db._drop(cn);
collection = internal.db._createEdgeCollection(cn);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
collection.drop();
collection = null;
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test rollback on index insertion
////////////////////////////////////////////////////////////////////////////////
testIndexRollback: function () {
collection.ensureIndex({ type: "hash", fields: ["_from", "_to", "link"], unique: true });
collection.ensureIndex({ type: "hash", fields: ["_to", "ext"], unique: true, sparse: true });
var res = collection.getIndexes();
assertEqual(4, res.length);
assertEqual("primary", res[0].type);
assertEqual("edge", res[1].type);
assertEqual("hash", res[2].type);
assertEqual("hash", res[3].type);
var docs = [
{"_from": "fromC/a", "_to": "toC/1", "link": "one"},
{"_from": "fromC/b", "_to": "toC/1", "link": "two"},
{"_from": "fromC/c", "_to": "toC/1", "link": "one"}
];
collection.insert(docs);
assertEqual(3, collection.count());
try {
internal.db._query('FOR doc IN [ {_from: "fromC/a", _to: "toC/1", link: "one", ext: 2337789}, {_from: "fromC/b", _to: "toC/1", link: "two", ext: 2337799}, {_from: "fromC/c", _to: "toC/1", link: "one", ext: 2337789} ] UPSERT {_from: doc._from, _to: doc._to, link: doc.link} INSERT { _from: doc._from, _to: doc._to, link: doc.link, ext: doc.ext} UPDATE {ext: doc.ext} IN ' + collection.name());
fail();
} catch (err) {
assertEqual(errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code, err.errorNum);
}
res = internal.db._query("FOR doc IN " + collection.name() + " FILTER doc._to == 'toC/1' RETURN doc._from").toArray();
assertEqual(3, res.length);
}
};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suites
@ -1057,6 +1123,7 @@ function getIndexesEdgesSuite() {
jsunity.run(indexSuite);
jsunity.run(getIndexesSuite);
jsunity.run(getIndexesEdgesSuite);
jsunity.run(multiIndexRollbackSuite);
return jsunity.done();