Fix direct load release tablet direct load mgr and tmp file after merge completed

This commit is contained in:
suz-yang
2023-12-28 04:42:57 +00:00
committed by ob-robot
parent 42985a118c
commit 83298f7516
14 changed files with 42 additions and 0 deletions

View File

@ -656,6 +656,11 @@ int ObTableLoadMerger::handle_merge_thread_finish(int ret_code)
if (OB_UNLIKELY(is_stop_ || has_error_)) { if (OB_UNLIKELY(is_stop_ || has_error_)) {
} else { } else {
LOG_INFO("LOAD MERGE COMPLETED"); LOG_INFO("LOAD MERGE COMPLETED");
// release tmpfile
// TODO(suzhi.yt) release all tables and merge tasks
if (!store_ctx_->is_fast_heap_table_) {
table_compact_ctx_.result_.release_all_table_data();
}
if (store_ctx_->ctx_->schema_.is_column_store_) { if (store_ctx_->ctx_->schema_.is_column_store_) {
if (OB_FAIL(build_rescan_ctx())) { if (OB_FAIL(build_rescan_ctx())) {
LOG_WARN("fail to build rescan ctx", KR(ret)); LOG_WARN("fail to build rescan ctx", KR(ret));

View File

@ -97,6 +97,14 @@ int ObTableLoadTableCompactResult::add_table(ObIDirectLoadPartitionTable *table)
return ret; return ret;
} }
void ObTableLoadTableCompactResult::release_all_table_data()
{
for (int64_t i = 0; i < all_table_array_.count(); ++i) {
ObIDirectLoadPartitionTable *table = all_table_array_.at(i);
table->release_data();
}
}
/** /**
* ObTableLoadTableCompactCtx * ObTableLoadTableCompactCtx
*/ */

View File

@ -39,6 +39,7 @@ public:
void reset(); void reset();
int init(); int init();
int add_table(storage::ObIDirectLoadPartitionTable *table); int add_table(storage::ObIDirectLoadPartitionTable *table);
void release_all_table_data();
public: public:
typedef common::ObLinkHashMap<common::ObTabletID, ObTableLoadTableCompactTabletResult> typedef common::ObLinkHashMap<common::ObTabletID, ObTableLoadTableCompactTabletResult>
TabletResultMap; TabletResultMap;

View File

@ -103,6 +103,11 @@ int ObDirectLoadExternalTable::init(const ObDirectLoadExternalTableCreateParam &
return ret; return ret;
} }
void ObDirectLoadExternalTable::release_data()
{
fragments_.reset();
}
int ObDirectLoadExternalTable::copy(const ObDirectLoadExternalTable &other) int ObDirectLoadExternalTable::copy(const ObDirectLoadExternalTable &other)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -59,6 +59,7 @@ public:
const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; } const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; }
int64_t get_row_count() const override { return meta_.row_count_; } int64_t get_row_count() const override { return meta_.row_count_; }
bool is_valid() const override { return is_inited_; } bool is_valid() const override { return is_inited_; }
void release_data() override;
int copy(const ObDirectLoadExternalTable &other); int copy(const ObDirectLoadExternalTable &other);
const ObDirectLoadExternalTableMeta &get_meta() const { return meta_; } const ObDirectLoadExternalTableMeta &get_meta() const { return meta_; }
const ObDirectLoadExternalFragmentArray &get_fragments() const { return fragments_; } const ObDirectLoadExternalFragmentArray &get_fragments() const { return fragments_; }

View File

@ -54,6 +54,7 @@ public:
const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; } const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; }
int64_t get_row_count() const override { return meta_.row_count_; } int64_t get_row_count() const override { return meta_.row_count_; }
bool is_valid() const override { return is_inited_; } bool is_valid() const override { return is_inited_; }
void release_data() override { /*do nothing*/ }
const ObDirectLoadFastHeapTableMeta &get_meta() const { return meta_; } const ObDirectLoadFastHeapTableMeta &get_meta() const { return meta_; }
TO_STRING_KV(K_(meta)); TO_STRING_KV(K_(meta));
private: private:

View File

@ -27,6 +27,7 @@ public:
virtual const common::ObTabletID &get_tablet_id() const = 0; virtual const common::ObTabletID &get_tablet_id() const = 0;
virtual int64_t get_row_count() const = 0; virtual int64_t get_row_count() const = 0;
virtual bool is_valid() const = 0; virtual bool is_valid() const = 0;
virtual void release_data() = 0;
TO_STRING_EMPTY(); TO_STRING_EMPTY();
}; };

