8000 fixed issue #2217 · aa10000/arangodb@03acaae · GitHub
[go: up one dir, main page]

Skip to content

Commit 03acaae

Browse files
committed
fixed issue arangodb#2217
1 parent 5b1b28d commit 03acaae

File tree

4 files changed

+107
-10
lines changed

4 files changed

+107
-10
lines changed

CHANGELOG

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,39 @@ edge attribute `label`.
2626
* process.stdout.isTTY now returns `true` in arangosh and when running arangod with the `--console` flag
2727

2828

29-
v3.1.4 (XXXX-XX-XX)
29+
v3.1.5 (XXXX-XX-XX)
30+
-------------------
31+
32+
* fixed issue #2217
33+
34+
* Foxx router.get/post/etc handler argument can no longer accidentally omitted
35+
* fixed issue #2217
36+
37+
38+
v3.1.4 (2016-12-08)
3039
-------------------
3140

3241
* fixed issue #2211
3342

3443
* fixed issue #2204
3544

45+
* at cluster start, coordinators wait until at least one DBserver is there,
46+
and either at least two DBservers are there or 15s have passed, before they
47+
initiate the bootstrap of system collections.
48+
49+
* more robust agency startup from devel
50+
51+
* supervision's AddFollower adds many followers at once
52+
53+
* supervision has new FailedFollower job
54+
55+
* agency's Node has new method getArray
56+
57+
* agency RAFT timing estimates more conservative in waitForSync
58+
scenario
59+
60+
* agency RAFT timing estimates capped at maximum 2.0/10.0 for low/high
61+
3662

3763
v3.1.3 (2016-12-02)
3864
-------------------

arangod/Indexes/EdgeIndex.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,20 @@ void EdgeIndex::toVelocyPack(VPackBuilder& builder, bool withFigures) const {
464464
/// @brief return a VelocyPack representation of the index figures
465465
void EdgeIndex::toVelocyPackFigures(VPackBuilder& builder) const {
466466
Index::toVelocyPackFigures(builder);
467-
builder.add("buckets", VPackValue(_numBuckets));
467+
builder.add("from", VPackValue(VPackValueType::Object));
468+
_edgesFrom->appendToVelocyPack(builder);
469+
builder.close();
470+
builder.add("to", VPackValue(VPackValueType::Object));
471+
_edgesTo->appendToVelocyPack(builder);
472+
builder.close();
473+
//builder.add("buckets", VPackValue(_numBuckets));
468474
}
469475

470476
int EdgeIndex::insert(arangodb::Transaction* trx, TRI_voc_rid_t revisionId,
471477
VPackSlice const& doc, bool isRollback) {
472478
SimpleIndexElement fromElement(buildFromElement(revisionId, doc));
473479
SimpleIndexElement toElement(buildToElement(revisionId, doc));
474-
480+
475481
ManagedDocumentResult result(trx);
476482
IndexLookupContext context(trx, _collection, &result, 1);
477483
_edgesFrom->insert(&context, fromElement, true, isRollback);

arangod/VocBase/LogicalCollection.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,12 +3116,10 @@ int LogicalCollection::updateDocument(
31163116
res = insertSecondaryIndexes(trx, newRevisionId, newDoc, false);
31173117

31183118
if (res != TRI_ERROR_NO_ERROR) {
3119-
// TODO: move down
3120-
removeRevision(newRevisionId, false);
3121-
31223119
// rollback
31233120
deleteSecondaryIndexes(trx, newRevisionId, newDoc, true);
31243121
insertSecondaryIndexes(trx, oldRevisionId, oldDoc, true);
3122+
removeRevision(newRevisionId, false);
31253123

31263124
return res;
31273125
}
@@ -3235,7 +3233,7 @@ int LogicalCollection::insertSecondaryIndexes(
32353233
}
32363234
}
32373235
}
3238-
3236+
32393237
return result;
32403238
}
32413239

@@ -3271,7 +3269,7 @@ int LogicalCollection::deleteSecondaryIndexes(
32713269
result = res;
32723270
}
32733271
}
3274-
3272+
32753273
return result;
32763274
}
32773275

