Add exception enablers and blockers (#99)

* Throw OOMException while creating vertices and edges

* Throw on indices creation

* Throw on setting a property

* Throw oom exception while recovering

* Throw exception when query engine asks for extra memory

* Block out of memor exception during skip list GC
This commit is contained in:
antonio2368
2021-02-25 16:10:42 +01:00
committed by Antonio Andelic
parent bbed7a2397
commit dee885d69c
8 changed files with 76 additions and 15 deletions

View File

@@ -26,6 +26,7 @@
#include "utils/flag_validation.hpp"
#include "utils/logging.hpp"
#include "utils/memory.hpp"
#include "utils/memory_tracker.hpp"
#include "utils/string.hpp"
#include "utils/tsc.hpp"
@@ -659,7 +660,12 @@ std::optional<ExecutionContext> PullPlan::Pull(AnyStream *stream, std::optional<
// Returns true if a result was pulled.
const auto pull_result = [&]() -> bool {
utils::MonotonicBufferResource monotonic_memory(&stack_data[0], stack_size);
// We can throw on every query because a simple queries for deleting will use only
// the stack allocated buffer.
// Also, we want to throw only when the query engine requests more memory and not the storage
// so we add the exception to the allocator.
utils::ResourceWithOutOfMemoryException resource_with_exception;
utils::MonotonicBufferResource monotonic_memory(&stack_data[0], stack_size, &resource_with_exception);
// TODO (mferencevic): Tune the parameters accordingly.
utils::PoolResource pool_memory(128, 1024, &monotonic_memory);
ctx_.evaluation_context.memory = &pool_memory;