Fix storage GC indices/constraints subtle race condition
Summary: In order for this race condition to cause damage, an index/constraint must be created/dropped at the exact moment that the GC is cleaning indices/constraints. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2733
This commit is contained in:
parent
2b8f068ca9
commit
9f006c1b57
@ -1147,6 +1147,11 @@ Transaction Storage::CreateTransaction() {
|
||||
}
|
||||
|
||||
void Storage::CollectGarbage() {
|
||||
// Because the garbage collector iterates through the indices and constraints
|
||||
// to clean them up, it must take the main lock for reading to make sure that
|
||||
// the indices and constraints aren't concurrently being modified.
|
||||
std::shared_lock<utils::RWLock> main_guard(main_lock_);
|
||||
|
||||
// Garbage collection must be performed in two phases. In the first phase,
|
||||
// deltas that won't be applied by any transaction anymore are unlinked from
|
||||
// the version chains. They cannot be deleted immediately, because there
|
||||
|
Loading…
Reference in New Issue
Block a user