Merge branch 'master' of https://github.com/shuangzi52/ob4 into fix_new_05

This commit is contained in:
csch
2023-09-11 10:18:26 +08:00
506 changed files with 10453 additions and 5996 deletions

View File

@ -97,7 +97,7 @@ OB_DEF_DESERIALIZE(ObDynamicSamplePieceMsg)
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
ObChunkDatumStore *tmp_store = new (tmp_buf) ObChunkDatumStore;
ObChunkDatumStore *tmp_store = new (tmp_buf) ObChunkDatumStore("DYN_SAMPLE_CTX");
if (OB_FAIL(tmp_store->deserialize(buf, data_len, pos))) {
LOG_WARN("deserialize datum store failed", K(ret), K(i));
} else if (OB_FAIL(row_stores_.push_back(tmp_store))) {
@ -306,7 +306,7 @@ int ObDynamicSamplePieceMsgCtx::init(const ObIArray<uint64_t> &tablet_ids)
LOG_WARN("allocate memory failed", K(ret), K(tablet_ids.count()));
}
for (int64_t i = 0; OB_SUCC(ret) && i < tablet_ids.count(); ++i) {
ObChunkDatumStore *sample_store = new (buf + i * sizeof(ObChunkDatumStore)) ObChunkDatumStore;
ObChunkDatumStore *sample_store = new (buf + i * sizeof(ObChunkDatumStore)) ObChunkDatumStore("DYN_SAMPLE_CTX");
if (OB_FAIL(sample_store->init(0, tenant_id_, ObCtxIds::DEFAULT_CTX_ID,
"DYN_SAMPLE_CTX", false/*enable dump*/))) {
LOG_WARN("init sample chunk store failed", K(ret), K(i));

View File

@ -76,7 +76,7 @@ public:
using WholeMsgProvider = ObWholeMsgProvider<ObWinbufWholeMsg>;
public:
ObWinbufWholeMsg() : ready_state_(0), is_empty_(true), is_datum_(false),
row_store_(), datum_store_(), assign_allocator_()
row_store_(), datum_store_("PXDhWinbuf"), assign_allocator_()
{}
~ObWinbufWholeMsg() = default;
int assign(const ObWinbufWholeMsg &other, common::ObIAllocator *allocator = NULL);

View File

@ -514,7 +514,7 @@ int ObPxDistTransmitOp::build_row_sample_piece_msg(int64_t expected_range_count,
int64_t tenant_id = ctx_.get_my_session()->get_effective_tenant_id();
ObChunkDatumStore *sample_store = OB_NEWx(ObChunkDatumStore, (&ctx_.get_allocator()));
ObChunkDatumStore *sample_store = OB_NEWx(ObChunkDatumStore, &ctx_.get_allocator(), "DYN_SAMPLE_CTX");
OV(NULL != sample_store, OB_ALLOCATE_MEMORY_FAILED);
bool sample_store_dump = false;
@ -577,7 +577,7 @@ int ObPxDistTransmitSpec::register_to_datahub(ObExecContext &ctx) const
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
ObChunkDatumStore *sample_store = new (chunk_buf) ObChunkDatumStore;
ObChunkDatumStore *sample_store = new (chunk_buf) ObChunkDatumStore("DYN_SAMPLE_CTX");
if (OB_FAIL(sample_store->init(0,
ctx.get_my_session()->get_effective_tenant_id(),
ObCtxIds::DEFAULT_CTX_ID, "DYN_SAMPLE_CTX", false/*enable dump*/))) {

View File

@ -512,7 +512,7 @@ int ObPxMSReceiveOp::GlobalOrderInput::create_chunk_datum_store(
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("create ra row store fail", K(ret));
} else {
row_store = new (buf) ObChunkDatumStore();
row_store = new (buf) ObChunkDatumStore("PxMSRecvGlobal");
// TODO: llongzhong.wlz 这里应该使用一个参数来控制row_store存储的数据量,或者SQL内存管理自动控制
int64_t mem_limit = 0;
row_store->set_allocator(*alloc_);

View File

@ -187,7 +187,7 @@ private:
public:
explicit LocalOrderInput()
: MergeSortInput(nullptr, nullptr, false),
datum_store_()
datum_store_("PxMSRecvLocal")
{
get_row_store_ = &datum_store_;
add_row_store_ = &datum_store_;

View File

@ -226,7 +226,7 @@ int ObPxRepartTransmitOp::do_repart_transmit(ObRepartSliceIdxCalc &repart_slice_
{
int ret = OB_SUCCESS;
// init the ObRepartSliceIdxCalc cache map
if (OB_FAIL(repart_slice_calc.init())) {
if (OB_FAIL(repart_slice_calc.init(ctx_.get_my_session()->get_effective_tenant_id()))) {
LOG_WARN("failed to init repart slice calc", K(ret));
} else if (OB_FAIL(send_rows(repart_slice_calc))) {
LOG_WARN("failed to send rows", K(ret));

View File

@ -752,7 +752,8 @@ int ObGranuleSplitter::split_gi_task(ObGranulePumpArgs &args,
taskset_ranges,
taskset_idxs);
} else {
ret = ObGranuleUtil::split_block_ranges(args.ctx_->get_allocator(),
ret = ObGranuleUtil::split_block_ranges(*args.ctx_,
args.ctx_->get_allocator(),
tsc,
ranges,
tablets,
@ -1321,7 +1322,8 @@ int ObPartitionWiseGranuleSplitter::split_insert_gi_task(ObGranulePumpArgs &args
LOG_WARN("failed to make whole range", K(ret));
} else if (OB_FAIL(ranges.push_back(each_partition_range))) {
LOG_WARN("failed to push partition range to ranges", K(ret));
} else if (OB_FAIL(ObGranuleUtil::split_block_ranges(args.ctx_->get_allocator(),
} else if (OB_FAIL(ObGranuleUtil::split_block_ranges(*args.ctx_,
args.ctx_->get_allocator(),
NULL,
ranges,
tablets,

View File

@ -27,6 +27,7 @@
#include "share/external_table/ob_external_table_file_mgr.h"
#include "share/external_table/ob_external_table_utils.h"
#include "sql/engine/table/ob_external_table_access_service.h"
#include "sql/das/ob_das_simple_op.h"
using namespace oceanbase::common;
using namespace oceanbase::share;
@ -132,7 +133,8 @@ int ObGranuleUtil::split_granule_for_external_table(ObIAllocator &allocator,
return ret;
}
int ObGranuleUtil::split_block_ranges(ObIAllocator &allocator,
int ObGranuleUtil::split_block_ranges(ObExecContext &exec_ctx,
ObIAllocator &allocator,
const ObTableScanSpec *tsc,//may be is null, attention use
const ObIArray<common::ObNewRange> &in_ranges,
const ObIArray<ObDASTabletLoc*> &tablets,
@ -184,7 +186,8 @@ int ObGranuleUtil::split_block_ranges(ObIAllocator &allocator,
}
}
LOG_TRACE("gi partition granule");
} else if (OB_FAIL(split_block_granule(allocator,
} else if (OB_FAIL(split_block_granule(exec_ctx,
allocator,
tsc,
ranges,
tablets,
@ -227,7 +230,8 @@ int ObGranuleUtil::remove_empty_range(const common::ObIArray<common::ObNewRange>
return ret;
}
int ObGranuleUtil::split_block_granule(ObIAllocator &allocator,
int ObGranuleUtil::split_block_granule(ObExecContext &exec_ctx,
ObIAllocator &allocator,
const ObTableScanSpec *tsc,//may be is null, attention use!
const ObIArray<ObNewRange> &input_ranges,
const ObIArray<ObDASTabletLoc*> &tablets,
@ -273,10 +277,9 @@ int ObGranuleUtil::split_block_granule(ObIAllocator &allocator,
input_store_ranges,
need_convert_new_range))) {
LOG_WARN("failed to convert new range to store range", K(ret));
} else if (OB_FAIL(access_service->get_multi_ranges_cost(tablet.ls_id_,
tablet.tablet_id_,
input_store_ranges,
partition_size))) {
} else if (OB_FAIL(ObDASSimpleUtils::get_multi_ranges_cost(exec_ctx, tablets.at(i),
input_store_ranges,
partition_size))) {
LOG_WARN("failed to get multi ranges cost", K(ret), K(tablet));
} else {
// B to MB
@ -339,7 +342,8 @@ int ObGranuleUtil::split_block_granule(ObIAllocator &allocator,
input_store_ranges,
need_convert_new_range))) {
LOG_WARN("failed to convert new range to store range", K(ret));
} else if (OB_FAIL(get_tasks_for_partition(allocator,
} else if (OB_FAIL(get_tasks_for_partition(exec_ctx,
allocator,
expected_task_cnt,
*tablet,
input_store_ranges,
@ -470,7 +474,8 @@ int ObGranuleUtil::compute_task_count_each_partition(int64_t total_size,
return ret;
}
int ObGranuleUtil::get_tasks_for_partition(ObIAllocator &allocator,
int ObGranuleUtil::get_tasks_for_partition(ObExecContext &exec_ctx,
ObIAllocator &allocator,
int64_t expected_task_cnt,
ObDASTabletLoc &tablet,
ObIArray<ObStoreRange> &input_storage_ranges,
@ -504,12 +509,11 @@ int ObGranuleUtil::get_tasks_for_partition(ObIAllocator &allocator,
if (!range_independent) {
tablet_idx++;
}
} else if (OB_FAIL(access_service->split_multi_ranges(tablet.ls_id_,
tablet.tablet_id_,
input_storage_ranges,
expected_task_cnt,
allocator,
multi_range_split_array))) {
} else if (OB_FAIL(ObDASSimpleUtils::split_multi_ranges(exec_ctx,
&tablet,
input_storage_ranges,
expected_task_cnt,
multi_range_split_array))) {
LOG_WARN("failed to split multi ranges", K(ret), K(tablet), K(expected_task_cnt));
} else {
LOG_TRACE("split multi ranges",

View File

@ -171,7 +171,8 @@ public:
* range_independent IN the random type witch affects the granule_idx
*
*/
static int split_block_ranges(common::ObIAllocator &allocator,
static int split_block_ranges(ObExecContext &exec_ctx,
common::ObIAllocator &allocator,
const ObTableScanSpec *tsc,
const common::ObIArray<common::ObNewRange> &ranges,
const common::ObIArray<ObDASTabletLoc*> &tablets,
@ -259,7 +260,8 @@ public:
* range_independent IN the random type witch affects the granule_idx
*
*/
static int split_block_granule(common::ObIAllocator &allocator,
static int split_block_granule(ObExecContext &exec_ctx,
common::ObIAllocator &allocator,
const ObTableScanSpec *tsc,
const common::ObIArray<common::ObNewRange> &input_ranges,
const common::ObIArray<ObDASTabletLoc*> &tablet_array,
@ -319,7 +321,8 @@ private:
* pkey_idx OUT the idx in granule ranges
* range_independent IN the random type witch affects the granule_idx
*/
static int get_tasks_for_partition(common::ObIAllocator &allocator,
static int get_tasks_for_partition(ObExecContext &exec_ctx,
common::ObIAllocator &allocator,
int64_t expected_task_cnt,
ObDASTabletLoc &tablet,
common::ObIArray<common::ObStoreRange> &input_storage_ranges,