memgraph/tests
Matija Santl 5d5dfbb6f7 Fix how HA handles leader change during commit
Summary:
During it's leadership, one peer can receive RPC messages from other peers that his reign is over.
The problem is when this happens during a transaction commit.

This is handled in the following way.
If we're the current leader and we want to commit a transaction, we need to make sure the Raft Log is replicated before we can tell the client that the transaction is committed.
During that wait, we can only notice that the replication takes too long, and we report that with `LOG(WARNING)` messages.

If we change the Raft mode during the wait, our Raft implementation will internally commit this transaction, but won't be able to acquire the Raft lock because the `db.Reset` has been called.
This is why there is an manual lock acquire. If we pick up that the `db.Reset` has been called, we throw an `UnexpectedLeaderChangeException` exception to the client.

Another thing with long running transactions, if someone decides to kill a `memgraph_ha` instance during the commit, the transaction will have `abort` hint set. This will cause the `src/query/operator.cpp` to throw a `HintedAbortError`. We need to catch this during the shutdown, because the `memgraph_ha` isn't dead from the user perspective, and the transaction wasn't aborted because it took too long, but we can differentiate between those two.

Reviewers: mferencevic, ipaljak

Reviewed By: mferencevic, ipaljak

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1956
2019-05-20 16:39:44 +02:00
..
benchmark Add SSL support to HA RPC 2019-05-20 12:53:52 +02:00
concurrent Migrate to C++17 2019-04-23 14:46:44 +02:00
distributed Improve card fraud test startup 2019-03-06 13:38:48 +01:00
drivers Integrate driver tests with Apollo 2018-08-22 18:31:37 +02:00
feature_benchmark Replace Client with HAClient in feature benchmark 2019-05-02 10:40:31 +02:00
integration Make manual HA client use the new Bolt client 2019-04-25 15:45:03 +02:00
macro_benchmark Migrate to C++17 2019-04-23 14:46:44 +02:00
manual Remove existence constraint 2019-05-15 09:48:51 +02:00
property_based Remove test_results directory from build 2019-04-25 17:20:02 +02:00
public_benchmark Update LDBC query implementation 2018-07-10 10:08:21 +02:00
qa Reimplement counter openCypher function 2019-05-16 11:09:02 +02:00
stress Reimplement counter openCypher function 2019-05-16 11:09:02 +02:00
unit Fix how HA handles leader change during commit 2019-05-20 16:39:44 +02:00
apollo_runs.py Add LCP tests 2018-10-15 11:52:20 +02:00
client-stress.sh Migrate command line args to gflgs in tests 2017-07-06 13:54:12 +02:00
CMakeLists.txt Remove test_results directory from build 2019-04-25 17:20:02 +02:00