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

Commit 8b1531b

Browse files
committed
treat txn w/ no modifying queries as read-only (#1396:4)
1 parent e0a9348 commit 8b1531b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/concurrency/timestamp_ordering_transaction_manager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
623623
//// handle other isolation levels
624624
//////////////////////////////////////////////////////////
625625

626+
auto &rw_set = current_txn->GetReadWriteSet();
627+
628+
// if no modifying queries, treat as read-only
629+
if (rw_set.empty()) {
630+
EndTransaction(current_txn);
631+
return ResultType::SUCCESS;
632+
}
633+
626634
auto storage_manager = storage::StorageManager::GetInstance();
627635
auto &log_manager = logging::LogManager::GetInstance();
628636

@@ -631,7 +639,6 @@ ResultType TimestampOrderingTransactionManager::CommitTransaction(
631639
// generate transaction id.
632640
cid_t end_commit_id = current_txn->GetCommitId();
633641

634-
auto &rw_set = current_txn->GetReadWriteSet();
635642
auto &rw_object_set = current_txn->GetCreateDropSet();
636643

637644
auto gc_set = current_txn->GetGCSetPtr();

0 commit comments

Comments
 (0)