Fix cancel of direct_load_mgr

This commit is contained in:
renju96
2024-04-29 11:59:19 +00:00
committed by ob-robot
parent cf6c0aba50
commit 556b47cc62

View File

@ -1860,20 +1860,25 @@ int ObTabletDirectLoadMgr::calc_cg_range(ObArray<ObDirectLoadSliceWriter *> &sor
return ret; return ret;
} }
int ObTabletDirectLoadMgr::cancel() struct CancelSliceWriterMapFn
{ {
public:
CancelSliceWriterMapFn() {}
int operator () (hash::HashMapPair<int64_t, ObDirectLoadSliceWriter *> &entry) {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
for (ObTabletDirectLoadBuildCtx::SLICE_MGR_MAP::const_iterator iter = sqc_build_ctx_.slice_mgr_map_.begin(); if (nullptr != entry.second) {
OB_SUCC(ret) && iter != sqc_build_ctx_.slice_mgr_map_.end(); ++iter) { LOG_INFO("slice writer cancel", K(&entry.second), "slice_id", entry.first);
ObDirectLoadSliceWriter *cur_slice = iter->second; entry.second->cancel();
if (OB_ISNULL(cur_slice)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), KP(cur_slice));
} else {
cur_slice->cancel();
}
} }
return ret; return ret;
}
};
int ObTabletDirectLoadMgr::cancel()
{
CancelSliceWriterMapFn cancel_map_fn;
sqc_build_ctx_.slice_mgr_map_.foreach_refactored(cancel_map_fn);
return OB_SUCCESS;
} }
int ObTabletDirectLoadMgr::close_sstable_slice( int ObTabletDirectLoadMgr::close_sstable_slice(