diff --git a/src/mvcc/version_list.hpp b/src/mvcc/version_list.hpp index 4d2f5eb56..97e593b45 100644 --- a/src/mvcc/version_list.hpp +++ b/src/mvcc/version_list.hpp @@ -208,19 +208,7 @@ class VersionList { return update(old_record, t); } - void remove(tx::Transaction &t) { - DCHECK(head_ != nullptr) << "Head is nullptr on removal."; - auto record = find(t); - - CHECK(record != nullptr) << "Removing nullptr record"; - - // TODO: Is this lock and validate necessary - lock_and_validate(record, t); - remove(record, t); - } - - // TODO(flor): This should also be private but can't be right now because of - // the way graph_db_accessor works. + /** Makes the given record as being expired by the given transaction. */ void remove(T *record, tx::Transaction &t) { DCHECK(record != nullptr) << "Record is nullptr on removal."; lock_and_validate(record, t); diff --git a/tests/unit/mvcc_find_update_common.hpp b/tests/unit/mvcc_find_update_common.hpp index 238a62d38..3ef0ea851 100644 --- a/tests/unit/mvcc_find_update_common.hpp +++ b/tests/unit/mvcc_find_update_common.hpp @@ -82,8 +82,8 @@ class Mvcc : public ::testing::Test { auto t3 = engine.Begin(); \ __attribute__((unused)) int id3 = t3->id_ #define T4_BEGIN auto t4 = engine.Begin(); -#define T2_REMOVE version_list.remove(*t2) -#define T3_REMOVE version_list.remove(*t3) +#define T2_REMOVE version_list.remove(version_list.find(*t2), *t2) +#define T3_REMOVE version_list.remove(version_list.find(*t3), *t3) #define EXPECT_CRE(record, expected) EXPECT_EQ(record->tx().cre, id##expected) #define EXPECT_EXP(record, expected) EXPECT_EQ(record->tx().exp, id##expected) #define EXPECT_NXT(v1, v2) EXPECT_EQ(v1->next(), v2) diff --git a/tests/unit/mvcc_gc.cpp b/tests/unit/mvcc_gc.cpp index 5d489fc63..45db5feed 100644 --- a/tests/unit/mvcc_gc.cpp +++ b/tests/unit/mvcc_gc.cpp @@ -48,7 +48,7 @@ class MvccGcTest : public ::testing::Test { TEST_F(MvccGcTest, RemoveAndAbort) { auto t = engine.Begin(); - version_list.remove(*t); + version_list.remove(version_list.find(*t), *t); t->Abort(); auto ret = GcDeleted(); EXPECT_EQ(ret.first, false); @@ -72,7 +72,7 @@ TEST_F(MvccGcTest, UpdateAndAbort) { TEST_F(MvccGcTest, RemoveAndCommit) { auto t = engine.Begin(); - version_list.remove(*t); + version_list.remove(version_list.find(*t), *t); t->Commit(); auto ret = GcDeleted(); EXPECT_EQ(ret.first, true); @@ -100,7 +100,7 @@ TEST_F(MvccGcTest, OldestTransactionSnapshot) { // does not see the expiration and sees the record auto t1 = engine.Begin(); auto t2 = engine.Begin(); - version_list.remove(*t1); + version_list.remove(version_list.find(*t1), *t1); t1->Commit(); auto ret = GcDeleted(t2); @@ -137,7 +137,7 @@ TEST(GarbageCollector, GcClean) { // delete the only record in the version-list in transaction t2 auto t2 = engine.Begin(); - vl->remove(*t2); + vl->remove(vl->find(*t2), *t2); t2->Commit(); gc.Run(GcSnapshot(engine, nullptr), engine);