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

Commit

Permalink
Skip recording READs in the RWSet. (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbutrovich authored and tli2 committed Jun 24, 2018
1 parent 55abc0c commit 29f92eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
6 changes: 1 addition & 5 deletions src/concurrency/timestamp_ordering_transaction_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ bool TimestampOrderingTransactionManager::PerformRead(TransactionContext *const
return true;

} else {
// if it's not select for update, then update read set and return true.
current_txn->RecordRead(location);
// if it's not select for update, then return true.
return true;
}

Expand Down Expand Up @@ -243,7 +242,6 @@ bool TimestampOrderingTransactionManager::PerformRead(TransactionContext *const
// a transaction can never read an uncommitted version.
if (IsOwner(current_txn, tile_group_header, tuple_id) == false) {
if (IsOwned(current_txn, tile_group_header, tuple_id) == false) {
current_txn->RecordRead(location);
return true;

} else {
Expand Down Expand Up @@ -316,8 +314,6 @@ bool TimestampOrderingTransactionManager::PerformRead(TransactionContext *const
// then attempt to set last reader cid.
if (SetLastReaderCommitId(tile_group_header, tuple_id,
current_txn->GetCommitId(), false) == true) {
// update read set.
current_txn->RecordRead(location);
return true;
} else {
// if the tuple has been owned by some concurrent transactions,
Expand Down
21 changes: 3 additions & 18 deletions src/concurrency/transaction_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,20 @@ RWType TransactionContext::GetRWType(const ItemPointer &location) {
return RWType::INVALID;
}

void TransactionContext::RecordRead(const ItemPointer &location) {
PELOTON_ASSERT(rw_set_.find(location) == rw_set_.end() ||
(rw_set_[location] != RWType::DELETE &&
rw_set_[location] != RWType::INS_DEL));
auto rw_set_it = rw_set_.find(location);
if (rw_set_it != rw_set_.end()) {
return;
}
rw_set_[location] = RWType::READ;
}

void TransactionContext::RecordReadOwn(const ItemPointer &location) {
PELOTON_ASSERT(rw_set_.find(location) == rw_set_.end() ||
(rw_set_[location] != RWType::DELETE &&
rw_set_[location] != RWType::INS_DEL));
rw_set_[location] = RWType::READ_OWN;
is_written_ = true;
}

void TransactionContext::RecordUpdate(const ItemPointer &location) {
PELOTON_ASSERT(rw_set_.find(location) == rw_set_.end() ||
(rw_set_[location] != RWType::DELETE &&
rw_set_[location] != RWType::INS_DEL));
auto rw_set_it = rw_set_.find(location);
if (rw_set_it != rw_set_.end() && (rw_set_it->second == RWType::READ ||
rw_set_it->second == RWType::READ_OWN)) {
rw_set_it->second = RWType::UPDATE;
is_written_ = true;
}
PELOTON_ASSERT(is_written_);
rw_set_[location] = RWType::UPDATE;
is_written_ = true;
}

void TransactionContext::RecordInsert(const ItemPointer &location) {
Expand Down
2 changes: 0 additions & 2 deletions src/include/concurrency/transaction_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class TransactionContext : public Printable {
index_oid, DDLType::DROP));
}

void RecordRead(const ItemPointer &);

void RecordReadOwn(const ItemPointer &);

void RecordUpdate(const ItemPointer &);
Expand Down

0 comments on commit 29f92eb

Please sign in to comment.