Removed one function from version_list

Summary: It wasn't used in MG, only in tests.

Reviewers: buda, dgleich, mislav.bradac

Reviewed By: mislav.bradac

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D909
This commit is contained in:
florijan 2017-10-17 09:52:13 +02:00
parent ebe3c74a84
commit 14fabe2125
3 changed files with 7 additions and 19 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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);