Call engine tx cache cleanup
Summary: After the commit log was cleared there was some transaction that tried to acquire a lock on an object that was taken by a transaction that was not longer active on the worker. Inquring the commit log about that transaction causes a crash since the commit log is cleared of that transaction. Solution is to clear the transaction cache before clearing the commit log, which forces the transactions to release their locks and as such their ids will never be queried through the commit log in the future. Reviewers: florijan, msantl Reviewed By: msantl Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1342
This commit is contained in:
parent
7b88e514b8
commit
29234067d9
@ -4,6 +4,7 @@
|
||||
#include "database/storage_gc.hpp"
|
||||
#include "distributed/storage_gc_rpc_messages.hpp"
|
||||
|
||||
#include "transactions/engine_worker.hpp"
|
||||
#include "transactions/transaction.hpp"
|
||||
|
||||
namespace database {
|
||||
@ -19,6 +20,13 @@ class StorageGcWorker : public StorageGc {
|
||||
void CollectCommitLogGarbage(tx::transaction_id_t oldest_active) final {
|
||||
auto safe_to_delete = GetClogSafeTransaction(oldest_active);
|
||||
if (safe_to_delete) {
|
||||
// We first need to delete transactions that we can delete to be sure that
|
||||
// the locks are released as well. Otherwise some new transaction might
|
||||
// try to aquire a lock which hasn't been released (if the transaction
|
||||
// cache cleaner was not scheduled at this time), and take a look into the
|
||||
// commit log which no longer contains that transaction id
|
||||
dynamic_cast<tx::WorkerEngine &>(tx_engine_)
|
||||
.ClearTransactionalCache(*safe_to_delete);
|
||||
master_client_pool_.Call<distributed::RanLocalGcRpc>(*safe_to_delete,
|
||||
worker_id_);
|
||||
tx_engine_.GarbageCollectCommitLog(*safe_to_delete);
|
||||
|
Loading…
Reference in New Issue
Block a user