Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cc/d2pl/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool TxExecutor::commit() {
case OpType::DELETE: {
// Return value intentionally ignored: a missing key still needs the
// record put on the GC queue below.
(void)Masstrees[get_storage((*itr).storage_)].remove_value((*itr).key_);
Masstrees[get_storage((*itr).storage_)].remove_value_if_present((*itr).key_);
// create information for garbage collection
gc_records_.push_back((*itr).rcdptr_);
break;
Expand Down
4 changes: 2 additions & 2 deletions cc/mocc/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ void TxExecutor::abort() {
// remove inserted records
for (auto& we : write_set_) {
if (we.op_ == OpType::INSERT) {
Masstrees[get_storage(we.storage_)].remove_value(we.key_);
Masstrees[get_storage(we.storage_)].remove_value_if_present(we.key_);
delete we.rcdptr_;
}
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ void TxExecutor::writePhase() {
maxtid.absent = true;
// Return value intentionally ignored: a missing key still needs the
// record put on the GC queue below.
(void)Masstrees[get_storage((*itr).storage_)].remove_value((*itr).key_);
Masstrees[get_storage((*itr).storage_)].remove_value_if_present((*itr).key_);
gc_records_.push_back((*itr).rcdptr_);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions cc/silo/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void TxExecutor::abort() {
// remove inserted records
for (auto& we : write_set_) {
if (we.op_ == OpType::INSERT) {
Masstrees[get_storage(we.storage_)].remove_value(we.key_);
Masstrees[get_storage(we.storage_)].remove_value_if_present(we.key_);
delete we.rcdptr_;
}
}
Expand Down Expand Up @@ -554,7 +554,7 @@ void TxExecutor::writePhase() {
maxtid.absent = true;
// Return value intentionally ignored: a missing key still needs the
// tid bump and gc_records_ push below.
(void)Masstrees[get_storage((*itr).storage_)].remove_value((*itr).key_);
Masstrees[get_storage((*itr).storage_)].remove_value_if_present((*itr).key_);
storeRelease((*itr).rcdptr_->tidword_.obj_, maxtid.obj_);
// create information for garbage collection
gc_records_.push_back((*itr).rcdptr_);
Expand Down
2 changes: 1 addition & 1 deletion cc/ss2pl/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ bool TxExecutor::commit() {
case OpType::DELETE: {
// Return value intentionally ignored: a missing key still needs the
// record put on the GC queue below.
(void)Masstrees[get_storage((*itr).storage_)].remove_value((*itr).key_);
Masstrees[get_storage((*itr).storage_)].remove_value_if_present((*itr).key_);
// create information for garbage collection
gc_records_.push_back((*itr).rcdptr_);
break;
Expand Down
4 changes: 2 additions & 2 deletions cc/tictoc/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ void TxExecutor::abort() {
// remove inserted records
for (auto& we : write_set_) {
if (we.op_ == OpType::INSERT) {
Masstrees[get_storage(we.storage_)].remove_value(we.key_);
Masstrees[get_storage(we.storage_)].remove_value_if_present(we.key_);
delete we.rcdptr_;
}
}
Expand Down Expand Up @@ -526,7 +526,7 @@ void TxExecutor::writePhase() {
result.absent = true;
// Return value intentionally ignored: a missing key still needs the
// record put on the GC queue below.
(void)Masstrees[get_storage((*itr).storage_)].remove_value((*itr).key_);
Masstrees[get_storage((*itr).storage_)].remove_value_if_present((*itr).key_);
gc_records_.emplace_back((*itr).storage_, (*itr).key_, (*itr).rcdptr_, ThLocalEpoch[thid_].obj_);
break;
}
Expand Down
6 changes: 6 additions & 0 deletions include/masstree_wrapper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ public:
return Status::WARN_NOT_FOUND;
}

// "delete if present" — discards "not found" since callers in the
// DELETE-commit path may race with concurrent deletions of the same key.
void remove_value_if_present(std::string_view key) {
(void) remove_value(key);
}

T *get_value(std::string_view key) {
unlocked_cursor_type lp(table_, key.data(), key.size());
bool found = lp.find_unlocked(*ti);
Expand Down
Loading