to issue<51345956>:fix memory leak when executing store procedure which has pure out complex type in ps mode
This commit is contained in:
@ -22,6 +22,7 @@
|
|||||||
#include "rpc/obmysql/packet/ompk_eof.h"
|
#include "rpc/obmysql/packet/ompk_eof.h"
|
||||||
#include "share/ob_lob_access_utils.h"
|
#include "share/ob_lob_access_utils.h"
|
||||||
#include "observer/mysql/obmp_stmt_prexecute.h"
|
#include "observer/mysql/obmp_stmt_prexecute.h"
|
||||||
|
#include "src/pl/ob_pl_user_type.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -102,6 +103,20 @@ int ObSyncCmdDriver::response_query_result(sql::ObResultSet &result,
|
|||||||
result, is_ps_protocol, has_more_result, can_retry, fetch_limit);
|
result, is_ps_protocol, has_more_result, can_retry, fetch_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ObSyncCmdDriver::free_output_row(ObMySQLResultSet &result)
|
||||||
|
{
|
||||||
|
if (OB_NOT_NULL(result.get_exec_context().get_output_row())) {
|
||||||
|
const ObNewRow *row = result.get_exec_context().get_output_row();
|
||||||
|
for (int64_t i = 0; i < row->get_count(); ++i) {
|
||||||
|
ObObj &obj = row->cells_[i];
|
||||||
|
if (obj.is_pl_extend()) {
|
||||||
|
(void)pl::ObUserDefinedType::destruct_obj(obj, &session_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ObSyncCmdDriver::response_result(ObMySQLResultSet &result)
|
int ObSyncCmdDriver::response_result(ObMySQLResultSet &result)
|
||||||
{
|
{
|
||||||
ObActiveSessionGuard::get_stat().in_sql_execution_ = true;
|
ObActiveSessionGuard::get_stat().in_sql_execution_ = true;
|
||||||
@ -138,6 +153,7 @@ int ObSyncCmdDriver::response_result(ObMySQLResultSet &result)
|
|||||||
LOG_ERROR("Not SELECT, should not have any row!!!", K(ret));
|
LOG_ERROR("Not SELECT, should not have any row!!!", K(ret));
|
||||||
} else if (OB_FAIL(response_query_result(result))) {
|
} else if (OB_FAIL(response_query_result(result))) {
|
||||||
LOG_WARN("response query result fail", K(ret));
|
LOG_WARN("response query result fail", K(ret));
|
||||||
|
free_output_row(result);
|
||||||
int cret = result.close();
|
int cret = result.close();
|
||||||
if (cret != OB_SUCCESS) {
|
if (cret != OB_SUCCESS) {
|
||||||
LOG_WARN("close result set fail", K(cret));
|
LOG_WARN("close result set fail", K(cret));
|
||||||
@ -160,7 +176,7 @@ int ObSyncCmdDriver::response_result(ObMySQLResultSet &result)
|
|||||||
// for CRUD SQL
|
// for CRUD SQL
|
||||||
// must be called before result.close()
|
// must be called before result.close()
|
||||||
process_schema_version_changes(result);
|
process_schema_version_changes(result);
|
||||||
|
free_output_row(result);
|
||||||
if (OB_FAIL(result.close())) {
|
if (OB_FAIL(result.close())) {
|
||||||
LOG_WARN("close result set fail", K(ret));
|
LOG_WARN("close result set fail", K(ret));
|
||||||
} else if (!result.is_with_rows()
|
} else if (!result.is_with_rows()
|
||||||
|
|||||||
@ -58,6 +58,7 @@ private:
|
|||||||
int process_schema_version_changes(const ObMySQLResultSet &result);
|
int process_schema_version_changes(const ObMySQLResultSet &result);
|
||||||
int check_and_refresh_schema(uint64_t tenant_id);
|
int check_and_refresh_schema(uint64_t tenant_id);
|
||||||
int response_query_result(ObMySQLResultSet &result);
|
int response_query_result(ObMySQLResultSet &result);
|
||||||
|
void free_output_row(ObMySQLResultSet &result);
|
||||||
/* variables */
|
/* variables */
|
||||||
/* const */
|
/* const */
|
||||||
/* disallow copy & assign */
|
/* disallow copy & assign */
|
||||||
|
|||||||
Reference in New Issue
Block a user