fix too much log in errsim

This commit is contained in:
nroskill 2022-11-08 12:35:28 +00:00 committed by wangzelin.wzl
parent b5c0373a99
commit 299a6501c1
5 changed files with 38 additions and 13 deletions

View File

@ -337,6 +337,8 @@ ProbeAction probe_str2action(const char *str)
action = ProbeAction::PROBE_BT;
} else if (0 == strcmp(str, "abort")) {
action = ProbeAction::PROBE_ABORT;
} else if (0 == strcmp(str, "disable")) {
action = ProbeAction::PROBE_DISABLE;
}
return action;
}
@ -353,6 +355,10 @@ const char *probe_action2str(ProbeAction action)
str = "abort";
break;
}
case ProbeAction::PROBE_DISABLE: {
str = "disable";
break;
}
default: {
str = "none";
break;

View File

@ -235,6 +235,7 @@ enum class ProbeAction
PROBE_NONE,
PROBE_BT,
PROBE_ABORT,
PROBE_DISABLE,
};
//@class ObLogger
@ -724,10 +725,11 @@ private:
const uint64_t location_hash_val,
Function &&log_data_func);
void check_probe(
const char *file,
const char* file,
int32_t line,
const uint64_t location_hash_val,
bool &force_bt);
bool& force_bt,
bool& disable);
private:
static const char *const errstr_[];
// default log rate limiter if there's no tl_log_limiger
@ -1071,12 +1073,14 @@ inline int ObLogger::set_mod_log_levels(const char *level_str, int64_t version)
extern void __attribute__ ((noinline)) on_probe_abort();
inline void ObLogger::check_probe(
const char *file,
const char* file,
int32_t line,
const uint64_t location_hash_val,
bool &force_bt)
bool& force_bt,
bool& disable)
{
force_bt = false;
disable = false;
for (int i = 0; i < probe_cnt_; i++) {
auto &probe = probes_[i];
if (location_hash_val == probe.location_hash_val_ &&
@ -1089,9 +1093,23 @@ inline void ObLogger::check_probe(
filename++;
}
if (0 == strncmp(filename, probe.file_, sizeof probe.file_)) {
force_bt = ProbeAction::PROBE_BT == probe.action_;
if (ProbeAction::PROBE_ABORT == probe.action_) {
on_probe_abort();
switch (probe.action_) {
case ProbeAction::PROBE_BT: {
force_bt = true;
break;
}
case ProbeAction::PROBE_ABORT: {
on_probe_abort();
break;
}
case ProbeAction::PROBE_DISABLE: {
disable = true;
break;
}
default: {
// do nothing
break;
}
}
break;
}
@ -1117,7 +1135,9 @@ inline void ObLogger::do_log_message(const bool is_async,
bool allow = true;
bool force_bt = false;
check_probe(file, line, location_hash_val, force_bt);
bool disable = false;
check_probe(file, line, location_hash_val, force_bt, disable);
if(OB_UNLIKELY(disable)) return;
const int64_t logging_time_us_begin = get_cur_us();
auto fd_type = get_fd_type(mod_name);
if (OB_FAIL(precheck_tl_log_limiter(level, allow))) {

View File

@ -25,6 +25,7 @@
#include "lib/alloc/alloc_assist.h"
#include "lib/list/ob_dlist.h"
#include "lib/coro/co_var.h"
#include "lib/time/ob_tsc_timestamp.h"
#define TP_COMMA(x) ,
#define TP_EMPTY(x)
@ -218,7 +219,9 @@ struct EventItem
ret = 0;
} else if (trigger_freq_ == 1) {
ret = static_cast<int>(error_code_);
COMMON_LOG(WARN, "[ERRSIM] sim error", K(ret));
if (REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
COMMON_LOG(WARN, "[ERRSIM] sim error", K(ret));
}
} else {
if (rand() % trigger_freq_ == 0) {
ret = static_cast<int>(error_code_);

View File

@ -23,13 +23,11 @@
datafile_size: '60G'
system_memory: '15G'
cpu_count: '16'
stack_size: '512K'
cache_wash_threshold: '1G'
__min_full_resource_pool_memory: "1073741824"
workers_per_cpu_quota: '10'
schema_history_expire_time: '1d'
net_thread_count: '4'
enable_async_syslog: False
{{%% EXTRA_PARAM %%}}
{{%% PROXY_CONF %%}}

View File

@ -23,11 +23,9 @@ config:
memory_limit: '8G'
system_memory: '1G'
cpu_count: '24'
stack_size: '512K'
cache_wash_threshold: '1G'
__min_full_resource_pool_memory: "1073741824"
workers_per_cpu_quota: '10'
schema_history_expire_time: '1d'
net_thread_count: '4'
syslog_io_bandwidth_limit: '10G'
enable_async_syslog: 'FALSE'