Remove is_transaction_starter_
from Storage::Accessor
Reviewers: mferencevic, mtomic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2308
This commit is contained in:
parent
d263d0887f
commit
b8e964a82d
src/storage/v2
@ -302,22 +302,19 @@ Storage::Accessor::Accessor(Storage *storage, uint64_t transaction_id,
|
||||
uint64_t start_timestamp)
|
||||
: storage_(storage),
|
||||
transaction_(transaction_id, start_timestamp),
|
||||
is_transaction_starter_(true),
|
||||
is_transaction_active_(true),
|
||||
storage_guard_(storage_->main_lock_) {}
|
||||
|
||||
Storage::Accessor::Accessor(Accessor &&other) noexcept
|
||||
: storage_(other.storage_),
|
||||
transaction_(std::move(other.transaction_)),
|
||||
is_transaction_starter_(true),
|
||||
is_transaction_active_(other.is_transaction_active_) {
|
||||
CHECK(other.is_transaction_starter_) << "The original accessor isn't valid!";
|
||||
// Don't allow the other accessor to abort our transaction.
|
||||
other.is_transaction_starter_ = false;
|
||||
// Don't allow the other accessor to abort our transaction in destructor.
|
||||
other.is_transaction_active_ = false;
|
||||
}
|
||||
|
||||
Storage::Accessor::~Accessor() {
|
||||
if (is_transaction_starter_ && is_transaction_active_) {
|
||||
if (is_transaction_active_) {
|
||||
Abort();
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,6 @@ class Storage final {
|
||||
private:
|
||||
Storage *storage_;
|
||||
Transaction transaction_;
|
||||
bool is_transaction_starter_;
|
||||
bool is_transaction_active_;
|
||||
|
||||
std::shared_lock<utils::RWLock> storage_guard_;
|
||||
|
Loading…
Reference in New Issue
Block a user