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

Commit 467834c

Browse files
committed
mark single-statement select txn read-only (#1395)
1 parent 8b1531b commit 467834c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/traffic_cop/traffic_cop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ executor::ExecutionResult TrafficCop::ExecuteHelper(
164164
// new txn, reset result status
165165
curr_state.second = ResultType::SUCCESS;
166166
single_statement_txn_ = true;
167-
txn = txn_manager.BeginTransaction(thread_id);
167+
// txn is read-only for single-statement select
168+
bool read_only = statement_->GetQueryType() == QueryType::QUERY_SELECT;
169+
txn = txn_manager.BeginTransaction(read_only, thread_id);
168170
tcop_txn_state_.emplace(txn, ResultType::SUCCESS);
169171
}
170172

0 commit comments

Comments
 (0)