mirror of https://gitee.com/bigwinds/arangodb
clear traverser cache in-between (#8772)
This commit is contained in:
parent
8ab9ae96cd
commit
6ee9206e46
|
@ -26,6 +26,7 @@
|
|||
#include "Aql/Query.h"
|
||||
#include "Aql/SingleRowFetcher.h"
|
||||
#include "Graph/Traverser.h"
|
||||
#include "Graph/TraverserCache.h"
|
||||
#include "Graph/TraverserOptions.h"
|
||||
|
||||
using namespace arangodb;
|
||||
|
@ -246,6 +247,8 @@ ExecutionState TraversalExecutor::computeState() const {
|
|||
}
|
||||
|
||||
bool TraversalExecutor::resetTraverser() {
|
||||
_traverser.traverserCache()->clear();
|
||||
|
||||
// Initialize the Expressions within the options.
|
||||
// We need to find the variable and read its value here. Everything is
|
||||
// computed right now.
|
||||
|
|
|
@ -52,6 +52,12 @@ TraverserCache::TraverserCache(aql::Query* query)
|
|||
}
|
||||
|
||||
TraverserCache::~TraverserCache() {}
|
||||
|
||||
void TraverserCache::clear() {
|
||||
_stringHeap->clear();
|
||||
_persistedStrings.clear();
|
||||
_mmdr->clear();
|
||||
}
|
||||
|
||||
VPackSlice TraverserCache::lookupToken(EdgeDocumentToken const& idToken) {
|
||||
TRI_ASSERT(!ServerState::instance()->isCoordinator());
|
||||
|
|
|
@ -59,6 +59,9 @@ class TraverserCache {
|
|||
|
||||
virtual ~TraverserCache();
|
||||
|
||||
/// @brief clears all allocated memory in the underlying StringHeap
|
||||
void clear();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Inserts the real document stored within the token
|
||||
/// into the given builder.
|
||||
|
|
|
@ -48,11 +48,6 @@ class TraversalNode;
|
|||
struct Variable;
|
||||
} // namespace aql
|
||||
|
||||
namespace graph {
|
||||
class EdgeUniquenessChecker;
|
||||
class TraverserCache;
|
||||
} // namespace graph
|
||||
|
||||
namespace traverser {
|
||||
|
||||
class ClusterTraverser;
|
||||
|
|
|
@ -58,6 +58,16 @@ arangodb::velocypack::StringRef StringHeap::registerString(char const* ptr, size
|
|||
return arangodb::velocypack::StringRef(position, length);
|
||||
}
|
||||
|
||||
void StringHeap::clear() {
|
||||
_current = nullptr;
|
||||
_end = nullptr;
|
||||
|
||||
for (auto& it : _blocks) {
|
||||
delete[] it;
|
||||
}
|
||||
_blocks.clear();
|
||||
}
|
||||
|
||||
void StringHeap::merge(StringHeap&& heap) {
|
||||
_blocks.reserve(_blocks.size() + heap._blocks.size());
|
||||
_blocks.insert(_blocks.end(), heap._blocks.begin(), heap._blocks.end());
|
||||
|
|
|
@ -43,6 +43,11 @@ class StringHeap {
|
|||
arangodb::velocypack::StringRef registerString(arangodb::velocypack::StringRef const& str) {
|
||||
return registerString(str.data(), str.size());
|
||||
}
|
||||
|
||||
/// @brief clear all data from the StringHeap, not releasing any occupied memory
|
||||
/// the caller must make sure that nothing points into the data of the StringHeap
|
||||
/// when calling this method
|
||||
void clear();
|
||||
|
||||
void merge(StringHeap&& heap);
|
||||
|
||||
|
|
Loading…
Reference in New Issue