fix direct load memory leak when timeout
This commit is contained in:
@ -108,37 +108,36 @@ int ObTableDirectInsertService::open_task(const uint64_t table_id, const int64_t
|
||||
}
|
||||
|
||||
int ObTableDirectInsertService::close_task(const uint64_t table_id,
|
||||
const int64_t task_id,
|
||||
const int error_code)
|
||||
const int64_t task_id,
|
||||
const int error_code)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTableLoadTableCtx *table_ctx = nullptr;
|
||||
ObTableLoadKey key(MTL_ID(), table_id);
|
||||
if (OB_FAIL(ObTableLoadService::get_ctx(key, table_ctx))) {
|
||||
LOG_WARN("fail to get table ctx", KR(ret), K(key), K(table_id));
|
||||
} else {
|
||||
table::ObTableLoadTransId trans_id;
|
||||
trans_id.segment_id_ = task_id;
|
||||
trans_id.trans_gid_ = 1;
|
||||
ObTableLoadStore store(table_ctx);
|
||||
if (OB_FAIL(store.init())) {
|
||||
LOG_WARN("fail to init store", KR(ret));
|
||||
if (OB_SUCC(error_code)) {
|
||||
ObTableLoadTableCtx *table_ctx = nullptr;
|
||||
ObTableLoadKey key(MTL_ID(), table_id);
|
||||
if (OB_FAIL(ObTableLoadService::get_ctx(key, table_ctx))) {
|
||||
LOG_WARN("fail to get table ctx", KR(ret), K(key), K(table_id));
|
||||
} else {
|
||||
if (OB_SUCC(error_code)) {
|
||||
if (OB_FAIL(store.px_finish_trans(trans_id))) {
|
||||
LOG_WARN("fail to finish direct load trans", KR(ret), K(trans_id));
|
||||
}
|
||||
table::ObTableLoadTransId trans_id;
|
||||
trans_id.segment_id_ = task_id;
|
||||
trans_id.trans_gid_ = 1;
|
||||
ObTableLoadStore store(table_ctx);
|
||||
if (OB_FAIL(store.init())) {
|
||||
LOG_WARN("fail to init store", KR(ret));
|
||||
} else if (OB_FAIL(store.px_finish_trans(trans_id))) {
|
||||
LOG_WARN("fail to finish direct load trans", KR(ret), K(trans_id));
|
||||
}
|
||||
if (OB_FAIL(ret)){
|
||||
if (OB_FAIL(store.px_abandon_trans(trans_id))) {
|
||||
LOG_WARN("fail to abandon direct load trans", KR(ret));
|
||||
if (OB_FAIL(ret)) {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_TMP_FAIL(ObTableLoadStore::px_abandon_trans(table_ctx, trans_id))) {
|
||||
LOG_WARN("fail to abandon direct load trans", KR(tmp_ret), K(trans_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_NOT_NULL(table_ctx)) {
|
||||
ObTableLoadService::put_ctx(table_ctx);
|
||||
table_ctx = nullptr;
|
||||
if (OB_NOT_NULL(table_ctx)) {
|
||||
ObTableLoadService::put_ctx(table_ctx);
|
||||
table_ctx = nullptr;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user