Skip to content

Commit 2a65ce5

Browse files
committed
fix: slight optimization for dtor mvcc
1 parent 4d4f10b commit 2a65ce5

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

txn/mvcc_storage.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ void MVCCStorage::InitStorage() {
1515
MVCCStorage::~MVCCStorage() {
1616
for (unordered_map<Key, deque<Version*>*>::iterator it = mvcc_data_.begin();
1717
it != mvcc_data_.end(); ++it) {
18-
delete it->second;
18+
auto version_list = it->second;
19+
for (auto version : *version_list) {
20+
delete version;
21+
}
22+
delete version_list;
1923
}
2024

2125
mvcc_data_.clear();

txn/txn_processor_test.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ void Benchmark(const vector<LoadGen *> &lg)
9292
mode <= MVCC;
9393
mode = static_cast<CCMode>(mode + 1))
9494
{
95+
// FILTER modes for testing
96+
// if (mode != SERIAL && mode != MVCC) {
97+
// continue;
98+
// }
9599
// Print out mode name.
96100
cout << ModeToString(mode) << flush;
97101

0 commit comments

Comments
 (0)