[CP] logger opt

This commit is contained in:
obdev
2024-07-02 06:20:51 +00:00
committed by ob-robot
parent a315edad74
commit 2f9c55bcb5
4 changed files with 11 additions and 4 deletions

View File

@ -39,7 +39,7 @@ public:
PARALLEL_DEF(DEFAULT_CTX_ID, 32) PARALLEL_DEF(DEFAULT_CTX_ID, 32)
PARALLEL_DEF(LIBEASY, 32) PARALLEL_DEF(LIBEASY, 32)
PARALLEL_DEF(PLAN_CACHE_CTX_ID, 4) PARALLEL_DEF(PLAN_CACHE_CTX_ID, 4)
PARALLEL_DEF(LOGGER_CTX_ID, 1) PARALLEL_DEF(LOGGER_CTX_ID, 4)
#undef CTX_PARALLEL_DEF #undef CTX_PARALLEL_DEF
#define ENABLE_DIRTY_LIST_DEF(name) ctx_attr_[ObCtxIds::name].enable_dirty_list_ = true; #define ENABLE_DIRTY_LIST_DEF(name) ctx_attr_[ObCtxIds::name].enable_dirty_list_ = true;

View File

@ -19,6 +19,7 @@
#include "lib/ob_define.h" #include "lib/ob_define.h"
#include "lib/utility/ob_macro_utils.h" #include "lib/utility/ob_macro_utils.h"
#include "lib/atomic/ob_atomic.h"
namespace oceanbase namespace oceanbase
{ {
@ -87,7 +88,11 @@ public:
bool has_stopped() const { return has_stopped_; } bool has_stopped() const { return has_stopped_; }
virtual int64_t get_queued_item_cnt() const virtual int64_t get_queued_item_cnt() const
{ {
return log_item_push_idx_ - log_item_pop_idx_; return ATOMIC_LOAD(&log_item_push_idx_) - ATOMIC_LOAD(&log_item_pop_idx_);
}
bool is_queue_full()
{
return get_queued_item_cnt() >= log_cfg_.max_buffer_item_cnt_;
} }
protected: protected:
void flush_log(); void flush_log();

View File

@ -1558,7 +1558,7 @@ int ObLogger::init(const ObBaseLogWriterCfg &log_cfg,
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
allocator_->set_limit(limit); allocator_->set_limit(limit);
allocator_->set_nway(4); allocator_->set_nway(8);
if (OB_FAIL(ObBaseLogWriter::init(log_cfg, thread_name))) { if (OB_FAIL(ObBaseLogWriter::init(log_cfg, thread_name))) {
LOG_STDERR("init ObBaseLogWriter error. ret=%d\n", ret); LOG_STDERR("init ObBaseLogWriter error. ret=%d\n", ret);
} else if (OB_FAIL(ObBaseLogWriter::start())) { } else if (OB_FAIL(ObBaseLogWriter::start())) {

View File

@ -1233,7 +1233,9 @@ inline void ObLogger::do_log_message(const bool is_async,
limited_left_log_size_ = 0; limited_left_log_size_ = 0;
BASIC_TIME_GUARD(tg, "ObLog"); BASIC_TIME_GUARD(tg, "ObLog");
int64_t start_ts = OB_TSC_TIMESTAMP.current_time(); int64_t start_ts = OB_TSC_TIMESTAMP.current_time();
if (FD_TRACE_FILE != fd_type && OB_FAIL(check_tl_log_limiter(location_hash_val, level, errcode, log_size, if (is_queue_full()) {
// do-nothing
} else if (FD_TRACE_FILE != fd_type && OB_FAIL(check_tl_log_limiter(location_hash_val, level, errcode, log_size,
allow, limiter_info))) { allow, limiter_info))) {
LOG_STDERR("precheck_tl_log_limiter error, ret=%d\n", ret); LOG_STDERR("precheck_tl_log_limiter error, ret=%d\n", ret);
} else if (OB_UNLIKELY(!allow) && !need_print_log_limit_msg()) { } else if (OB_UNLIKELY(!allow) && !need_print_log_limit_msg()) {