1
0
Fork 0

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

This commit is contained in:
Max Neunhoeffer 2016-12-22 15:54:31 +01:00
commit 103cee9d8d
5 changed files with 19 additions and 9 deletions

View File

@ -78,7 +78,7 @@ The string matching performed by *CONTAINS* is case-sensitive.
- **text** (string): the haystack
- **search** (string): the needle
- returnIndex** (bool, *optional*): if set to *true*, the character position
- **returnIndex** (bool, *optional*): if set to *true*, the character position
of the match is returned instead of a boolean. The default is *false*.
The default is *false*.
- returns **match** (bool|number): by default, *true* is returned if *search*

View File

@ -191,7 +191,7 @@ quote marks around the collection name.
If you run above query, there will be an empty array as result because we did
not specify what to return using a `RETURN` keyword. It is optional in
modification queries, but mandatory in data access queries. Even with `RESULT`,
modification queries, but mandatory in data access queries. Even with `RETURN`,
the return value can still be an empty array, e.g. if the specified document
was not found. Despite the empty result, the above query still created a new
user document. You can verify this with the document browser.

View File

@ -610,6 +610,13 @@ void Supervision::workJobs() {
void Supervision::enforceReplication() {
auto const& todo = _snapshot(toDoPrefix).children();
auto const& pending = _snapshot(pendingPrefix).children();
if (!todo.empty() || !pending.empty()) { // This is low priority
return;
}
auto const& plannedDBs = _snapshot(planColPrefix).children();
auto available = Job::availableServers(_snapshot);
@ -629,19 +636,19 @@ void Supervision::enforceReplication() {
clone = !col("distributeShardsLike").slice().copyString().empty();
} catch (...) {}
auto const& failed = _snapshot("failedServersPrefix").children();
auto const& failed = _snapshot(failedServersPrefix).children();
if (!clone) {
for (auto const& shard_ : col("shards").children()) { // Pl shards
auto const& shard = *(shard_.second);
size_t actualReplicationFactor = shard.slice().length();
for (const auto& i : VPackArrayIterator(shard.slice())) {
if (failed.find(i.copyString())!=failed.end()) {
--actualReplicationFactor;
}
}
if (actualReplicationFactor > 0 && // Need at least one survived
replicationFactor > actualReplicationFactor && // Planned higher
available.size() > shard.slice().length()) { // Any servers available
@ -651,8 +658,8 @@ void Supervision::enforceReplication() {
available.begin(), available.end(), i.copyString()),
available.end());
}
size_t optimal = replicationFactor - shard.slice().length();
size_t optimal = replicationFactor - actualReplicationFactor;
std::vector<std::string> newFollowers;
for (size_t i = 0; i < optimal; ++i) {
auto randIt = available.begin();
@ -667,6 +674,7 @@ void Supervision::enforceReplication() {
AddFollower(
_snapshot, _agent, std::to_string(_jobId++), "supervision",
_agencyPrefix, db_.first, col_.first, shard_.first, newFollowers);
}
}
}

View File

@ -30,7 +30,7 @@
</tr>
</tbody>
</table>
<p style="width: 100%; text-align: center;">Need help? Visit our <a style="font-weight: bold" href="https://docs.arangodb.com/Graphs/index.html#example-graphs" target="_blank">Graph Documentation</a></p>
<p style="width: 100%; text-align: center;">Need help? Visit our <a style="font-weight: bold" href="https://docs.arangodb.com/latest/Manual/Graphs/index.html#example-graphs" target="_blank">Graph Documentation</a></p>
</div>

View File

@ -114,7 +114,8 @@ function agencyTestSuite () {
////////////////////////////////////////////////////////////////////////////////
/// @brief Test nasty willful attempt to break
////////////////////////////////////////////////////////////////////////////////
/*
TODO kaveh...fixup test
testTransact : function () {
var res;
assertEqual(readAndCheck([["/x"]]), [{}]);
@ -137,6 +138,7 @@ function agencyTestSuite () {
assertEqual(res, [9,10,{x:17}]);
writeAndCheck([[{"/":{"op":"delete"}}]]);
},
*/
////////////////////////////////////////////////////////////////////////////////
/// @brief test to write a single top level key