mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
c0773691c6
|
@ -154,18 +154,20 @@ uint64_t ShardingStrategyCommunityCompat::hashByAttributes(
|
|||
if (slice.isObject()) {
|
||||
for (auto const& attr : attributes) {
|
||||
VPackSlice sub = slice.get(attr).resolveExternal();
|
||||
VPackBuilder tempBuilder;
|
||||
if (sub.isNone()) {
|
||||
if (attr == StaticStrings::KeyString && !key.empty()) {
|
||||
VPackBuilder tempBuilder;
|
||||
tempBuilder.add(VPackValue(key));
|
||||
sub = tempBuilder.slice();
|
||||
} else {
|
||||
if (!docComplete) {
|
||||
error = TRI_ERROR_CLUSTER_NOT_ALL_SHARDING_ATTRIBUTES_GIVEN;
|
||||
}
|
||||
// Null is equal to None/not present
|
||||
sub = VPackSlice::nullSlice();
|
||||
hash = sub.normalizedHash(hash);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!docComplete) {
|
||||
error = TRI_ERROR_CLUSTER_NOT_ALL_SHARDING_ATTRIBUTES_GIVEN;
|
||||
}
|
||||
// Null is equal to None/not present
|
||||
sub = VPackSlice::nullSlice();
|
||||
}
|
||||
hash = sub.normalizedHash(hash);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,12 @@ function ahuacatlShardIdsOptimizationTestSuite() {
|
|||
FILTER joined.joinValue == doc.joinValue
|
||||
RETURN [doc, joined]
|
||||
`;
|
||||
validatePlan(query, "IndexNode", collectionByKey);
|
||||
|
||||
const isEnterprise = require("internal").isEnterprise();
|
||||
if (isEnterprise) {
|
||||
// enterprise distributes all numeric keys onto one shard
|
||||
validatePlan(query, "IndexNode", collectionByKey);
|
||||
}
|
||||
let res = db._query(query).toArray();
|
||||
// we find 4 in first Loop, and 4 joins each
|
||||
assertEqual(16, res.length);
|
||||
|
@ -263,6 +268,24 @@ function ahuacatlShardIdsOptimizationTestSuite() {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
testRestrictMultipleShardsStringKeys : function () {
|
||||
dropIndexes(collectionByKey);
|
||||
collectionByKey.ensureHashIndex(shardKey);
|
||||
|
||||
for (let i = 0; i < 25; ++i) {
|
||||
const query = `
|
||||
FOR doc IN ${cnKey}
|
||||
FILTER doc.${shardKey} == "key${i}"
|
||||
FOR joined IN ${cnKey}
|
||||
FILTER joined.${shardKey} == "key${i}"
|
||||
FILTER joined.joinValue == doc.joinValue
|
||||
RETURN [doc, joined]
|
||||
`;
|
||||
|
||||
validatePlan(query, "IndexNode", collectionByKey);
|
||||
}
|
||||
},
|
||||
|
||||
/* Not supported yet
|
||||
testRestrictOnShardKeyNoIndex : function () {
|
||||
|
|
Loading…
Reference in New Issue