Skip to content

Commit 459920f

Browse files
authored
Fix empty select list core dump (#678)
### What problem does this PR solve? Empty select list will introduce core dump in thrift server. Issue link:#672 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: jinhai <haijin.chn@gmail.com>
1 parent 80a1b75 commit 459920f

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/network/thrift_server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class InfinityServiceHandler : virtual public infinity_thrift_rpc::InfinityServi
353353
// auto start2 = std::chrono::steady_clock::now();
354354

355355
// select list
356-
if (request.__isset.select_list == false) {
356+
if (request.__isset.select_list == false or request.select_list.empty()) {
357357
ProcessStatus(response, Status::EmptySelectFields());
358358
return;
359359
}

src/storage/txn/txn_manager.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Txn *TxnManager::CreateTxn() {
4646
UnrecoverableError("TxnManager is not running, cannot create txn");
4747
}
4848
rw_locker_.lock();
49-
u64 new_txn_id = GetNewTxnID();
49+
TransactionID new_txn_id = GetNewTxnID();
5050
UniquePtr<Txn> new_txn = MakeUnique<Txn>(this, buffer_mgr_, catalog_, bg_task_processor_, new_txn_id);
5151
Txn *res = new_txn.get();
5252
txn_map_[new_txn_id] = std::move(new_txn);
@@ -62,10 +62,7 @@ Txn *TxnManager::GetTxn(TransactionID txn_id) {
6262
}
6363

6464
TxnState TxnManager::GetTxnState(TransactionID txn_id) {
65-
std::shared_lock<std::shared_mutex> r_locker(rw_locker_);
66-
Txn *txn_ptr = txn_map_[txn_id].get();
67-
TxnState res = txn_ptr->GetTxnState();
68-
return res;
65+
return GetTxn(txn_id)->GetTxnState();
6966
}
7067

7168
u64 TxnManager::GetNewTxnID() {

0 commit comments

Comments
 (0)