[FEAT MERGE] das framework optimization.
This commit is contained in:
@ -79,7 +79,10 @@ OB_DEF_DESERIALIZE(ObDASRemoteInfo)
|
||||
int ctdef_cnt = 0;
|
||||
int rtdef_cnt = 0;
|
||||
ObEvalCtx *eval_ctx = nullptr;
|
||||
ObDASTaskFactory *das_factory = ObDASSyncAccessP::get_das_factory();
|
||||
ObDASTaskFactory *das_factory =
|
||||
ObDASAsyncAccessP::get_das_factory() != nullptr
|
||||
? ObDASAsyncAccessP::get_das_factory()
|
||||
: ObDASSyncAccessP::get_das_factory();
|
||||
#if !defined(NDEBUG)
|
||||
CK(typeid(*exec_ctx_) == typeid(ObDesExecContext));
|
||||
#endif
|
||||
@ -189,9 +192,20 @@ int ObIDASTaskOp::start_das_task()
|
||||
}
|
||||
}
|
||||
}
|
||||
// no need to advance state here because this function could be called on remote executor.
|
||||
if (OB_FAIL(ret)) {
|
||||
set_task_status(ObDasTaskStatus::FAILED);
|
||||
} else {
|
||||
set_task_status(ObDasTaskStatus::FINISHED);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObIDASTaskOp::set_task_status(ObDasTaskStatus status)
|
||||
{
|
||||
task_status_ = status;
|
||||
};
|
||||
|
||||
int ObIDASTaskOp::end_das_task()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -239,7 +253,7 @@ OB_DEF_SERIALIZE(ObDASTaskArg)
|
||||
if (OB_SUCC(ret) && OB_FAIL(serialization::encode_vi64(buf, buf_len, pos, task_ops_.count()))) {
|
||||
LOG_WARN("fail to encode ob array count", K(ret));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_ops_.count(); i ++) {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < task_ops_.count(); i++) {
|
||||
OB_UNIS_ENCODE(task_ops_.at(i)->get_type());
|
||||
OB_UNIS_ENCODE(*task_ops_.at(i));
|
||||
}
|
||||
@ -252,7 +266,10 @@ OB_DEF_DESERIALIZE(ObDASTaskArg)
|
||||
ObDASOpType op_type = DAS_OP_INVALID;
|
||||
int64_t count = 0;
|
||||
ObIDASTaskOp *task_op = nullptr;
|
||||
ObDASTaskFactory *das_factory = ObDASSyncAccessP::get_das_factory();
|
||||
ObDASTaskFactory *das_factory =
|
||||
ObDASAsyncAccessP::get_das_factory() != nullptr
|
||||
? ObDASAsyncAccessP::get_das_factory()
|
||||
: ObDASSyncAccessP::get_das_factory();
|
||||
CK(OB_NOT_NULL(das_factory));
|
||||
LST_DO_CODE(OB_UNIS_DECODE,
|
||||
timeout_ts_,
|
||||
@ -302,23 +319,43 @@ OB_DEF_SERIALIZE_SIZE(ObDASTaskArg)
|
||||
|
||||
int ObDASTaskArg::add_task_op(ObIDASTaskOp *task_op)
|
||||
{
|
||||
// we currently only support single task per ObDASTaskArg.
|
||||
// TODO(roland.qk):remove this assert check after we enable DAS task aggregation.
|
||||
OB_ASSERT(task_ops_.count() == 0);
|
||||
return task_ops_.push_back(task_op);
|
||||
}
|
||||
|
||||
ObIDASTaskOp *ObDASTaskArg::get_task_op()
|
||||
{
|
||||
OB_ASSERT(task_ops_.count() == 1);
|
||||
return task_ops_.at(0);
|
||||
}
|
||||
|
||||
int ObIDASTaskOp::state_advance()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
OB_ASSERT(cur_agg_list_ != nullptr);
|
||||
OB_ASSERT(task_status_ != ObDasTaskStatus::UNSTART);
|
||||
if (task_status_ == ObDasTaskStatus::FINISHED) {
|
||||
if (OB_FAIL(get_agg_tasks()->move_to_success_tasks(this))) {
|
||||
LOG_WARN("failed to move task to success tasks", KR(ret));
|
||||
}
|
||||
} else if (task_status_ == ObDasTaskStatus::FAILED) {
|
||||
if (OB_FAIL(get_agg_tasks()->move_to_failed_tasks(this))) {
|
||||
LOG_WARN("failed to move task to success tasks", KR(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid task state",KR(ret), K_(task_status));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ObDASTaskResp::ObDASTaskResp()
|
||||
: has_more_(false),
|
||||
ctrl_svr_(),
|
||||
runner_svr_(),
|
||||
op_results_()
|
||||
op_results_(),
|
||||
rcode_(),
|
||||
trans_result_(),
|
||||
das_factory_(nullptr),
|
||||
rpc_rcode_(OB_SUCCESS)
|
||||
{
|
||||
}
|
||||
|
||||
@ -381,21 +418,23 @@ OB_DEF_DESERIALIZE(ObDASTaskResp)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t count = 0;
|
||||
ObIDASTaskResult *op_result = nullptr;
|
||||
LST_DO_CODE(OB_UNIS_DECODE,
|
||||
has_more_,
|
||||
ctrl_svr_,
|
||||
runner_svr_);
|
||||
if (OB_SUCC(ret) && OB_FAIL(serialization::decode_vi64(buf, data_len, pos, &count))) {
|
||||
LOG_WARN("fail to decode ob array count", K(ret));
|
||||
} else if (count != op_results_.count()) {
|
||||
} else if (count > op_results_.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("receive das task response count mismatch", K(count), K(op_results_.count()));
|
||||
}
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < count; i ++) {
|
||||
if (OB_ISNULL(op_results_.at(i))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("op result is nullptr", K(ret), K_(op_results));
|
||||
} else if (OB_FAIL(serialization::decode(buf, data_len, pos, *op_results_.at(i)))) {
|
||||
while (op_results_.count() > count) {
|
||||
op_results_.pop_back();
|
||||
}
|
||||
OB_ASSERT(op_results_.count() == count);
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < count; i++) {
|
||||
if (OB_FAIL(serialization::decode(buf, data_len, pos, *op_results_.at(i)))) {
|
||||
LOG_WARN("fail to decode array item", K(ret), K(i), K(count));
|
||||
}
|
||||
}
|
||||
@ -424,18 +463,9 @@ OB_DEF_SERIALIZE_SIZE(ObDASTaskResp)
|
||||
|
||||
int ObDASTaskResp::add_op_result(ObIDASTaskResult *op_result)
|
||||
{
|
||||
// we currently only support single task per ObDASTaskResp.
|
||||
// TODO(roland.qk):remove this assert check after we enable DAS task aggregation.
|
||||
OB_ASSERT(op_results_.count() == 0);
|
||||
return op_results_.push_back(op_result);
|
||||
}
|
||||
|
||||
ObIDASTaskResult *ObDASTaskResp::get_op_result()
|
||||
{
|
||||
OB_ASSERT(op_results_.count() == 1);
|
||||
return op_results_.at(0);
|
||||
}
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObIDASTaskResult, task_id_);
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObDASDataFetchReq, tenant_id_, task_id_);
|
||||
|
||||
Reference in New Issue
Block a user