Use ObTMArray to fix memory bloat problem caused by ObArrayImpl<oceanbase::sql::ObPxPartChMapItem>

This commit is contained in:
obdev
2023-08-09 06:42:38 +00:00
committed by ob-robot
parent 029ed46d44
commit 621c5a7784
2 changed files with 10 additions and 5 deletions

View File

@ -210,6 +210,11 @@ typedef common::ObArray<ObPxPartChMapItem,
false, /*auto free*/ false, /*auto free*/
common::ObArrayDefaultCallBack<ObPxPartChMapItem>, common::ObArrayDefaultCallBack<ObPxPartChMapItem>,
common::DefaultItemEncode<ObPxPartChMapItem> > ObPxPartChMapArray; common::DefaultItemEncode<ObPxPartChMapItem> > ObPxPartChMapArray;
typedef sql::ObTMArray<ObPxPartChMapItem,
common::ModulePageAllocator,
false, /*auto free*/
common::ObArrayDefaultCallBack<ObPxPartChMapItem>,
common::DefaultItemEncode<ObPxPartChMapItem> > ObPxPartChMapTMArray;
typedef common::hash::ObHashMap<int64_t, int64_t, common::hash::NoPthreadDefendMode> ObPxPartChMap; typedef common::hash::ObHashMap<int64_t, int64_t, common::hash::NoPthreadDefendMode> ObPxPartChMap;
@ -217,7 +222,7 @@ struct ObPxPartChInfo
{ {
ObPxPartChInfo() : part_ch_array_() {} ObPxPartChInfo() : part_ch_array_() {}
~ObPxPartChInfo() = default; ~ObPxPartChInfo() = default;
ObPxPartChMapArray part_ch_array_; ObPxPartChMapTMArray part_ch_array_;
}; };
class ObPxReceiveDataChannelMsg class ObPxReceiveDataChannelMsg

View File

@ -252,7 +252,7 @@ int ObSlaveMapRepartIdxCalcBase::init()
// p0 : [task1,task2,task3] // p0 : [task1,task2,task3]
// p1 : [task1,task2,task3] // p1 : [task1,task2,task3]
// p2 : [task4,task5] // p2 : [task4,task5]
const ObPxPartChMapArray &part_ch_array = part_ch_info_.part_ch_array_; const ObPxPartChMapTMArray &part_ch_array = part_ch_info_.part_ch_array_;
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (OB_FAIL(part_to_task_array_map_.create(max(1, part_ch_array.count()), ObModIds::OB_SQL_PX))) { if (OB_FAIL(part_to_task_array_map_.create(max(1, part_ch_array.count()), ObModIds::OB_SQL_PX))) {
LOG_WARN("fail create part to task array map", "count", part_ch_array.count(), K(ret)); LOG_WARN("fail create part to task array map", "count", part_ch_array.count(), K(ret));
@ -518,7 +518,7 @@ int ObRepartSliceIdxCalc::setup_one_side_one_level_info()
int ObRepartSliceIdxCalc::build_repart_ch_map(ObPxPartChMap &affinity_map) int ObRepartSliceIdxCalc::build_repart_ch_map(ObPxPartChMap &affinity_map)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
const ObPxPartChMapArray &part_ch_array = part_ch_info_.part_ch_array_; const ObPxPartChMapTMArray &part_ch_array = part_ch_info_.part_ch_array_;
if (OB_FAIL(affinity_map.create(max(1, part_ch_array.count()), ObModIds::OB_SQL_PX))) { if (OB_FAIL(affinity_map.create(max(1, part_ch_array.count()), ObModIds::OB_SQL_PX))) {
LOG_WARN("fail create hashmap", "count", part_ch_array.count(), K(ret)); LOG_WARN("fail create hashmap", "count", part_ch_array.count(), K(ret));
} }
@ -580,7 +580,7 @@ int ObSlaveMapBcastIdxCalc::get_slice_indexes(const ObIArray<ObExpr*> &exprs,
LOG_WARN("failed to push back slice idx", K(ret)); LOG_WARN("failed to push back slice idx", K(ret));
} }
} else { } else {
const ObPxPartChMapArray &part_ch_array = part_ch_info_.part_ch_array_; const ObPxPartChMapTMArray &part_ch_array = part_ch_info_.part_ch_array_;
ARRAY_FOREACH (part_ch_array, idx) { ARRAY_FOREACH (part_ch_array, idx) {
if (tablet_id == part_ch_array.at(idx).first_) { if (tablet_id == part_ch_array.at(idx).first_) {
if (OB_FAIL(slice_idx_array.push_back(part_ch_array.at(idx).second_))) { if (OB_FAIL(slice_idx_array.push_back(part_ch_array.at(idx).second_))) {
@ -1134,7 +1134,7 @@ int ObSlaveMapPkeyHashIdxCalc::build_affi_hash_map(hash::ObHashMap<int64_t, ObPx
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
int64_t tablet_id = common::OB_INVALID_INDEX_INT64; int64_t tablet_id = common::OB_INVALID_INDEX_INT64;
ObPxPartChMapItem item; ObPxPartChMapItem item;
const ObPxPartChMapArray &part_ch_array = part_ch_info_.part_ch_array_; const ObPxPartChMapTMArray &part_ch_array = part_ch_info_.part_ch_array_;
if (OB_FAIL(affi_hash_map.create(part_ch_array.count(), common::ObModIds::OB_SQL_PX))) { if (OB_FAIL(affi_hash_map.create(part_ch_array.count(), common::ObModIds::OB_SQL_PX))) {
LOG_WARN("failed to create part ch map", K(ret)); LOG_WARN("failed to create part ch map", K(ret));
} }