From e065c1e507b8dd2a6d4168e0bbf4716cdc06c3cf Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 11 Aug 2014 14:28:34 +0200 Subject: [PATCH 1/3] Fix a bug in JsonHelper about autofree. --- lib/Basics/JsonHelper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Basics/JsonHelper.h b/lib/Basics/JsonHelper.h index 58c9be800d..9aa5a238d6 100644 --- a/lib/Basics/JsonHelper.h +++ b/lib/Basics/JsonHelper.h @@ -582,7 +582,7 @@ namespace triagens { else { c._json = nullptr; } - c._autofree = AUTOFREE; + c._autofree = autofree; return c; } From 82a6459fcea103197c4d0a02e76f0a484533392c Mon Sep 17 00:00:00 2001 From: James Date: Mon, 11 Aug 2014 14:29:52 +0200 Subject: [PATCH 2/3] added skipSome method to EnumerateCollectionBlock. --- arangod/Aql/ExecutionBlock.h | 54 +++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/arangod/Aql/ExecutionBlock.h b/arangod/Aql/ExecutionBlock.h index 93aa20f282..cecdc69bd5 100644 --- a/arangod/Aql/ExecutionBlock.h +++ b/arangod/Aql/ExecutionBlock.h @@ -1013,6 +1013,58 @@ namespace triagens { return res; } +//////////////////////////////////////////////////////////////////////////////// +// skip between atLeast and atMost, returns the number actually skipped . . . +// will only return less than atLeast if there aren't atLeast many +// things to skip overall. +//////////////////////////////////////////////////////////////////////////////// + + size_t skipSome (size_t atLeast, size_t atMost) { + + size_t skipped = 0; + + if (_done) { + return skipped; + } + + while (skipped < atLeast) { + if (_buffer.empty()) { + if (! getBlock(DefaultBatchSize, DefaultBatchSize)) { + _done = true; + return skipped; + } + _pos = 0; // this is in the first block + _posInAllDocs = 0; // Note that we know _allDocs.size() > 0, + // otherwise _done would be true already + } + + // if we get here, then _buffer.front() exists + AqlItemBlock* cur = _buffer.front(); + + if (atMost > _documents.size() - _posInAllDocs) { + skipped += _documents.size() - _posInAllDocs; + _posInAllDocs = 0; + + // fetch more documents into our buffer + if (! moreDocuments()) { + // nothing more to read, re-initialize fetching of documents + initDocuments(); + if (++_pos >= cur->size()) { + _buffer.pop_front(); + delete cur; + _pos = 0; + } + } + } + else { + skipped = atMost; + _posInAllDocs += atMost; + } + } + return skipped; + } + + private: //////////////////////////////////////////////////////////////////////////////// @@ -1244,7 +1296,7 @@ namespace triagens { if (_buffer.empty()) { if (! getBlock(DefaultBatchSize, DefaultBatchSize)){ _done = true; - break; + return skipped; } _pos = 0; } From 1b088ada7f95aa3e93ff86ad042cd83a75a2d910 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 11 Aug 2014 14:30:13 +0200 Subject: [PATCH 3/3] Take out some debugging output. --- arangod/Aql/ExecutionBlock.cpp | 6 ------ arangod/Aql/ExecutionBlock.h | 3 --- 2 files changed, 9 deletions(-) diff --git a/arangod/Aql/ExecutionBlock.cpp b/arangod/Aql/ExecutionBlock.cpp index fe88a70a24..44cf336bb2 100644 --- a/arangod/Aql/ExecutionBlock.cpp +++ b/arangod/Aql/ExecutionBlock.cpp @@ -114,12 +114,6 @@ void ExecutionBlock::staticAnalysis (ExecutionBlock* super) { sq->getSubquery()->staticAnalysis(s); } v->reset(); - // Now print the result: - for (auto it : _varOverview->varInfo) { - std::cout << "Variable ID:" << it.first << " RegisterId:" - << it.second.registerId << " Depth:" << it.second.depth - << std::endl; - } } // Local Variables: diff --git a/arangod/Aql/ExecutionBlock.h b/arangod/Aql/ExecutionBlock.h index 93aa20f282..553d9b1783 100644 --- a/arangod/Aql/ExecutionBlock.h +++ b/arangod/Aql/ExecutionBlock.h @@ -1426,9 +1426,6 @@ namespace triagens { auto en = static_cast(getPlanNode()); std::unordered_set inVars = _expression->variables(); - for (auto it : inVars) { - std::cout << it->name << ":" << it->id << std::endl; - } for (auto it = inVars.begin(); it != inVars.end(); ++it) { _inVars.push_back(*it);