提交 0657b959 编写于 作者: N nroskill 提交者: LINGuanRen

fix fifo return -4013

上级 8ea2d68d
......@@ -293,8 +293,8 @@ void* ObFIFOAllocator::alloc_align(const int64_t size, const int64_t align, cons
// get a new page, set current_using_ pointing to it.
void ObFIFOAllocator::alloc_new_normal_page(const ObMemAttr& attr)
{
if (OB_UNLIKELY(!is_inited_) || OB_UNLIKELY(nullptr == allocator_)) {
LOG_ERROR("");
if (IS_NOT_INIT || OB_ISNULL(allocator_)) {
LOG_ERROR("ObFIFOAllocator not init");
} else {
NormalPageHeader* new_page = nullptr;
if (free_page_list_.get_size() > 0) {
......@@ -303,14 +303,14 @@ void ObFIFOAllocator::alloc_new_normal_page(const ObMemAttr& attr)
if (nullptr == new_page) {
if (total() + page_size_ <= max_size_) {
void* ptr = allocator_->alloc(page_size_, attr);
if (ptr != nullptr) {
if (OB_NOT_NULL(ptr)) {
new_page = new (ptr) NormalPageHeader();
} else {
LOG_WARN("underlying allocator return nullptr");
}
}
}
if (nullptr == new_page) {
LOG_ERROR("underlying allocator return nullptr");
} else {
if (OB_NOT_NULL(new_page)) {
new_page->ref_count_ = 1;
new_page->offset_ = reinterpret_cast<char*>(new_page) + sizeof(NormalPageHeader);
current_using_->ref_count_--;
......@@ -397,7 +397,7 @@ void* ObFIFOAllocator::alloc_normal(int64_t size, int64_t align, const ObMemAttr
new_space = allocator_->alloc(page_size_, attr);
}
if (nullptr == new_space) {
LOG_ERROR("can not allocate new page", K(page_size_));
LOG_WARN("can not allocate new page", K(page_size_));
} else {
current_using_ = new (new_space) NormalPageHeader();
current_using_->offset_ = reinterpret_cast<char*>(current_using_) + sizeof(NormalPageHeader);
......
......@@ -1699,19 +1699,20 @@ int ObLogger::init(const ObBaseLogWriterCfg& log_cfg)
}
allocator_ = new (buf) ObFIFOAllocator();
error_allocator_ = new (allocator_ + 1) ObFIFOAllocator();
const int64_t limit = ObBaseLogWriterCfg::DEFAULT_MAX_BUFFER_ITEM_CNT * OB_MALLOC_BIG_BLOCK_SIZE / 2; // 512M
if (OB_FAIL(allocator_->init(lib::ObMallocAllocator::get_instance(),
OB_MALLOC_BIG_BLOCK_SIZE,
lib::ObMemAttr(OB_SERVER_TENANT_ID, "Logger", common::ObCtxIds::LOGGER_CTX_ID),
NORMAL_LOG_INIT_MEM,
NORMAL_LOG_INIT_MEM << 1,
NORMAL_LOG_INIT_MEM << 2))) {
limit))) {
LOG_STDERR("init fifo error. ret=%d\n", ret);
} else if (OB_FAIL(error_allocator_->init(lib::ObMallocAllocator::get_instance(),
OB_MALLOC_BIG_BLOCK_SIZE,
lib::ObMemAttr(OB_SERVER_TENANT_ID, "ErrorLogger", common::ObCtxIds::LOGGER_CTX_ID),
ERROR_LOG_INIT_MEM,
ERROR_LOG_INIT_MEM << 1,
ERROR_LOG_INIT_MEM << 2))) {
limit))) {
LOG_STDERR("init error_fifo error. ret=%d\n", ret);
}
if (OB_SUCC(ret)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册