Fix direct load not release slice writer when abort task

This commit is contained in:
suz-yang
2024-01-26 02:46:52 +00:00
committed by ob-robot
parent 4f035b363d
commit a9af16f714
3 changed files with 22 additions and 2 deletions

View File

@ -77,9 +77,8 @@ void ObTableLoadStore::abort_ctx(ObTableLoadTableCtx *ctx, bool &is_stopped)
if (OB_FAIL(abort_active_trans(ctx))) { if (OB_FAIL(abort_active_trans(ctx))) {
LOG_WARN("fail to abort active trans", KR(ret)); LOG_WARN("fail to abort active trans", KR(ret));
} }
// 4. stop merger ctx->store_ctx_->insert_table_ctx_->cancel();
ctx->store_ctx_->merger_->stop(); ctx->store_ctx_->merger_->stop();
// 5. stop task_scheduler
ctx->store_ctx_->task_scheduler_->stop(); ctx->store_ctx_->task_scheduler_->stop();
is_stopped = ctx->store_ctx_->task_scheduler_->is_stopped(); is_stopped = ctx->store_ctx_->task_scheduler_->is_stopped();
} }

View File

@ -610,5 +610,25 @@ int ObDirectLoadInsertTableContext::get_tablet_context(
return ret; return ret;
} }
void ObDirectLoadInsertTableContext::cancel()
{
int ret = OB_SUCCESS;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ObDirectLoadInsertTableContext not init", KR(ret), KP(this));
} else {
FOREACH(iter, tablet_ctx_map_) {
const ObTabletID &tablet_id = iter->first;
ObDirectLoadInsertTabletContext *tablet_ctx = iter->second;
if (OB_ISNULL(tablet_ctx)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected tablet ctx is NULL", KR(ret), K(tablet_id));
} else if (OB_FAIL(tablet_ctx->cancel())) {
LOG_WARN("fail to cancel tablet ctx", KR(ret), K(tablet_id));
}
}
}
}
} // namespace storage } // namespace storage
} // namespace oceanbase } // namespace oceanbase

View File

@ -143,6 +143,7 @@ public:
int init(const ObDirectLoadInsertTableParam &param); int init(const ObDirectLoadInsertTableParam &param);
int get_tablet_context(const common::ObTabletID &tablet_id, int get_tablet_context(const common::ObTabletID &tablet_id,
ObDirectLoadInsertTabletContext *&tablet_ctx) const; ObDirectLoadInsertTabletContext *&tablet_ctx) const;
void cancel();
TO_STRING_KV(K_(param)); TO_STRING_KV(K_(param));
private: private:
int create_all_tablet_contexts(); int create_all_tablet_contexts();