js/common/tests/shell/shell-index.js

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ function getIndexesSuite() {
694694
};
695695
}
696696

697-
698697
////////////////////////////////////////////////////////////////////////////////
699698
/// @brief test suite: return value of getIndexes for an edge collection
700699
////////////////////////////////////////////////////////////////////////////////
@@ -712,7 +711,7 @@ function getIndexesEdgesSuite() {
712711

713712
setUp : function () {
714713
internal.db._drop(cn);
715-
collection = internal.db._createEdgeCollection(cn, { waitForSync : false });
714+
collection = internal.db._createEdgeCollection(cn);
716715
},
717716

718717
////////////////////////////////////////////////////////////////////////////////
@@ -1049,6 +1048,73 @@ function getIndexesEdgesSuite() {
10491048
};
10501049
}
10511050

1051+
////////////////////////////////////////////////////////////////////////////////
1052+
/// @brief test suite: test multi-index rollback
1053+
////////////////////////////////////////////////////////////////////////////////
1054+
1055+
function multiIndexRollbackSuite() {
1056+
'use strict';
1057+
var cn = "UnitTestsCollectionIdx";
1058+
var collection = null;
1059+
1060+
return {
1061+
1062+
////////////////////////////////////////////////////////////////////////////////
1063+
/// @brief set up
1064+
////////////////////////////////////////////////////////////////////////////////
1065+
1066+
setUp : function () {
1067+
internal.db._drop(cn);
1068+
collection = internal.db._createEdgeCollection(cn);
1069+
},
1070+
1071+
////////////////////////////////////////////////////////////////////////////////
1072+
/// @brief tear down
1073+
////////////////////////////////////////////////////////////////////////////////
1074+
1075+
tearDown : function () {
1076+
collection.drop();
1077+
collection = null;
1078+
},
1079+
1080+
////////////////////////////////////////////////////////////////////////////////
1081+
/// @brief test rollback on index insertion
1082+
////////////////////////////////////////////////////////////////////////////////
1083+
1084+
testIndexRollback: function () {
1085+
collection.ensureIndex({ type: "hash", fields: ["_from", "_to", "link"], unique: true });
1086+
collection.ensureIndex({ type: "hash", fields: ["_to", "ext"], unique: true, sparse: true });
1087+
1088+
var res = collection.getIndexes();
1089+
1090+
assertEqual(4, res.length);
1091+
assertEqual("primary", res[0].type);
1092+
assertEqual("edge", res[1].type);
1093+
assertEqual("hash", res[2].type);
1094+
assertEqual("hash", res[3].type);
1095+
1096+
var docs = [
1097+
{"_from": "fromC/a", "_to": "toC/1", "link": "one"},
1098+
{"_from": "fromC/b", "_to": "toC/1", "link": "two"},
1099+
{"_from": "fromC/c", "_to": "toC/1", "link": "one"}
1100+
];
1101+
1102+
collection.insert(docs);
1103+
assertEqual(3, collection.count());
1104+
1105+
try {
1106+
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());
1107+
fail();
1108+
} catch (err) {
1109+
assertEqual(errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code, err.errorNum);
1110+
}
1111+
1112+
res = internal.db._query("FOR doc IN " + collection.name() + " FILTER doc._to == 'toC/1' RETURN doc._from").toArray();
1113+
assertEqual(3, res.length);
1114+
}
1115+
1116+
};
1117+
}
10521118

10531119
////////////////////////////////////////////////////////////////////////////////
10541120
/// @brief executes the test suites
@@ -1057,6 +1123,7 @@ function getIndexesEdgesSuite() {
10571123
jsunity.run(indexSuite);
10581124
jsunity.run(getIndexesSuite);
10591125
jsunity.run(getIndexesEdgesSuite);
1126+
jsunity.run(multiIndexRollbackSuite);
10601127

10611128
return jsunity.done();
10621129

0 commit comments

Comments
 (0)
0