fix runtime filter memory leak
This commit is contained in:
@ -149,12 +149,18 @@ void ObPxSqcHandler::release_handler(ObPxSqcHandler *sqc_handler, int &report_re
|
||||
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "Get null sqc handler", K(sqc_handler));
|
||||
} else if (FALSE_IT(sqc_handler->release(all_released))) {
|
||||
} else if (all_released) {
|
||||
IGNORE_RETURN sqc_handler->check_rf_leak();
|
||||
IGNORE_RETURN sqc_handler->destroy_sqc(report_ret);
|
||||
sqc_handler->reset();
|
||||
op_reclaim_free(sqc_handler);
|
||||
}
|
||||
}
|
||||
|
||||
void ObPxSqcHandler::check_rf_leak()
|
||||
{
|
||||
IGNORE_RETURN sub_coord_->destroy_shared_rf_msgs();
|
||||
}
|
||||
|
||||
int ObPxSqcHandler::init()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
@ -70,6 +70,7 @@ public:
|
||||
static constexpr const char *OP_LABEL = ObModIds::ObModIds::OB_SQL_SQC_HANDLER;
|
||||
static ObPxSqcHandler *get_sqc_handler();
|
||||
static void release_handler(ObPxSqcHandler *sqc_handler, int &report_ret);
|
||||
inline void check_rf_leak();
|
||||
void reset() ;
|
||||
void release(bool &all_released) {
|
||||
int64_t reference_count = ATOMIC_AAF(&reference_count_, -1);
|
||||
|
||||
@ -710,6 +710,20 @@ int ObPxSubCoord::try_prealloc_receive_channel(ObSqcCtx &sqc_ctx, ObPxSqcMeta &s
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObPxSubCoord::destroy_shared_rf_msgs()
|
||||
{
|
||||
for (int i = 0; i < all_shared_rf_msgs_.count(); ++i) {
|
||||
ObArray<ObP2PDatahubMsgBase *> *array_ptr =
|
||||
reinterpret_cast<ObArray<ObP2PDatahubMsgBase *> *>(all_shared_rf_msgs_.at(i));
|
||||
for (int j = 0; OB_NOT_NULL(array_ptr) && j < array_ptr->count(); ++j) {
|
||||
array_ptr->at(j)->destroy();
|
||||
}
|
||||
if (OB_NOT_NULL(array_ptr) && !array_ptr->empty()) {
|
||||
array_ptr->reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the last worker will invoke this function
|
||||
int ObPxSubCoord::end_process()
|
||||
{
|
||||
@ -730,16 +744,7 @@ int ObPxSubCoord::end_process()
|
||||
LOG_WARN("fail check task finish status", K(ret));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < all_shared_rf_msgs_.count(); ++i) {
|
||||
ObArray<ObP2PDatahubMsgBase *> *array_ptr =
|
||||
reinterpret_cast<ObArray<ObP2PDatahubMsgBase *> *>(all_shared_rf_msgs_.at(i));
|
||||
for (int j = 0; OB_NOT_NULL(array_ptr) && j < array_ptr->count(); ++j) {
|
||||
array_ptr->at(j)->destroy();
|
||||
}
|
||||
if (OB_NOT_NULL(array_ptr) && !array_ptr->empty()) {
|
||||
array_ptr->reset();
|
||||
}
|
||||
}
|
||||
void destroy_shared_rf_msgs();
|
||||
|
||||
NG_TRACE(tag3);
|
||||
LOG_TRACE("exit ObPxSubCoord process", K(ret));
|
||||
|
||||
@ -87,6 +87,7 @@ public:
|
||||
const ObIArray<ObSqcTableLocationKey> &tsc_location_keys);
|
||||
int rebuild_sqc_access_table_locations();
|
||||
void set_is_single_tsc_leaf_dfo(bool flag) { is_single_tsc_leaf_dfo_ = flag; }
|
||||
void destroy_shared_rf_msgs();
|
||||
private:
|
||||
int setup_loop_proc(ObSqcCtx &sqc_ctx) const;
|
||||
int setup_op_input(ObExecContext &ctx,
|
||||
|
||||
@ -391,6 +391,10 @@ int ObRFBloomFilterMsg::deep_copy_msg(ObP2PDatahubMsgBase *&new_msg_ptr)
|
||||
} else {
|
||||
new_msg_ptr = bf_msg;
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(bf_msg)) {
|
||||
bf_msg->destroy();
|
||||
ob_free(bf_msg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -939,6 +943,10 @@ int ObRFRangeFilterMsg::deep_copy_msg(ObP2PDatahubMsgBase *&new_msg_ptr)
|
||||
new_msg_ptr = rf_msg;
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(rf_msg)) {
|
||||
rf_msg->destroy();
|
||||
ob_free(rf_msg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1331,6 +1339,10 @@ int ObRFInFilterMsg::deep_copy_msg(ObP2PDatahubMsgBase *&new_msg_ptr)
|
||||
new_msg_ptr = in_msg;
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(in_msg)) {
|
||||
in_msg->destroy();
|
||||
ob_free(in_msg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user