diff --git a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp index d849083247..a75d5ec913 100644 --- a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp +++ b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp @@ -1756,14 +1756,14 @@ int ObTabletDirectLoadMgr::close_sstable_slice( ObTabletObjLoadHelper::free(arena_allocator, storage_schema); } if (OB_NOT_NULL(slice_writer)) { - if (is_data_direct_load(direct_load_type_) && slice_writer->need_column_store()) { + if (OB_SUCC(ret) && is_data_direct_load(direct_load_type_) && slice_writer->need_column_store()) { //ignore, free after rescan } else { int tmp_ret = OB_SUCCESS; if (OB_TMP_FAIL(sqc_build_ctx_.slice_mgr_map_.erase_refactored(slice_info.slice_id_))) { LOG_ERROR("erase failed", K(ret), K(tmp_ret), K(slice_info)); } else { - LOG_INFO("erase a slice writer", KP(slice_writer), K(sqc_build_ctx_.slice_mgr_map_.size())); + LOG_INFO("erase a slice writer", K(ret), KP(slice_writer), K(sqc_build_ctx_.slice_mgr_map_.size())); slice_writer->~ObDirectLoadSliceWriter(); sqc_build_ctx_.slice_writer_allocator_.free(slice_writer); slice_writer = nullptr; diff --git a/src/storage/ddl/ob_direct_load_struct.cpp b/src/storage/ddl/ob_direct_load_struct.cpp index 853c6f0155..a78d50f900 100644 --- a/src/storage/ddl/ob_direct_load_struct.cpp +++ b/src/storage/ddl/ob_direct_load_struct.cpp @@ -1111,7 +1111,7 @@ int ObDirectLoadSliceWriter::fill_column_group(const ObStorageSchema *storage_sc if (OB_FAIL(cur_writer->init(storage_schema, cg_idx, tablet_direct_load_mgr_, start_seq_, row_offset_, start_scn))) { LOG_WARN("init co ddl writer failed", K(ret), KPC(cur_writer), K(cg_idx), KPC(this)); } else { - sql::ObCompactStore * cur_datum_store = chunk_slice_store->datum_stores_.at(cg_idx); + sql::ObCompactStore *cur_datum_store = chunk_slice_store->datum_stores_.at(cg_idx); const ObChunkDatumStore::StoredRow *stored_row = nullptr; bool has_next = false; while (OB_SUCC(ret) && OB_SUCC(cur_datum_store->has_next(has_next)) && has_next) { @@ -1139,6 +1139,9 @@ int ObDirectLoadSliceWriter::fill_column_group(const ObStorageSchema *storage_sc // 3. close writers if (OB_FAIL(cur_writer->close())) { LOG_WARN("close co ddl writer failed", K(ret)); + } else { + // 4. reset datum store (if fail, datum store will free when ~ObDirectLoadSliceWriter()) + cur_datum_store->reset(); } } }