Skip to content

Commit

Permalink
mark single-statement select txn read-only (cmu-db#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmwnshn committed Jun 11, 2018
1 parent 8b1531b commit 467834c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/traffic_cop/traffic_cop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ executor::ExecutionResult TrafficCop::ExecuteHelper(
// new txn, reset result status
curr_state.second = ResultType::SUCCESS;
single_statement_txn_ = true;
txn = txn_manager.BeginTransaction(thread_id);
// txn is read-only for single-statement select
bool read_only = statement_->GetQueryType() == QueryType::QUERY_SELECT;
txn = txn_manager.BeginTransaction(read_only, thread_id);
tcop_txn_state_.emplace(txn, ResultType::SUCCESS);
}

Expand Down

0 comments on commit 467834c

Please sign in to comment.