1
0
Fork 0

Bug fix/fixes 1909 (#3285)

* remove TRI_ERROR_INTERNAL usage

* prevent assertion failure from occurring

* ensure downwards-compatibility for explain handler

* allow schmutz to drop system collections as well - needed for arangojs tests
This commit is contained in:
Jan 2017-09-19 21:56:32 +02:00 committed by Frank Celler
parent 2c29822afe
commit 43e0fd318e
6 changed files with 18 additions and 22 deletions

View File

@ -70,13 +70,13 @@ IndexNode::IndexNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas
std::string msg("collection '");
msg.append(base.get("collection").copyString());
msg.append("' not found");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND, msg);
}
VPackSlice indexes = base.get("indexes");
if (!indexes.isArray()) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "\"indexes\" attribute should be an array");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "\"indexes\" attribute should be an array");
}
_indexes.reserve(indexes.length());
@ -89,7 +89,7 @@ IndexNode::IndexNode(ExecutionPlan* plan, arangodb::velocypack::Slice const& bas
VPackSlice condition = base.get("condition");
if (!condition.isObject()) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "\"condition\" attribute should be an object");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "\"condition\" attribute should be an object");
}
_condition = Condition::fromVPack(plan, condition);

View File

@ -470,7 +470,7 @@ ExecutionPlan* Query::prepare() {
enterState(QueryExecutionState::ValueType::PLAN_INSTANTIATION);
plan.reset(ExecutionPlan::instantiateFromAst(_ast.get()));
if (plan.get() == nullptr) {
if (plan == nullptr) {
// oops
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "failed to create query execution engine");
}
@ -507,7 +507,7 @@ ExecutionPlan* Query::prepare() {
// we have an execution plan in VelocyPack format
plan.reset(ExecutionPlan::instantiateFromVelocyPack(_ast.get(), _queryBuilder->slice()));
if (plan.get() == nullptr) {
if (plan == nullptr) {
// oops
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "could not create plan from vpack");
}
@ -980,7 +980,7 @@ QueryResult Query::explain() {
if (plan == nullptr) {
// oops
return QueryResult(TRI_ERROR_INTERNAL);
return QueryResult(TRI_ERROR_INTERNAL, "unable to create plan from AST");
}
// Run the query optimizer:
@ -1074,8 +1074,8 @@ void Query::enterContext() {
_context = V8DealerFeature::DEALER->enterContext(_vocbase, false);
if (_context == nullptr) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"cannot enter V8 context");
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_RESOURCE_LIMIT,
"unable to enter V8 context for query execution");
}
// register transaction and resolver in context

View File

@ -359,7 +359,7 @@ void V8Executor::HandleV8Error(v8::TryCatch& tryCatch,
msg += " See log for details";
}
// we can't figure out what kind of error occurred and throw a generic error
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, msg);
}
if (result.IsEmpty()) {
@ -373,7 +373,7 @@ void V8Executor::HandleV8Error(v8::TryCatch& tryCatch,
msg += " See log for details";
}
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, msg);
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_SCRIPT, msg);
}
// if we get here, no exception has been raised

View File

@ -30,6 +30,7 @@
#include "GeneralServer/RestHandlerFactory.h"
#include "Logger/Logger.h"
#include "Rest/HttpRequest.h"
#include "Utils/ExecContext.h"
using namespace arangodb;
using namespace arangodb::basics;
@ -212,19 +213,14 @@ RestStatus RestBatchHandler::executeHttp() {
{
// ignore any errors here, will be handled later by inspecting the response
try {
ExecContext* old = ExecContext::CURRENT;
ExecContext::CURRENT = nullptr;
TRI_DEFER(ExecContext::CURRENT = old);
handler->syncRunEngine();
} catch (...) {
}
#if 0
int result = TRI_ERROR_NO_ERROR;
if (result != TRI_ERROR_NO_ERROR) {
generateError(rest::ResponseCode::BAD, TRI_ERROR_INTERNAL,
"executing a handler for batch part failed");
return RestStatus::FAIL;
}
#endif
HttpResponse* partResponse =
dynamic_cast<HttpResponse*>(handler->response());

View File

@ -82,7 +82,7 @@ void RestExplainHandler::explainQuery() {
generateError(rest::ResponseCode::BAD, TRI_ERROR_BAD_PARAMETER, msg);
};
if (!body.isObject() || body.length() < 1 || body.length() > 3) {
if (!body.isObject()) {
badParamError(
"expected usage: AQL_EXPLAIN(<queryString>, <bindVars>, "
"<options>)");

View File

@ -597,7 +597,7 @@ function synchronizeOneShard (database, shard, planId, leader) {
try {
ok = addShardFollower(ep, database, shard, lockJobId);
} catch (err4) {
db._drop(shard);
db._drop(shard, {isSystem: true });
throw err4;
}
} catch (err3) {
@ -1001,7 +1001,7 @@ function executePlanForCollections(plannedCollections) {
collections[collection].planId);
try {
db._drop(collection, {timeout:1.0});
db._drop(collection, {timeout:1.0, isSystem: true});
console.topic('heartbeat=debug', "dropping local shard '%s/%s' of '%s/%s => SUCCESS",
database,
collection,