2017-07-14 19:58:25 +08:00
|
|
|
#include <glog/logging.h>
|
2017-12-22 20:39:31 +08:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2017-07-14 19:58:25 +08:00
|
|
|
#include "communication/result_stream_faker.hpp"
|
|
|
|
#include "query/exceptions.hpp"
|
Flags cleanup and QueryEngine removal
Summary:
I started with cleaning flags up (removing unused ones, documenting undocumented ones). There were some flags to remove in `QueryEngine`. Seeing how we never use hardcoded queries (AFAIK last Mislav's testing also indicated they aren't faster then interpretation), when removing those unused flags the `QueryEngine` becomes obsolete. That means that a bunch of other stuff becomes obsolete, along with the hardcoded queries. So I removed it all (this has been discussed and approved on the daily).
Some flags that were previously undocumented in `docs/user_technical/installation` are now documented. The following flags are NOT documented and in my opinion should not be displayed when starting `./memgraph --help` (@mferencevic):
```
query_vertex_count_to_expand_existsing (from rule_based_planner.cpp)
query_max_plans (rule_based_planner.cpp)
```
If you think that another organization is needed w.r.t. flag visibility, comment.
@teon.banek: I had to remove some stuff from CMakeLists to make it buildable. Please review what I removed and clean up if necessary if/when this lands. If the needed changes are minor, you can also comment.
Reviewers: buda, mislav.bradac, teon.banek, mferencevic
Reviewed By: buda, mislav.bradac
Subscribers: pullbot, mferencevic, teon.banek
Differential Revision: https://phabricator.memgraph.io/D825
2017-09-22 22:17:09 +08:00
|
|
|
#include "query/interpreter.hpp"
|
2017-07-14 19:58:25 +08:00
|
|
|
|
|
|
|
DECLARE_int32(query_execution_time_sec);
|
|
|
|
|
|
|
|
TEST(TransactionTimeout, TransactionTimeout) {
|
|
|
|
FLAGS_query_execution_time_sec = 3;
|
2018-10-09 17:09:10 +08:00
|
|
|
database::GraphDb db;
|
2018-08-24 16:12:04 +08:00
|
|
|
query::Interpreter interpreter;
|
2017-12-22 20:39:31 +08:00
|
|
|
auto interpret = [&](auto &dba, const std::string &query) {
|
2019-09-11 22:10:53 +08:00
|
|
|
query::DbAccessor query_dba(&dba);
|
2018-07-02 21:34:33 +08:00
|
|
|
ResultStreamFaker<query::TypedValue> stream;
|
2019-09-11 22:10:53 +08:00
|
|
|
interpreter(query, &query_dba, {}, false, utils::NewDeleteResource())
|
2019-08-22 20:15:45 +08:00
|
|
|
.PullAll(stream);
|
2017-12-22 20:39:31 +08:00
|
|
|
};
|
|
|
|
{
|
2018-07-26 15:08:21 +08:00
|
|
|
auto dba = db.Access();
|
2019-04-15 17:36:43 +08:00
|
|
|
interpret(dba, "MATCH (n) RETURN n");
|
2017-07-14 19:58:25 +08:00
|
|
|
}
|
|
|
|
{
|
2018-07-26 15:08:21 +08:00
|
|
|
auto dba = db.Access();
|
2017-07-14 19:58:25 +08:00
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
2019-09-11 22:10:53 +08:00
|
|
|
ASSERT_THROW(interpret(dba, "MATCH (n) RETURN n"), query::HintedAbortError);
|
2017-07-14 19:58:25 +08:00
|
|
|
}
|
|
|
|
{
|
2018-07-26 15:08:21 +08:00
|
|
|
auto dba = db.Access();
|
2019-04-15 17:36:43 +08:00
|
|
|
interpret(dba, "MATCH (n) RETURN n");
|
2017-07-14 19:58:25 +08:00
|
|
|
}
|
|
|
|
}
|