From 467834ca5cf6ae3182755220c9a0b4906cf85cbc Mon Sep 17 00:00:00 2001 From: Wan Shen Lim Date: Mon, 11 Jun 2018 14:58:37 -0400 Subject: [PATCH] mark single-statement select txn read-only (#1395) --- src/traffic_cop/traffic_cop.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/traffic_cop/traffic_cop.cpp b/src/traffic_cop/traffic_cop.cpp index 7bfffebb4c0..5b7bce864f2 100644 --- a/src/traffic_cop/traffic_cop.cpp +++ b/src/traffic_cop/traffic_cop.cpp @@ -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); }