03f1547a8d
Summary: - Remove caches on workers as a result of plan expiration or race during insertion. - Extract caching functionality into a class. - Minor refactor of Interpreter::operator() - New RPC and test for it. - Rename ConsumePlanRes to DispatchPlanRes for consistency, remove return value as it's always true and never used. - Interpreter is now constructed with a `GraphDb` reference. At the moment only for reaching the `distributed::PlanDispatcher`, but in the future we should probably use that primarily for planning. I added a function to `PlanConsumer` that is only used for testing. I prefer not doing this, but I felt this needed testing. I can remove it now if you like. Reviewers: teon.banek, msantl Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1292
33 lines
879 B
C++
33 lines
879 B
C++
#include <glog/logging.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "communication/result_stream_faker.hpp"
|
|
#include "query/exceptions.hpp"
|
|
#include "query/interpreter.hpp"
|
|
|
|
DECLARE_int32(query_execution_time_sec);
|
|
|
|
TEST(TransactionTimeout, TransactionTimeout) {
|
|
FLAGS_query_execution_time_sec = 3;
|
|
database::SingleNode db;
|
|
query::Interpreter interpreter{db};
|
|
auto interpret = [&](auto &dba, const std::string &query) {
|
|
ResultStreamFaker stream;
|
|
interpreter(query, dba, {}, false).PullAll(stream);
|
|
|
|
};
|
|
{
|
|
database::GraphDbAccessor dba(db);
|
|
interpret(dba, "MATCH (n) RETURN n");
|
|
}
|
|
{
|
|
database::GraphDbAccessor dba(db);
|
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
|
ASSERT_THROW(interpret(dba, "MATCH (n) RETURN n"), query::HintedAbortError);
|
|
}
|
|
{
|
|
database::GraphDbAccessor dba(db);
|
|
interpret(dba, "MATCH (n) RETURN n");
|
|
}
|
|
}
|