From 28bc220a0b6b54849ff1c0cf0bace9744c19b72d Mon Sep 17 00:00:00 2001 From: coolfishchen Date: Tue, 23 Apr 2024 12:55:30 +0000 Subject: [PATCH] ObDDLMemtable use DIRECT_LOAD_MEMTABLE in inc direct load --- src/storage/access/ob_block_sample_iterator.cpp | 2 +- .../index_block/ob_sstable_sec_meta_iterator.cpp | 2 +- src/storage/ddl/ob_ddl_merge_task.cpp | 4 ++-- src/storage/ddl/ob_tablet_ddl_kv.cpp | 6 +++++- src/storage/ob_i_table.h | 4 +++- src/storage/ob_partition_range_spliter.cpp | 2 +- src/storage/tablet/ob_table_store_util.cpp | 2 +- src/storage/tablet/ob_tablet_table_store_iterator.cpp | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/storage/access/ob_block_sample_iterator.cpp b/src/storage/access/ob_block_sample_iterator.cpp index c21d66e9ab..3889e65650 100644 --- a/src/storage/access/ob_block_sample_iterator.cpp +++ b/src/storage/access/ob_block_sample_iterator.cpp @@ -406,7 +406,7 @@ int ObBlockSampleRangeIterator::init_and_push_endkey_iterator(ObGetTableParam &g } else { STORAGE_LOG(WARN, "Fail to get next table iter", K(ret), K(get_table_param.tablet_iter_.table_iter())); } - } else if (!table->is_sstable() || table->is_ddl_mem_sstable()) { + } else if (!table->is_sstable() || table->is_ddl_kv_sstable()) { } else if (OB_ISNULL(table) || OB_ISNULL(sample_range_) || OB_ISNULL(allocator_)) { ret = OB_ERR_UNEXPECTED; STORAGE_LOG(WARN, "Unexpected null sstable", K(ret), KP(table), KP(sample_range_), KP(allocator_)); diff --git a/src/storage/blocksstable/index_block/ob_sstable_sec_meta_iterator.cpp b/src/storage/blocksstable/index_block/ob_sstable_sec_meta_iterator.cpp index 161d320448..9980882cd0 100644 --- a/src/storage/blocksstable/index_block/ob_sstable_sec_meta_iterator.cpp +++ b/src/storage/blocksstable/index_block/ob_sstable_sec_meta_iterator.cpp @@ -76,7 +76,7 @@ int ObSSTableSecMetaIterator::open( { int ret = OB_SUCCESS; bool is_meta_root = false; - const bool is_ddl_mem_sstable = sstable.is_ddl_mem_sstable(); + const bool is_ddl_mem_sstable = sstable.is_ddl_kv_sstable(); if (IS_INIT) { ret = OB_INIT_TWICE; LOG_WARN("Fail to open sstable secondary meta iterator", K(ret)); diff --git a/src/storage/ddl/ob_ddl_merge_task.cpp b/src/storage/ddl/ob_ddl_merge_task.cpp index 5d9f8a7857..9feab2c3e3 100644 --- a/src/storage/ddl/ob_ddl_merge_task.cpp +++ b/src/storage/ddl/ob_ddl_merge_task.cpp @@ -1034,7 +1034,7 @@ int ObDDLMacroBlockIterator::open(ObSSTable *sstable, const ObDatumRange &query_ } else if (OB_UNLIKELY(nullptr == sstable || !query_range.is_valid() || !read_info.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret), KP(sstable), K(query_range), K(read_info)); - } else if (sstable->is_ddl_mem_sstable()) { // ddl mem, scan keybtree + } else if (sstable->is_ddl_kv_sstable()) { // ddl mem, scan keybtree ObDDLMemtable *ddl_memtable = static_cast(sstable); if (OB_ISNULL(ddl_memtable)) { ret = OB_ERR_UNEXPECTED; @@ -1085,7 +1085,7 @@ int ObDDLMacroBlockIterator::get_next(ObDataMacroBlockMeta &data_macro_meta, int if (OB_UNLIKELY(!is_inited_)) { ret = OB_NOT_INIT; LOG_WARN("not init", K(ret), K(is_inited_)); - } else if (sstable_->is_ddl_mem_sstable()) { + } else if (sstable_->is_ddl_kv_sstable()) { ObDatumRowkeyWrapper tree_key; ObBlockMetaTreeValue *tree_value = nullptr; if (OB_FAIL(ddl_iter_.get_next(tree_key, tree_value))) { diff --git a/src/storage/ddl/ob_tablet_ddl_kv.cpp b/src/storage/ddl/ob_tablet_ddl_kv.cpp index b2e8cf2ddf..2cd40f8bb0 100644 --- a/src/storage/ddl/ob_tablet_ddl_kv.cpp +++ b/src/storage/ddl/ob_tablet_ddl_kv.cpp @@ -164,7 +164,11 @@ int ObDDLMemtable::init_sstable_param( } } } else { - sstable_param.table_key_.table_type_ = ObITable::TableType::DDL_MEM_SSTABLE; + if (table_key.table_type_ == ObITable::TableType::MINI_SSTABLE) { + sstable_param.table_key_.table_type_ = ObITable::TableType::DIRECT_LOAD_MEMTABLE; + } else { + sstable_param.table_key_.table_type_ = ObITable::TableType::DDL_MEM_SSTABLE; + } sstable_param.rowkey_column_cnt_ = storage_schema.get_rowkey_column_num() + ObMultiVersionRowkeyHelpper::get_extra_rowkey_col_cnt(); sstable_param.column_cnt_ = column_count; } diff --git a/src/storage/ob_i_table.h b/src/storage/ob_i_table.h index 4759be2321..2414ddef79 100644 --- a/src/storage/ob_i_table.h +++ b/src/storage/ob_i_table.h @@ -284,6 +284,7 @@ public: virtual bool is_empty() const = 0; virtual bool no_data_to_read() const { return is_empty(); } virtual bool is_ddl_merge_empty_sstable() const { return is_empty() && is_ddl_merge_sstable(); } + virtual bool is_ddl_kv_sstable() const { return is_ddl_mem_sstable() || is_direct_load_memtable(); } DECLARE_VIRTUAL_TO_STRING; static bool is_sstable(const TableType table_type) @@ -307,7 +308,8 @@ public: { return ObITable::TableType::MINOR_SSTABLE == table_type || ObITable::TableType::MINI_SSTABLE == table_type - || ObITable::TableType::REMOTE_LOGICAL_MINOR_SSTABLE == table_type; + || ObITable::TableType::REMOTE_LOGICAL_MINOR_SSTABLE == table_type + || ObITable::TableType::DIRECT_LOAD_MEMTABLE == table_type; } static bool is_multi_version_table(const TableType table_type) diff --git a/src/storage/ob_partition_range_spliter.cpp b/src/storage/ob_partition_range_spliter.cpp index 9104d7d3d1..7986984628 100644 --- a/src/storage/ob_partition_range_spliter.cpp +++ b/src/storage/ob_partition_range_spliter.cpp @@ -400,7 +400,7 @@ int ObPartitionParallelRanger::init_macro_iters(ObRangeSplitInfo &range_info) } else if (OB_UNLIKELY(!table->is_sstable())) { ret = OB_ERR_UNEXPECTED; STORAGE_LOG(WARN, "Unexpected table type", K(ret), KPC(table)); - } else if (is_micro_level_ && !table->is_ddl_mem_sstable()) { // ddl kv not support endkey iterator of micro block + } else if (is_micro_level_ && !table->is_ddl_kv_sstable()) { // ddl kv not support endkey iterator of micro block if (OB_ISNULL(buf = allocator_.alloc(sizeof(ObMicroEndkeyIterator)))) { ret = OB_ALLOCATE_MEMORY_FAILED; STORAGE_LOG(WARN, "Failed to alloc memory for endkey iter", K(ret)); diff --git a/src/storage/tablet/ob_table_store_util.cpp b/src/storage/tablet/ob_table_store_util.cpp index 6921589a1a..07e2b50ac9 100644 --- a/src/storage/tablet/ob_table_store_util.cpp +++ b/src/storage/tablet/ob_table_store_util.cpp @@ -230,7 +230,7 @@ int ObSSTableArray::inner_init( if (OB_ISNULL(table)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected null table ptr", K(ret)); - } else if (OB_UNLIKELY(!table->is_sstable() && !table->is_ddl_mem_sstable())) { + } else if (OB_UNLIKELY(!table->is_sstable() && !table->is_ddl_kv_sstable())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected table type", K(ret), KPC(table)); } else if (OB_FAIL(static_cast(table)->deep_copy(allocator, sstable_array_[i - start_pos]))) { diff --git a/src/storage/tablet/ob_tablet_table_store_iterator.cpp b/src/storage/tablet/ob_tablet_table_store_iterator.cpp index 23823af4e2..b5d0cb427f 100644 --- a/src/storage/tablet/ob_tablet_table_store_iterator.cpp +++ b/src/storage/tablet/ob_tablet_table_store_iterator.cpp @@ -135,7 +135,7 @@ int ObTableStoreIterator::get_next(ObTableHandleV2 &table_handle) } else { if (OB_FAIL(get_ith_table(pos_, table))) { LOG_WARN("fail to get ith table", K(ret), K(pos_)); - } else if (table->is_memtable() || table->is_ddl_mem_sstable()) { + } else if (table->is_memtable() || table->is_ddl_kv_sstable()) { ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*); if (OB_FAIL(table_handle.set_table(table, t3m, table->get_key().table_type_))) { LOG_WARN("failed to set memtable to table handle", K(ret), KPC(table));