mirror of https://gitee.com/bigwinds/arangodb
Improved baby errors in cluster
This commit is contained in:
parent
0e2d31f633
commit
20733a81ae
|
@ -1129,6 +1129,9 @@ int deleteDocumentOnCoordinator(
|
||||||
// If we get here we get exactly one result for every shard.
|
// If we get here we get exactly one result for every shard.
|
||||||
TRI_ASSERT(allResults.size() == shardList->size());
|
TRI_ASSERT(allResults.size() == shardList->size());
|
||||||
mergeResultsAllShards(allResults, resultBody, errorCounter, shardList->size());
|
mergeResultsAllShards(allResults, resultBody, errorCounter, shardList->size());
|
||||||
|
responseCode =
|
||||||
|
(options.waitForSync ? GeneralResponse::ResponseCode::OK
|
||||||
|
: GeneralResponse::ResponseCode::ACCEPTED);
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2042,7 +2045,9 @@ int modifyDocumentOnCoordinator(
|
||||||
// Local data structores are automatically freed
|
// Local data structores are automatically freed
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
TRI_ASSERT(res.answer_code == arangodb::GeneralResponse::ResponseCode::OK);
|
TRI_ASSERT(res.answer_code == arangodb::GeneralResponse::ResponseCode::OK ||
|
||||||
|
res.answer_code ==
|
||||||
|
arangodb::GeneralResponse::ResponseCode::ACCEPTED);
|
||||||
TRI_ASSERT(res.answer != nullptr);
|
TRI_ASSERT(res.answer != nullptr);
|
||||||
allResults.emplace_back(res.answer->toVelocyPack(&VPackOptions::Defaults));
|
allResults.emplace_back(res.answer->toVelocyPack(&VPackOptions::Defaults));
|
||||||
extractErrorCodes(res, errorCounter, false);
|
extractErrorCodes(res, errorCounter, false);
|
||||||
|
@ -2050,6 +2055,9 @@ int modifyDocumentOnCoordinator(
|
||||||
// If we get here we get exactly one result for every shard.
|
// If we get here we get exactly one result for every shard.
|
||||||
TRI_ASSERT(allResults.size() == shardList->size());
|
TRI_ASSERT(allResults.size() == shardList->size());
|
||||||
mergeResultsAllShards(allResults, resultBody, errorCounter, shardList->size());
|
mergeResultsAllShards(allResults, resultBody, errorCounter, shardList->size());
|
||||||
|
responseCode =
|
||||||
|
(options.waitForSync ? GeneralResponse::ResponseCode::OK
|
||||||
|
: GeneralResponse::ResponseCode::ACCEPTED);
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ var ERRORS = arangodb.errors;
|
||||||
var db = arangodb.db;
|
var db = arangodb.db;
|
||||||
var internal = require("internal");
|
var internal = require("internal");
|
||||||
var wait = internal.wait;
|
var wait = internal.wait;
|
||||||
|
var cluster = require("@arangodb/cluster");
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test suite: babies for documents
|
/// @brief test suite: babies for documents
|
||||||
|
@ -763,14 +764,26 @@ function CollectionDocumentSuiteBabies() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace
|
// Replace
|
||||||
docs = collection.replace([x, x, x], [{}, {}, {}]);
|
if (typeof x === "object" && !Array.isArray(x) &&
|
||||||
assertEqual(docs.length, expectedLength);
|
cluster.isCoordinator()) {
|
||||||
for (var i = 0; i < expectedLength; ++i) {
|
try {
|
||||||
assertEqual(docs[i].error, true);
|
docs = collection.replace([x, x, x], [{}, {}, {}]);
|
||||||
if (typeof x === "string") {
|
fail();
|
||||||
assertEqual(docs[i].errorNum, ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
} catch (err) {
|
||||||
} else {
|
// In this case the coordinator will directly figure out that no
|
||||||
assertEqual(docs[i].errorNum, ERRORS.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code);
|
// keys are given
|
||||||
|
assertEqual(err.errorNum, ERRORS.ERROR_CLUSTER_NOT_ALL_SHARDING_ATTRIBUTES_GIVEN.code);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
docs = collection.replace([x, x, x], [{}, {}, {}]);
|
||||||
|
assertEqual(docs.length, expectedLength);
|
||||||
|
for (var i = 0; i < expectedLength; ++i) {
|
||||||
|
assertEqual(docs[i].error, true);
|
||||||
|
if (typeof x === "string") {
|
||||||
|
assertEqual(docs[i].errorNum, ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
|
} else {
|
||||||
|
assertEqual(docs[i].errorNum, ERRORS.ERROR_ARANGO_DOCUMENT_HANDLE_BAD.code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue