Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit b693494

Browse files
mbutrovichtli2
authored andcommitted
Garbage collection fixes (again) (#1428)
1 parent 196f663 commit b693494

19 files changed

+1601
-372
lines changed

src/common/container/cuckoo_map.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class IndexMetric;
3232

3333
class StatementCache;
3434

35+
template <typename T>
36+
class LockFreeQueue;
37+
3538
CUCKOO_MAP_TEMPLATE_ARGUMENTS
3639
CUCKOO_MAP_TYPE::CuckooMap() {}
3740

@@ -125,4 +128,8 @@ template class CuckooMap<std::shared_ptr<oid_t>, std::shared_ptr<oid_t>>;
125128
// Used in StatementCacheManager
126129
template class CuckooMap<StatementCache *, StatementCache *>;
127130

131+
// Used in TransactionLevelGCManager
132+
template class CuckooMap<oid_t,
133+
std::shared_ptr<LockFreeQueue<ItemPointer>>>;
134+
128135
} // namespace peloton

src/common/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void PelotonInit::Initialize() {
5252
threadpool::MonoQueuePool::GetExecutionInstance().Startup();
5353

5454
int parallelism = (CONNECTION_THREAD_COUNT + 3) / 4;
55-
storage::DataTable::SetActiveTileGroupCount(parallelism);
55+
storage::DataTable::SetDefaultActiveTileGroupCount(parallelism);
5656
storage::DataTable::SetActiveIndirectionArrayCount(parallelism);
5757

5858
// start epoch.

src/common/internal_types.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,8 +3001,8 @@ std::string GCVersionTypeToString(GCVersionType type) {
30013001
case GCVersionType::ABORT_UPDATE: {
30023002
return "ABORT_UPDATE";
30033003
}
3004-
case GCVersionType::ABORT_DELETE: {
3005-
return "ABORT_DELETE";
3004+
case GCVersionType::TOMBSTONE: {
3005+
return "TOMBSTONE";
30063006
}
30073007
case GCVersionType::ABORT_INSERT: {
30083008
return "ABORT_INSERT";
@@ -3031,8 +3031,8 @@ GCVersionType StringToGCVersionType(const std::string &str) {
30313031
return GCVersionType::COMMIT_INS_DEL;
30323032
} else if (upper_str == "ABORT_UPDATE") {
30333033
return GCVersionType::ABORT_UPDATE;
3034-
} else if (upper_str == "ABORT_DELETE") {
3035-
return GCVersionType::ABORT_DELETE;
3034+
} else if (upper_str == "TOMBSTONE") {
3035+
return GCVersionType::TOMBSTONE;
30363036
} else if (upper_str == "ABORT_INSERT") {
30373037
return GCVersionType::ABORT_INSERT;
30383038
} else if (upper_str == "ABORT_INS_DEL") {

src/concurrency/timestamp_ordering_transaction_manager.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,9 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
709709
gc_set->operator[](tile_group_id)[tuple_slot] =
710710
GCVersionType::COMMIT_DELETE;
711711

712+
gc_set->operator[](new_version.block)[new_version.offset] =
713+
GCVersionType::TOMBSTONE;
714+
712715
log_manager.LogDelete(ItemPointer(tile_group_id, tuple_slot));
713716

714717
} else if (tuple_entry.second == RWType::INSERT) {
@@ -827,9 +830,11 @@ ResultType TimestampOrderingTransactionManager::AbortTransaction(
827830
// before we unlink the aborted version from version list
828831
ItemPointer *index_entry_ptr =
829832
tile_group_header->GetIndirection(tuple_slot);
830-
UNUSED_ATTRIBUTE auto res = AtomicUpdateItemPointer(
831-
index_entry_ptr, ItemPointer(tile_group_id, tuple_slot));
832-
PELOTON_ASSERT(res == true);
833+
if (index_entry_ptr) {
834+
UNUSED_ATTRIBUTE auto res = AtomicUpdateItemPointer(
835+
index_entry_ptr, ItemPointer(tile_group_id, tuple_slot));
836+
PELOTON_ASSERT(res == true);
837+
}
833838
//////////////////////////////////////////////////
834839

835840
// we should set the version before releasing the lock.
@@ -875,9 +880,11 @@ ResultType TimestampOrderingTransactionManager::AbortTransaction(
875880
// before we unlink the aborted version from version list
876881
ItemPointer *index_entry_ptr =
877882
tile_group_header->GetIndirection(tuple_slot);
878-
UNUSED_ATTRIBUTE auto res = AtomicUpdateItemPointer(
879-
index_entry_ptr, ItemPointer(tile_group_id, tuple_slot));
880-
PELOTON_ASSERT(res == true);
883+
if (index_entry_ptr) {
884+
UNUSED_ATTRIBUTE auto res = AtomicUpdateItemPointer(
885+
index_entry_ptr, ItemPointer(tile_group_id, tuple_slot));
886+
PELOTON_ASSERT(res == true);
887+
}
881888
//////////////////////////////////////////////////
882889

883890
// we should set the version before releasing the lock.
@@ -895,7 +902,7 @@ ResultType TimestampOrderingTransactionManager::AbortTransaction(
895902

896903
// add the version to gc set.
897904
gc_set->operator[](new_version.block)[new_version.offset] =
898-
GCVersionType::ABORT_DELETE;
905+
GCVersionType::TOMBSTONE;
899906

900907
} else if (tuple_entry.second == RWType::INSERT) {
901908
tile_group_header->SetBeginCommitId(tuple_slot, MAX_CID);

0 commit comments

Comments
 (0)