From c3a211fd4edf4e0ca3968395ccddd76139f7929e Mon Sep 17 00:00:00 2001 From: Mislav Bradac Date: Fri, 6 Oct 2017 14:39:11 +0200 Subject: [PATCH] Add message to HintedAbortError Reviewers: mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D868 --- src/database/graph_db.cpp | 3 ++- src/query/exceptions.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/database/graph_db.cpp b/src/database/graph_db.cpp index aa01ef2e3..29847c254 100644 --- a/src/database/graph_db.cpp +++ b/src/database/graph_db.cpp @@ -43,7 +43,8 @@ GraphDb::GraphDb(const std::string &name, const fs::path &snapshot_db_dir) if (FLAGS_query_execution_time_sec != -1) { transaction_killer_.Run( - std::chrono::seconds(std::max(1, FLAGS_query_execution_time_sec / 4)), + std::chrono::seconds( + std::max(1, std::min(5, FLAGS_query_execution_time_sec / 4))), [this]() { tx_engine_.ForEachActiveTransaction([](tx::Transaction &t) { if (t.creation_time() + diff --git a/src/query/exceptions.hpp b/src/query/exceptions.hpp index de81da0ab..05848a2b8 100644 --- a/src/query/exceptions.hpp +++ b/src/query/exceptions.hpp @@ -63,13 +63,16 @@ class TypeMismatchError : public SemanticException { class HintedAbortError : public QueryException { public: using QueryException::QueryException; - HintedAbortError() : QueryException("") {} + HintedAbortError() + : QueryException( + "Transaction was asked to abort, most likely because it was " + "executing longer than time specified by " + "--query-execution-time-sec flag") {} }; class UnprovidedParameterError : public QueryException { public: using QueryException::QueryException; - UnprovidedParameterError() : QueryException("") {} }; /**