use arena allocator for btree node
This commit is contained in:
@ -39,7 +39,7 @@ using namespace oceanbase::share::schema;
|
|||||||
|
|
||||||
|
|
||||||
ObBlockMetaTree::ObBlockMetaTree()
|
ObBlockMetaTree::ObBlockMetaTree()
|
||||||
: is_inited_(false), fifo_allocator_(), tree_allocator_(fifo_allocator_), block_tree_(tree_allocator_)
|
: is_inited_(false), arena_(), tree_allocator_(arena_), block_tree_(tree_allocator_)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -62,8 +62,7 @@ int ObBlockMetaTree::init(const share::ObLSID &ls_id,
|
|||||||
} else if (OB_UNLIKELY(!ls_id.is_valid() || !table_key.is_valid() || cluster_version <= 0)) {
|
} else if (OB_UNLIKELY(!ls_id.is_valid() || !table_key.is_valid() || cluster_version <= 0)) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", K(ret), K(table_key));
|
LOG_WARN("invalid argument", K(ret), K(table_key));
|
||||||
} else if (OB_FAIL(fifo_allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE, mem_attr))) {
|
} else if (FALSE_IT(arena_.set_attr(mem_attr))) {
|
||||||
LOG_WARN("init fifo allocator failed", K(ret));
|
|
||||||
} else if (OB_FAIL(block_tree_.init())) {
|
} else if (OB_FAIL(block_tree_.init())) {
|
||||||
LOG_WARN("init block tree failed", K(ret));
|
LOG_WARN("init block tree failed", K(ret));
|
||||||
} else if (OB_FAIL(ObTabletDDLUtil::prepare_index_data_desc(ls_id,
|
} else if (OB_FAIL(ObTabletDDLUtil::prepare_index_data_desc(ls_id,
|
||||||
@ -160,7 +159,8 @@ void ObBlockMetaTree::destroy()
|
|||||||
block_tree_.destroy();
|
block_tree_.destroy();
|
||||||
data_desc_.reset();
|
data_desc_.reset();
|
||||||
sorted_rowkeys_.reset();
|
sorted_rowkeys_.reset();
|
||||||
fifo_allocator_.reset();
|
tree_allocator_.reset();
|
||||||
|
arena_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObBlockMetaTree::insert_macro_block(const ObDDLMacroHandle ¯o_handle,
|
int ObBlockMetaTree::insert_macro_block(const ObDDLMacroHandle ¯o_handle,
|
||||||
|
|||||||
@ -98,7 +98,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
bool is_inited_;
|
bool is_inited_;
|
||||||
ObArray<ObDDLMacroHandle> macro_blocks_;
|
ObArray<ObDDLMacroHandle> macro_blocks_;
|
||||||
ObFIFOAllocator fifo_allocator_;
|
ObArenaAllocator arena_;
|
||||||
BtreeNodeAllocator tree_allocator_;
|
BtreeNodeAllocator tree_allocator_;
|
||||||
KeyBtree block_tree_;
|
KeyBtree block_tree_;
|
||||||
blocksstable::ObDataStoreDesc data_desc_;
|
blocksstable::ObDataStoreDesc data_desc_;
|
||||||
|
|||||||
@ -132,9 +132,6 @@ void TestBlockMetaTree::prepare_schema()
|
|||||||
TEST_F(TestBlockMetaTree, random_keybtree)
|
TEST_F(TestBlockMetaTree, random_keybtree)
|
||||||
{
|
{
|
||||||
ObBlockMetaTree meta_tree;
|
ObBlockMetaTree meta_tree;
|
||||||
ObArenaAllocator arena;
|
|
||||||
const ObMemAttr mem_attr(TEST_TENANT_ID, "DDL_KV");
|
|
||||||
ASSERT_OK(meta_tree.fifo_allocator_.init(&arena, OB_MALLOC_MIDDLE_BLOCK_SIZE, mem_attr));
|
|
||||||
|
|
||||||
LOG_INFO("wenqu debug: check size",
|
LOG_INFO("wenqu debug: check size",
|
||||||
"sizeof(BtreeNode)", sizeof(keybtree::BtreeNode<blocksstable::ObDatumRowkeyWrapper, const blocksstable::ObDataMacroBlockMeta *>),
|
"sizeof(BtreeNode)", sizeof(keybtree::BtreeNode<blocksstable::ObDatumRowkeyWrapper, const blocksstable::ObDataMacroBlockMeta *>),
|
||||||
|
|||||||
Reference in New Issue
Block a user