patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -13,17 +13,20 @@
#define USING_LOG_PREFIX SQL_PC
#include "ob_ps_cache_callback.h"
namespace oceanbase {
using namespace common;
namespace sql {
void ObPsStmtItemRefAtomicOp::operator()(const PsStmtIdKV& entry)
namespace oceanbase
{
using namespace common;
namespace sql
{
void ObPsStmtItemRefAtomicOp::operator()(const PsStmtIdKV &entry)
{
if (NULL != entry.second) {
if (entry.second->check_erase_inc_ref_count()) {
if (entry.second->check_erase_inc_ref_count()) {//已经被其他线程标记位
callback_ret_ = OB_EAGAIN;
LOG_INFO("element will be free, try again", K(entry), K(callback_ret_));
} else {
} else {//执行到该代码块时引用计数不会为0,因为operator()会受hashtable中的lock保护
callback_ret_ = OB_SUCCESS;
stmt_item_ = entry.second;
}
@ -33,7 +36,7 @@ void ObPsStmtItemRefAtomicOp::operator()(const PsStmtIdKV& entry)
}
}
int ObPsStmtItemRefAtomicOp::get_value(ObPsStmtItem*& ps_item)
int ObPsStmtItemRefAtomicOp::get_value(ObPsStmtItem *&ps_item)
{
int ret = OB_SUCCESS;
ps_item = NULL;
@ -46,7 +49,7 @@ int ObPsStmtItemRefAtomicOp::get_value(ObPsStmtItem*& ps_item)
return ret;
}
void ObPsStmtItemDerefAtomicOp::operator()(const PsStmtIdKV& entry)
void ObPsStmtItemDerefAtomicOp::operator()(const PsStmtIdKV &entry)
{
if (OB_ISNULL(entry.second)) {
ret_ = OB_HASH_NOT_EXIST;
@ -68,13 +71,13 @@ void ObPsStmtItemEraseAtomicOp::operator()(const PsStmtIdKV &entry)
}
}
void ObPsStmtInfoRefAtomicOp::operator()(const PsStmtInfoKV &entry)
void ObPsStmtInfoRefAtomicOp::operator ()(const PsStmtInfoKV &entry)
{
if (NULL != entry.second) {
if (entry.second->check_erase_inc_ref_count()) {
if (entry.second->check_erase_inc_ref_count()) {//已经被其他线程标记位
callback_ret_ = OB_EAGAIN;
LOG_INFO("element will be free, try again", K(entry), K(callback_ret_));
} else {
} else {//执行到该代码块时引用计数不会为0,因为operator()会受hashtable中的lock保护
callback_ret_ = OB_SUCCESS;
stmt_info_ = entry.second;
}
@ -84,7 +87,7 @@ void ObPsStmtInfoRefAtomicOp::operator()(const PsStmtInfoKV &entry)
}
}
int ObPsStmtInfoRefAtomicOp::get_value(ObPsStmtInfo*& ps_info)
int ObPsStmtInfoRefAtomicOp::get_value(ObPsStmtInfo *&ps_info)
{
int ret = OB_SUCCESS;
ps_info = NULL;
@ -97,7 +100,7 @@ int ObPsStmtInfoRefAtomicOp::get_value(ObPsStmtInfo*& ps_info)
return ret;
}
void ObPsStmtInfoDerefAtomicOp::operator()(const PsStmtInfoKV& entry)
void ObPsStmtInfoDerefAtomicOp::operator()(const PsStmtInfoKV &entry)
{
if (OB_ISNULL(entry.second)) {
ret_ = OB_HASH_NOT_EXIST;
@ -110,7 +113,7 @@ void ObPsStmtInfoDerefAtomicOp::operator()(const PsStmtInfoKV& entry)
}
}
void ObPsPCVSetAtomicOp::operator()(PsPlanCacheKV& entry)
void ObPsPCVSetAtomicOp::operator()(PsPlanCacheKV &entry)
{
if (NULL != entry.second) {
entry.second->inc_ref_count(ref_handle_);
@ -121,8 +124,8 @@ void ObPsPCVSetAtomicOp::operator()(PsPlanCacheKV& entry)
}
}
// get pcvs and lock
int ObPsPCVSetAtomicOp::get_value(ObPCVSet*& pcvs)
//get pcvs and lock
int ObPsPCVSetAtomicOp::get_value(ObPCVSet *&pcvs)
{
int ret = OB_SUCCESS;
pcvs = NULL;
@ -139,5 +142,5 @@ int ObPsPCVSetAtomicOp::get_value(ObPCVSet*& pcvs)
}
return ret;
}
} // namespace sql
} // namespace oceanbase
}
}