From c577b8616ec303923a8ef2d4bc4fc562301fa87c Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 13 Jan 2016 13:47:03 +0100 Subject: [PATCH] allow killing of Collect operations --- arangod/Aql/CollectBlock.cpp | 15 +++++++++++++++ js/server/tests/aql-failures-noncluster.js | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/arangod/Aql/CollectBlock.cpp b/arangod/Aql/CollectBlock.cpp index 40943d7b5a..2c8cb03797 100644 --- a/arangod/Aql/CollectBlock.cpp +++ b/arangod/Aql/CollectBlock.cpp @@ -293,6 +293,11 @@ int SortedCollectBlock::getOrSkipSome(size_t atLeast, size_t atMost, while (skipped < atMost) { // read the next input row + TRI_IF_FAILURE("SortedCollectBlock::getOrSkipSomeOuter") { + THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); + } + + throwIfKilled(); // check if we were aborted bool newGroup = false; if (!isTotalAggregation) { @@ -384,6 +389,8 @@ int SortedCollectBlock::getOrSkipSome(size_t atLeast, size_t atMost, THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); } + throwIfKilled(); + emitGroup(cur, res.get(), skipped); ++skipped; res->shrink(skipped); @@ -703,6 +710,12 @@ int HashedCollectBlock::getOrSkipSome(size_t atLeast, size_t atMost, try { while (skipped < atMost) { + TRI_IF_FAILURE("HashedCollectBlock::getOrSkipSomeOuter") { + THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); + } + + throwIfKilled(); // check if we were aborted + groupValues.clear(); // for hashing simply re-use the aggregate registers, without cloning @@ -788,6 +801,8 @@ int HashedCollectBlock::getOrSkipSome(size_t atLeast, size_t atMost, TRI_IF_FAILURE("HashedCollectBlock::getOrSkipSome") { THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG); } + + throwIfKilled(); } ++skipped; diff --git a/js/server/tests/aql-failures-noncluster.js b/js/server/tests/aql-failures-noncluster.js index 27eeab2935..5b4d375074 100644 --- a/js/server/tests/aql-failures-noncluster.js +++ b/js/server/tests/aql-failures-noncluster.js @@ -145,6 +145,12 @@ function ahuacatlFailureSuite () { assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value INTO g RETURN [ key, g ]"); assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value2 INTO g RETURN [ key, g ]"); assertFailingQuery("FOR i IN 1..10000 COLLECT key = i INTO g RETURN [ key, g ]"); + + internal.debugClearFailAt(); + internal.debugSetFailAt("SortedCollectBlock::getOrSkipSomeOuter"); + assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value INTO g RETURN [ key, g ]"); + assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value2 INTO g RETURN [ key, g ]"); + assertFailingQuery("FOR i IN 1..10000 COLLECT key = i INTO g RETURN [ key, g ]"); }, //////////////////////////////////////////////////////////////////////////////// @@ -167,6 +173,12 @@ function ahuacatlFailureSuite () { assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value RETURN key"); assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value2 RETURN key"); assertFailingQuery("FOR i IN 1..10000 COLLECT key = i RETURN key"); + + internal.debugClearFailAt(); + internal.debugSetFailAt("HashedCollectBlock::getOrSkipSomeOuter"); + assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value RETURN key"); + assertFailingQuery("FOR i IN " + c.name() + " COLLECT key = i.value2 RETURN key"); + assertFailingQuery("FOR i IN 1..10000 COLLECT key = i RETURN key"); }, ////////////////////////////////////////////////////////////////////////////////