View File

@ -188,6 +188,7 @@ int ObDirectLoadInsertTabletContext::close()
LOG_WARN("fail to close tablet direct load", KR(ret), K(param_.ls_id_), LOG_WARN("fail to close tablet direct load", KR(ret), K(param_.ls_id_),
K(param_.tablet_id_)); K(param_.tablet_id_));
} else { } else {
handle_.reset();
is_open_ = false; is_open_ = false;
} }
} }

View File

@ -168,6 +168,12 @@ int ObDirectLoadMultipleHeapTable::init(const ObDirectLoadMultipleHeapTableCreat
return ret; return ret;
} }
void ObDirectLoadMultipleHeapTable::release_data()
{
index_file_handle_.reset();
data_fragments_.reset();
}
int ObDirectLoadMultipleHeapTable::copy(const ObDirectLoadMultipleHeapTable &other) int ObDirectLoadMultipleHeapTable::copy(const ObDirectLoadMultipleHeapTable &other)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -95,6 +95,7 @@ public:
const common::ObTabletID &get_tablet_id() const override { return tablet_id_; } const common::ObTabletID &get_tablet_id() const override { return tablet_id_; }
int64_t get_row_count() const override { return meta_.row_count_; } int64_t get_row_count() const override { return meta_.row_count_; }
bool is_valid() const override { return is_inited_; } bool is_valid() const override { return is_inited_; }
void release_data() override;
int copy(const ObDirectLoadMultipleHeapTable &other); int copy(const ObDirectLoadMultipleHeapTable &other);
const ObDirectLoadMultipleHeapTableMeta &get_meta() const { return meta_; } const ObDirectLoadMultipleHeapTableMeta &get_meta() const { return meta_; }
const ObDirectLoadTmpFileHandle &get_index_file_handle() const { return index_file_handle_; } const ObDirectLoadTmpFileHandle &get_index_file_handle() const { return index_file_handle_; }

View File

@ -173,6 +173,11 @@ int ObDirectLoadMultipleSSTable::init(const ObDirectLoadMultipleSSTableCreatePar
return ret; return ret;
} }
void ObDirectLoadMultipleSSTable::release_data()
{
fragments_.reset();
}
int ObDirectLoadMultipleSSTable::copy(const ObDirectLoadMultipleSSTable &other) int ObDirectLoadMultipleSSTable::copy(const ObDirectLoadMultipleSSTable &other)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -100,6 +100,7 @@ public:
const common::ObTabletID &get_tablet_id() const override { return tablet_id_; } const common::ObTabletID &get_tablet_id() const override { return tablet_id_; }
int64_t get_row_count() const override { return meta_.row_count_; } int64_t get_row_count() const override { return meta_.row_count_; }
bool is_valid() const override { return is_inited_; } bool is_valid() const override { return is_inited_; }
void release_data() override;
int copy(const ObDirectLoadMultipleSSTable &other); int copy(const ObDirectLoadMultipleSSTable &other);
bool is_empty() const { return 0 == meta_.row_count_; } bool is_empty() const { return 0 == meta_.row_count_; }
const ObDirectLoadMultipleSSTableMeta &get_meta() const { return meta_; } const ObDirectLoadMultipleSSTableMeta &get_meta() const { return meta_; }

View File

@ -159,6 +159,11 @@ int ObDirectLoadSSTable::init(ObDirectLoadSSTableCreateParam &param)
return ret; return ret;
} }
void ObDirectLoadSSTable::release_data()
{
fragments_.reset();
}
int ObDirectLoadSSTable::copy(const ObDirectLoadSSTable &other) int ObDirectLoadSSTable::copy(const ObDirectLoadSSTable &other)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;

View File

@ -152,6 +152,7 @@ public:
const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; } const common::ObTabletID &get_tablet_id() const override { return meta_.tablet_id_; }
bool is_empty() const { return 0 == meta_.row_count_; } bool is_empty() const { return 0 == meta_.row_count_; }
bool is_valid() const override { return is_inited_; } bool is_valid() const override { return is_inited_; }
void release_data() override;
int copy(const ObDirectLoadSSTable &other); int copy(const ObDirectLoadSSTable &other);
const common::ObArray<ObDirectLoadSSTableFragment> &get_fragment_array() const const common::ObArray<ObDirectLoadSSTableFragment> &get_fragment_array() const
{ {