Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/pingcap/kv/LockResolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ class LockResolver
}
}

TxnStatus * getResolved(uint64_t txn_id)
std::optional<TxnStatus> getResolved(uint64_t txn_id)
{
std::shared_lock<std::shared_mutex> lk(mu);

auto it = resolved.find(txn_id);
if (it == resolved.end())
return nullptr;
return &(it->second);
return std::nullopt;
return it->second;
}


Expand Down
4 changes: 2 additions & 2 deletions src/kv/LockResolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ int64_t LockResolver::resolveLocksForWrite(Backoffer & bo, uint64_t caller_start

TxnStatus LockResolver::getTxnStatus(Backoffer & bo, uint64_t txn_id, const std::string & primary, uint64_t caller_start_ts, uint64_t current_ts, bool rollback_if_not_exists, bool force_sync_commit, bool is_txn_file)
{
TxnStatus * cached_status = getResolved(txn_id);
if (cached_status != nullptr)
auto cached_status = getResolved(txn_id);
if (cached_status.has_value())
{
return *cached_status;
}
Expand Down
Loading