Fix a batch of memory not being split to tenant

This commit is contained in:
obdev
2023-05-18 14:11:18 +00:00
committed by ob-robot
parent 135383ca8b
commit 10ebab170d
98 changed files with 284 additions and 174 deletions

View File

@ -39,7 +39,7 @@ ObStorageLogNopLog::~ObStorageLogNopLog()
destroy();
}
int ObStorageLogNopLog::init(const int64_t buffer_size)
int ObStorageLogNopLog::init(const int64_t tenant_id, const int64_t buffer_size)
{
int ret = OB_SUCCESS;
if (OB_UNLIKELY(is_inited_)) {
@ -51,7 +51,7 @@ int ObStorageLogNopLog::init(const int64_t buffer_size)
} else {
buffer_ = static_cast<char *>(ob_malloc_align(
ObLogConstants::LOG_FILE_ALIGN_SIZE,
buffer_size, "SlogNopLog"));
buffer_size, ObMemAttr(tenant_id, "SlogNopLog")));
if (OB_ISNULL(buffer_)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("fail to alloc nop log buffer", K(ret));
@ -141,4 +141,4 @@ int64_t ObStorageLogNopLog::get_fixed_serialize_len(const int64_t used_len)
return ret_len;
}
} // namespace blocksstable
} // namespace oceanbase
} // namespace oceanbase

View File

@ -26,7 +26,7 @@ public:
ObStorageLogNopLog();
virtual ~ObStorageLogNopLog();
int init(const int64_t buffer_size);
int init(const int64_t tenant_id, const int64_t buffer_size);
void destroy();
int set_needed_size(const int64_t size);

View File

@ -40,7 +40,8 @@ ObStorageLogWriteBuffer::~ObStorageLogWriteBuffer()
int ObStorageLogWriteBuffer::init(
const int64_t align_size,
const int64_t buf_size)
const int64_t buf_size,
const int64_t tenant_id)
{
int ret = OB_SUCCESS;
@ -51,7 +52,7 @@ int ObStorageLogWriteBuffer::init(
ret = OB_INVALID_ARGUMENT;
STORAGE_REDO_LOG(WARN, "Invalid arguments", K(ret), K(align_size), K(buf_size));
} else if (OB_ISNULL(buf_ = static_cast<char *>(ob_malloc_align(align_size,
buf_size, "SlogWriteBuffer")))) {
buf_size, ObMemAttr(tenant_id, "SlogWriteBuffer"))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
STORAGE_REDO_LOG(WARN, "Fail to alloc write buffer",
K(ret), KP_(buf), K(buf_size), K_(align_size));

View File

@ -30,7 +30,8 @@ public:
int init(
const int64_t align_size,
const int64_t buf_size);
const int64_t buf_size,
const int64_t tenant_id);
void destroy();
const char *get_buf() const { return buf_; }
int64_t get_write_len() const { return write_len_; }

View File

@ -79,7 +79,7 @@ int ObStorageLogWriter::init(
ret = OB_INVALID_ARGUMENT;
STORAGE_REDO_LOG(WARN, "Invalid arguments", K(ret), KP(log_dir),
K(log_file_size), K(max_log_size));
} else if (OB_FAIL(ObBaseLogWriter::init(log_cfg, thread_name, MTL_ID()))) {
} else if (OB_FAIL(ObBaseLogWriter::init(log_cfg, thread_name, tenant_id))) {
STORAGE_REDO_LOG(WARN, "Fail to init ObBaseLogWriter", K(ret));
} else if (OB_FAIL(ObLogPolicyParser::parse_retry_write_policy(log_file_spec.retry_write_policy_,
retry_write_policy_))) {
@ -89,9 +89,9 @@ int ObStorageLogWriter::init(
log_write_policy_))) {
ret = OB_INVALID_ARGUMENT;
STORAGE_REDO_LOG(WARN, "Fail to parse log write policy", K(ret), K(log_file_spec));
} else if (OB_FAIL(nop_log_.init(ObLogConstants::LOG_FILE_ALIGN_SIZE))) {
} else if (OB_FAIL(nop_log_.init(tenant_id, ObLogConstants::LOG_FILE_ALIGN_SIZE))) {
STORAGE_REDO_LOG(WARN, "Fail to init nop log", K(ret));
} else if (OB_FAIL(batch_write_buf_.init(ObLogConstants::LOG_FILE_ALIGN_SIZE, buf_size))) {
} else if (OB_FAIL(batch_write_buf_.init(ObLogConstants::LOG_FILE_ALIGN_SIZE, buf_size, tenant_id))) {
STORAGE_REDO_LOG(WARN, "Fail to init batch write buf", K(ret), K(buf_size));
} else if (OB_FAIL(file_handler_.init(log_dir, log_file_size, tenant_id))) {
STORAGE_REDO_LOG(WARN, "Fail to create file handler", K(ret), KP(log_dir));