1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Michael Hackstein 2013-11-11 16:42:46 +01:00
commit f26177e890
3 changed files with 61 additions and 7 deletions

View File

@ -957,6 +957,7 @@ static int InsertDocument (TRI_transaction_collection_t* trxCollection,
if (res != TRI_ERROR_NO_ERROR) {
// insertion into secondary indexes failed
DeletePrimaryIndex(document, header, true);
DeleteSecondaryIndexes(document, header, true);
document->_headers->release(document->_headers, header, true);
return res;

View File

@ -149,13 +149,6 @@ struct TRI_vocbase_defaults_s;
#define TRI_WAIT_SYNCHRONISER_WAITER_VOCBASE(a, b) \
TRI_TimedWaitCondition(&(a)->_syncWaitersCondition, (b))
////////////////////////////////////////////////////////////////////////////////
/// @brief signals the synchroniser waiters
////////////////////////////////////////////////////////////////////////////////
#define TRI_BROADCAST_SYNCHRONISER_WAITER_VOCBASE(a) \
TRI_BroadcastCondition(&(a)->_syncWaitersCondition)
////////////////////////////////////////////////////////////////////////////////
/// @brief reduces the number of sync waiters
////////////////////////////////////////////////////////////////////////////////

View File

@ -235,6 +235,66 @@ function HashIndexSuite() {
catch (err) {
assertEqual(errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code, err.errorNum);
}
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: combination of indexes
////////////////////////////////////////////////////////////////////////////////
testMultiIndexViolation1 : function () {
collection.ensureUniqueConstraint("a");
collection.ensureSkiplist("b");
collection.save({ a : "test1", b : 1});
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err1) {
}
var doc1 = collection.save({ a : "test2", b : 1});
assertTrue(doc1._key !== "");
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err2) {
}
var doc2 = collection.save({ a : "test3", b : 1});
assertTrue(doc2._key !== "");
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: combination of indexes
////////////////////////////////////////////////////////////////////////////////
testMultiIndexViolation2 : function () {
collection.ensureUniqueSkiplist("a");
collection.ensureHashIndex("b");
collection.save({ a : "test1", b : 1});
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err1) {
}
var doc1 = collection.save({ a : "test2", b : 1});
assertTrue(doc1._key !== "");
try {
collection.save({ a : "test1", b : 1});
fail();
}
catch (err2) {
}
var doc2 = collection.save({ a : "test3", b : 1});
assertTrue(doc2._key !== "");
}
};