[BUG.FIX] split tenant memory for TabletMap and TmpFileCache label
This commit is contained in:
@ -1159,12 +1159,11 @@ ObTmpFileManager &ObTmpFileManager::get_instance()
|
|||||||
int ObTmpFileManager::init()
|
int ObTmpFileManager::init()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
ObMemAttr attr = SET_USE_500(ObMemAttr(OB_SERVER_TENANT_ID, ObModIds::OB_TMP_FILE_MANAGER)); //TODO: split tmp file map into each tenant.
|
||||||
if (IS_INIT) {
|
if (IS_INIT) {
|
||||||
ret = OB_INIT_TWICE;
|
ret = OB_INIT_TWICE;
|
||||||
STORAGE_LOG(WARN, "ObTmpFileManager has not been inited", K(ret));
|
STORAGE_LOG(WARN, "ObTmpFileManager has not been inited", K(ret));
|
||||||
} else if (OB_FAIL(files_.init(DEFAULT_BUCKET_NUM, OB_SERVER_TENANT_ID,
|
} else if (OB_FAIL(files_.init(DEFAULT_BUCKET_NUM, attr, TOTAL_LIMIT, HOLD_LIMIT, BLOCK_SIZE))) {
|
||||||
ObModIds::OB_TMP_FILE_MANAGER,
|
|
||||||
TOTAL_LIMIT, HOLD_LIMIT, BLOCK_SIZE))) {
|
|
||||||
STORAGE_LOG(WARN, "fail to init map for temporary files", K(ret));
|
STORAGE_LOG(WARN, "fail to init map for temporary files", K(ret));
|
||||||
} else if (OB_FAIL(OB_TMP_FILE_STORE.init())) {
|
} else if (OB_FAIL(OB_TMP_FILE_STORE.init())) {
|
||||||
STORAGE_LOG(WARN, "fail to init the block manager for temporary files", K(ret));
|
STORAGE_LOG(WARN, "fail to init the block manager for temporary files", K(ret));
|
||||||
|
|||||||
@ -815,8 +815,6 @@ int64_t ObTmpTenantFileStore::dec_ref()
|
|||||||
|
|
||||||
int ObTmpTenantFileStore::init(const uint64_t tenant_id)
|
int ObTmpTenantFileStore::init(const uint64_t tenant_id)
|
||||||
{
|
{
|
||||||
auto allocator_attr = SET_USE_500(ObModIds::OB_TMP_BLOCK_MANAGER);
|
|
||||||
auto io_allocator_attr = SET_USE_500(ObModIds::OB_TMP_PAGE_CACHE);
|
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (IS_INIT) {
|
if (IS_INIT) {
|
||||||
ret = OB_INIT_TWICE;
|
ret = OB_INIT_TWICE;
|
||||||
@ -825,8 +823,6 @@ int ObTmpTenantFileStore::init(const uint64_t tenant_id)
|
|||||||
STORAGE_LOG(WARN, "fail to init allocator", K(ret));
|
STORAGE_LOG(WARN, "fail to init allocator", K(ret));
|
||||||
} else if (OB_FAIL(io_allocator_.init(OB_MALLOC_BIG_BLOCK_SIZE, ObModIds::OB_TMP_PAGE_CACHE, tenant_id, IO_LIMIT))) {
|
} else if (OB_FAIL(io_allocator_.init(OB_MALLOC_BIG_BLOCK_SIZE, ObModIds::OB_TMP_PAGE_CACHE, tenant_id, IO_LIMIT))) {
|
||||||
STORAGE_LOG(WARN, "Fail to init io allocator, ", K(ret));
|
STORAGE_LOG(WARN, "Fail to init io allocator, ", K(ret));
|
||||||
} else if (FALSE_IT(allocator_.set_attr(allocator_attr))) {
|
|
||||||
} else if (FALSE_IT(io_allocator_.set_attr(io_allocator_attr))) {
|
|
||||||
} else if (OB_ISNULL(page_cache_ = &ObTmpPageCache::get_instance())) {
|
} else if (OB_ISNULL(page_cache_ = &ObTmpPageCache::get_instance())) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
STORAGE_LOG(WARN, "fail to get the page cache", K(ret));
|
STORAGE_LOG(WARN, "fail to get the page cache", K(ret));
|
||||||
|
|||||||
@ -135,6 +135,7 @@ int ObTenantMetaMemMgr::init()
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
lib::ObMemAttr mem_attr(tenant_id_, "MetaAllocator", ObCtxIds::META_OBJ_CTX_ID);
|
lib::ObMemAttr mem_attr(tenant_id_, "MetaAllocator", ObCtxIds::META_OBJ_CTX_ID);
|
||||||
|
lib::ObMemAttr map_attr(tenant_id_, "TabletMap");
|
||||||
lib::ObMemAttr other_attr(tenant_id_, "T3MOtherMem");
|
lib::ObMemAttr other_attr(tenant_id_, "T3MOtherMem");
|
||||||
const int64_t bucket_num = cal_adaptive_bucket_num();
|
const int64_t bucket_num = cal_adaptive_bucket_num();
|
||||||
const int64_t pin_set_bucket_num = common::hash::cal_next_prime(DEFAULT_BUCKET_NUM);
|
const int64_t pin_set_bucket_num = common::hash::cal_next_prime(DEFAULT_BUCKET_NUM);
|
||||||
@ -147,7 +148,7 @@ int ObTenantMetaMemMgr::init()
|
|||||||
} else if (OB_FAIL(allocator_.init(lib::ObMallocAllocator::get_instance(),
|
} else if (OB_FAIL(allocator_.init(lib::ObMallocAllocator::get_instance(),
|
||||||
OB_MALLOC_NORMAL_BLOCK_SIZE, mem_attr))) {
|
OB_MALLOC_NORMAL_BLOCK_SIZE, mem_attr))) {
|
||||||
LOG_WARN("fail to init tenant fifo allocator", K(ret));
|
LOG_WARN("fail to init tenant fifo allocator", K(ret));
|
||||||
} else if (OB_FAIL(tablet_map_.init(bucket_num, tenant_id_, "TabletMap", TOTAL_LIMIT, HOLD_LIMIT,
|
} else if (OB_FAIL(tablet_map_.init(bucket_num, map_attr, TOTAL_LIMIT, HOLD_LIMIT,
|
||||||
common::OB_MALLOC_NORMAL_BLOCK_SIZE))) {
|
common::OB_MALLOC_NORMAL_BLOCK_SIZE))) {
|
||||||
LOG_WARN("fail to initialize tablet map", K(ret), K(bucket_num));
|
LOG_WARN("fail to initialize tablet map", K(ret), K(bucket_num));
|
||||||
} else if (OB_FAIL(last_min_minor_sstable_set_.create(DEFAULT_MINOR_SSTABLE_SET_COUNT, other_attr))) {
|
} else if (OB_FAIL(last_min_minor_sstable_set_.create(DEFAULT_MINOR_SSTABLE_SET_COUNT, other_attr))) {
|
||||||
|
|||||||
@ -160,7 +160,7 @@ class ObResourceMap
|
|||||||
public:
|
public:
|
||||||
ObResourceMap();
|
ObResourceMap();
|
||||||
virtual ~ObResourceMap();
|
virtual ~ObResourceMap();
|
||||||
int init(const int64_t bucket_num, const uint64_t tenant_id, const char *label,
|
int init(const int64_t bucket_num, const ObMemAttr &attr,
|
||||||
const int64_t total_limit, const int64_t hold_limit, const int64_t page_size);
|
const int64_t total_limit, const int64_t hold_limit, const int64_t page_size);
|
||||||
template <typename Callback = ObResourceDefaultCallback<Key,Value>>
|
template <typename Callback = ObResourceDefaultCallback<Key,Value>>
|
||||||
int get(const Key &key, ObResourceHandle<Value> &handle, Callback callback = ObResourceDefaultCallback<Key, Value>());
|
int get(const Key &key, ObResourceHandle<Value> &handle, Callback callback = ObResourceDefaultCallback<Key, Value>());
|
||||||
@ -205,14 +205,13 @@ ObResourceMap<Key, Value>::~ObResourceMap()
|
|||||||
template <typename Key, typename Value>
|
template <typename Key, typename Value>
|
||||||
int ObResourceMap<Key, Value>::init(
|
int ObResourceMap<Key, Value>::init(
|
||||||
const int64_t bucket_num,
|
const int64_t bucket_num,
|
||||||
const uint64_t tenant_id,
|
const ObMemAttr &attr,
|
||||||
const char *label,
|
|
||||||
const int64_t total_limit,
|
const int64_t total_limit,
|
||||||
const int64_t hold_limit,
|
const int64_t hold_limit,
|
||||||
const int64_t page_size)
|
const int64_t page_size)
|
||||||
{
|
{
|
||||||
int ret = common::OB_SUCCESS;
|
int ret = common::OB_SUCCESS;
|
||||||
ObMemAttr attr = SET_USE_500(ObMemAttr(tenant_id, label));
|
const uint64_t tenant_id = attr.tenant_id_;
|
||||||
const int64_t bkt_num = common::hash::cal_next_prime(bucket_num);
|
const int64_t bkt_num = common::hash::cal_next_prime(bucket_num);
|
||||||
if (OB_UNLIKELY(is_inited_)) {
|
if (OB_UNLIKELY(is_inited_)) {
|
||||||
ret = common::OB_INIT_TWICE;
|
ret = common::OB_INIT_TWICE;
|
||||||
@ -235,7 +234,7 @@ int ObResourceMap<Key, Value>::init(
|
|||||||
} else {
|
} else {
|
||||||
allocator_.set_attr(attr);
|
allocator_.set_attr(attr);
|
||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
STORAGE_LOG(INFO, "init resource map success", K(ret), K(tenant_id), K(bkt_num));
|
STORAGE_LOG(INFO, "init resource map success", K(ret), K(attr), K(bkt_num));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,8 @@ TestMetaPointerMap::TestMetaPointerMap()
|
|||||||
|
|
||||||
void TestMetaPointerMap::SetUp()
|
void TestMetaPointerMap::SetUp()
|
||||||
{
|
{
|
||||||
int ret = tablet_map_.init(1000L, OB_SERVER_TENANT_ID,
|
lib::ObMemAttr attr(OB_SERVER_TENANT_ID, "TabletMap");
|
||||||
"TabletMap", 15 * 1024L * 1024L * 1024L, 8 * 1024L * 1024L,
|
int ret = tablet_map_.init(1000L, attr, 15 * 1024L * 1024L * 1024L, 8 * 1024L * 1024L,
|
||||||
common::OB_MALLOC_NORMAL_BLOCK_SIZE);
|
common::OB_MALLOC_NORMAL_BLOCK_SIZE);
|
||||||
ASSERT_EQ(common::OB_SUCCESS, ret);
|
ASSERT_EQ(common::OB_SUCCESS, ret);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user