optimize performance

This commit is contained in:
obdev
2023-05-09 07:12:01 +00:00
committed by ob-robot
parent 7a2df88e93
commit 22c390d8e6
4 changed files with 13 additions and 6 deletions

View File

@ -212,15 +212,12 @@ int ObQueryDriver::response_query_result(ObResultSet &result,
// break; // break;
} else { } else {
LOG_DEBUG("response row succ", K(*row)); LOG_DEBUG("response row succ", K(*row));
ObArenaAllocator *allocator = NULL;
if (OB_FAIL(result.get_exec_context().get_convert_charset_allocator(allocator))) {
LOG_WARN("fail to get lob fake allocator", K(ret));
} else if (OB_NOT_NULL(allocator)) {
allocator->reset_remain_one_page();
}
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
++row_num; ++row_num;
if (0 == row_num % RESET_CONVERT_CHARSET_ALLOCATOR_EVERY_X_ROWS) {
(void) result.get_exec_context().try_reset_convert_charset_allocator();
}
} }
} }
} }

View File

@ -37,6 +37,8 @@ class ObMySQLResultSet;
class ObQueryRetryCtrl; class ObQueryRetryCtrl;
class ObQueryDriver class ObQueryDriver
{ {
public:
static const int64_t RESET_CONVERT_CHARSET_ALLOCATOR_EVERY_X_ROWS = 32;
public: public:
ObQueryDriver(const ObGlobalContext &gctx, ObQueryDriver(const ObGlobalContext &gctx,
const sql::ObSqlCtx &ctx, const sql::ObSqlCtx &ctx,

View File

@ -638,6 +638,13 @@ int ObExecContext::get_convert_charset_allocator(ObArenaAllocator *&allocator)
return ret; return ret;
} }
void ObExecContext::try_reset_convert_charset_allocator()
{
if (OB_NOT_NULL(convert_allocator_)) {
convert_allocator_->reset_remain_one_page();
}
}
int ObExecContext::get_udf_ctx_mgr(ObUdfCtxMgr *&udf_ctx_mgr) int ObExecContext::get_udf_ctx_mgr(ObUdfCtxMgr *&udf_ctx_mgr)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -159,6 +159,7 @@ public:
void reset_expr_op(); void reset_expr_op();
inline bool is_expr_op_ctx_inited() { return expr_op_size_ > 0 && NULL != expr_op_ctx_store_; } inline bool is_expr_op_ctx_inited() { return expr_op_size_ > 0 && NULL != expr_op_ctx_store_; }
int get_convert_charset_allocator(common::ObArenaAllocator *&allocator); int get_convert_charset_allocator(common::ObArenaAllocator *&allocator);
void try_reset_convert_charset_allocator();
void destroy_eval_allocator(); void destroy_eval_allocator();