1
0
Fork 0

cleanup v8 expressions in coordinator, too

This commit is contained in:
Jan Steemann 2014-10-23 22:22:15 +02:00
parent ed07ba2fc0
commit 6dfe652d56
3 changed files with 9 additions and 3 deletions

View File

@ -1080,10 +1080,15 @@ AstNode* Ast::createArithmeticResultNode (double value) {
AstNode* Ast::executeConstExpression (AstNode const* node) {
// must enter v8 before we can execute any expression
v8::HandleScope scope; // do not delete this!
_query->enterContext();
v8::HandleScope scope; // do not delete this!
TRI_json_t* result = _query->executor()->executeExpression(node);
// context is not left here, but later
// this allows re-using the same context for multiple expressions
if (result == nullptr) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_OUT_OF_MEMORY);
}

View File

@ -957,7 +957,7 @@ bool IndexRangeBlock::readIndex () {
// must invalidate the expression now as we might be called from
// different threads
if (ExecutionEngine::isDBServer()) {
if (ExecutionEngine::isDBServer() || ExecutionEngine::isCoordinator()) {
for (auto e : _allVariableBoundExpressions) {
e->invalidate();
}
@ -1915,7 +1915,7 @@ void CalculationBlock::doEvaluation (AqlItemBlock* result) {
[&]() -> void {
// must invalidate the expression now as we might be called from
// different threads
if (ExecutionEngine::isDBServer()) {
if (ExecutionEngine::isDBServer() || ExecutionEngine::isCoordinator()) {
_expression->invalidate();
}
engine->getQuery()->exitContext();

View File

@ -82,6 +82,7 @@ Expression::Expression (Ast* ast,
Expression::~Expression () {
if (_type == V8) {
delete _func;
_func = nullptr;
}
else if (_type == JSON) {
TRI_ASSERT(_data != nullptr);