[FIX] dynamic expand or shrink tx data hash map when minor freeze to reduce memory use in tx data memtable
This commit is contained in:
@ -43,21 +43,17 @@ int ObTxDataTable::init(ObLS *ls, ObTxCtxTable *tx_ctx_table)
|
||||
STATIC_ASSERT(sizeof(ObUndoAction) == UNDO_ACTION_SZIE, "Size of ObUndoAction Overflow.");
|
||||
STATIC_ASSERT(sizeof(ObUndoStatusNode) <= TX_DATA_SLICE_SIZE, "Size of ObUndoStatusNode Overflow");
|
||||
|
||||
ObMemAttr mem_attr;
|
||||
mem_attr.label_ = "TX_DATA_TABLE";
|
||||
mem_attr.tenant_id_ = MTL_ID();
|
||||
mem_attr.ctx_id_ = ObCtxIds::DEFAULT_CTX_ID;
|
||||
ObMemtableMgrHandle memtable_mgr_handle;
|
||||
if (OB_ISNULL(ls) || OB_ISNULL(tx_ctx_table)) {
|
||||
ret = OB_ERR_NULL_VALUE;
|
||||
STORAGE_LOG(WARN, "ls tablet service or tx ctx table is nullptr", KR(ret));
|
||||
} else if (OB_FAIL(slice_allocator_.init(TX_DATA_SLICE_SIZE, OB_MALLOC_NORMAL_BLOCK_SIZE,
|
||||
common::default_blk_alloc, mem_attr))) {
|
||||
} else if (OB_FAIL(init_slice_allocator_())) {
|
||||
STORAGE_LOG(ERROR, "slice_allocator_ init fail");
|
||||
} else if (FALSE_IT(ls_tablet_svr_ = ls->get_tablet_svr())) {
|
||||
} else if (OB_FAIL(ls_tablet_svr_->get_tx_data_memtable_mgr(memtable_mgr_handle))) {
|
||||
STORAGE_LOG(WARN, "get tx data memtable mgr fail.", KR(ret), K(tablet_id_));
|
||||
} else if (FALSE_IT(arena_allocator_.set_attr(mem_attr))) {
|
||||
} else if (OB_FAIL(init_arena_allocator_())) {
|
||||
STORAGE_LOG(ERROR, "slice_allocator_ init fail");
|
||||
} else if (OB_FAIL(init_tx_data_read_schema_())) {
|
||||
STORAGE_LOG(WARN, "init tx data read ctx failed.", KR(ret), K(tablet_id_));
|
||||
} else {
|
||||
@ -75,6 +71,27 @@ int ObTxDataTable::init(ObLS *ls, ObTxCtxTable *tx_ctx_table)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTxDataTable::init_slice_allocator_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObMemAttr mem_attr;
|
||||
mem_attr.label_ = "TX_DATA_SLICE";
|
||||
mem_attr.tenant_id_ = MTL_ID();
|
||||
mem_attr.ctx_id_ = ObCtxIds::TX_DATA_TABLE;
|
||||
ret = slice_allocator_.init(TX_DATA_SLICE_SIZE, OB_MALLOC_NORMAL_BLOCK_SIZE, common::default_blk_alloc, mem_attr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTxDataTable::init_arena_allocator_()
|
||||
{
|
||||
ObMemAttr mem_attr;
|
||||
mem_attr.label_ = "TX_DATA_ARENA";
|
||||
mem_attr.tenant_id_ = MTL_ID();
|
||||
mem_attr.ctx_id_ = ObCtxIds::TX_DATA_TABLE;
|
||||
arena_allocator_.set_attr(mem_attr);
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObTxDataTable::init_tx_data_read_schema_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user