[FEAT MERGE] perf opt & syslog opt
Co-authored-by: godyangfight <godyangfight@gmail.com> Co-authored-by: yishenglanlingzui <395329313@qq.com> Co-authored-by: 496148326@qq.com <496148326@qq.com>
This commit is contained in:
parent
647ff3b73c
commit
4d5b5ec653
1
deps/oblib/src/lib/CMakeLists.txt
vendored
1
deps/oblib/src/lib/CMakeLists.txt
vendored
@ -272,6 +272,7 @@ ob_set_subtarget(oblib_lib oblog
|
||||
oblog/ob_easy_log.cpp
|
||||
oblog/ob_log.cpp
|
||||
oblog/ob_log_compressor.cpp
|
||||
oblog/ob_log_dba_event.cpp
|
||||
oblog/ob_log_module.ipp
|
||||
oblog/ob_log_time_fmt.cpp
|
||||
oblog/ob_trace_log.cpp
|
||||
|
@ -536,7 +536,7 @@ void* ObTenantCtxAllocator::common_realloc(const void *ptr, const int64_t size,
|
||||
}
|
||||
#endif
|
||||
const char *msg = alloc_failed_msg();
|
||||
LOG_DBA_WARN(OB_ALLOCATE_MEMORY_FAILED, "[OOPS]", "alloc failed reason", KCSTRING(msg));
|
||||
LOG_DBA_WARN_V2(OB_LIB_ALLOCATE_MEMORY_FAIL, OB_ALLOCATE_MEMORY_FAILED, "[OOPS]: alloc failed reason is that ", msg);
|
||||
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "oops, alloc failed, tenant_id=%ld, ctx_id=%ld, ctx_name=%s, ctx_hold=%ld, "
|
||||
"ctx_limit=%ld, tenant_hold=%ld, tenant_limit=%ld",
|
||||
inner_attr.tenant_id_, inner_attr.ctx_id_,
|
||||
|
1
deps/oblib/src/lib/ob_lib_config.cpp
vendored
1
deps/oblib/src/lib/ob_lib_config.cpp
vendored
@ -18,7 +18,6 @@ namespace lib
|
||||
|
||||
volatile bool ObLibConfig::enable_diagnose_info_ = true;
|
||||
volatile bool ObLibConfig::enable_trace_log_ = true;
|
||||
thread_local bool ObDisableDiagnoseGuard::in_disable_diagnose_guard_ = false;
|
||||
|
||||
} //lib
|
||||
} //oceanbase
|
||||
|
17
deps/oblib/src/lib/ob_lib_config.h
vendored
17
deps/oblib/src/lib/ob_lib_config.h
vendored
@ -40,16 +40,21 @@ class ObPerfModeGuard
|
||||
friend bool is_diagnose_info_enabled();
|
||||
friend bool is_trace_log_enabled();
|
||||
public:
|
||||
explicit ObPerfModeGuard() : old_value_(in_disable_diagnose_guard_)
|
||||
explicit ObPerfModeGuard() : old_value_(get_tl_instance())
|
||||
{
|
||||
in_disable_diagnose_guard_ = true;
|
||||
get_tl_instance() = true;
|
||||
}
|
||||
~ObPerfModeGuard()
|
||||
{
|
||||
in_disable_diagnose_guard_ = old_value_;
|
||||
get_tl_instance() = old_value_;
|
||||
}
|
||||
private:
|
||||
static bool &get_tl_instance()
|
||||
{
|
||||
static thread_local bool in_disable_diagnose_guard = false;
|
||||
return in_disable_diagnose_guard;
|
||||
}
|
||||
private:
|
||||
static thread_local bool in_disable_diagnose_guard_;
|
||||
bool old_value_;
|
||||
};
|
||||
|
||||
@ -57,7 +62,7 @@ using ObDisableDiagnoseGuard = ObPerfModeGuard;
|
||||
|
||||
inline bool is_diagnose_info_enabled()
|
||||
{
|
||||
return ObLibConfig::enable_diagnose_info_ && !ObPerfModeGuard::in_disable_diagnose_guard_;
|
||||
return ObLibConfig::enable_diagnose_info_ && !ObPerfModeGuard::get_tl_instance();
|
||||
}
|
||||
|
||||
inline void reload_diagnose_info_config(const bool enable_diagnose_info)
|
||||
@ -67,7 +72,7 @@ inline void reload_diagnose_info_config(const bool enable_diagnose_info)
|
||||
|
||||
inline bool is_trace_log_enabled()
|
||||
{
|
||||
return ObLibConfig::enable_trace_log_ && !ObPerfModeGuard::in_disable_diagnose_guard_;
|
||||
return ObLibConfig::enable_trace_log_ && !ObPerfModeGuard::get_tl_instance();
|
||||
}
|
||||
|
||||
inline void reload_trace_log_config(const bool enable_trace_log)
|
||||
|
@ -36,6 +36,7 @@ enum ObPLogFDType {
|
||||
FD_ELEC_FILE,
|
||||
FD_TRACE_FILE,
|
||||
FD_AUDIT_FILE,
|
||||
FD_ALERT_FILE,
|
||||
MAX_FD_FILE,
|
||||
};
|
||||
|
||||
@ -79,6 +80,7 @@ public:
|
||||
bool is_trace_file() const { return FD_TRACE_FILE == fd_type_; }
|
||||
bool is_supported_file() const { return MAX_FD_FILE != fd_type_; }
|
||||
bool is_audit_file() const { return FD_AUDIT_FILE == fd_type_; }
|
||||
bool is_alert_file() const { return FD_ALERT_FILE == fd_type_; }
|
||||
|
||||
private:
|
||||
ObPLogFDType fd_type_;
|
||||
|
190
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
190
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
@ -96,6 +96,26 @@ ObPLogFDType get_fd_type(const char *mod_name)
|
||||
return type;
|
||||
}
|
||||
|
||||
ObPLogFDType get_fd_type(const char *mod_name, int32_t level, const char *dba_event)
|
||||
{
|
||||
ObPLogFDType type = FD_SVR_FILE;
|
||||
if (level == OB_LOG_LEVEL_DBA_ERROR || level == OB_LOG_LEVEL_DBA_WARN) {
|
||||
// DBA_ERROR, DBA_WARN: print into alert.log or observer.log
|
||||
if (OB_NOT_NULL(dba_event)) {
|
||||
type = FD_ALERT_FILE;
|
||||
} else {
|
||||
// consistent with old DBA log behavior.
|
||||
type = FD_SVR_FILE;
|
||||
}
|
||||
} else if (level == OB_LOG_LEVEL_DBA_INFO && OB_NOT_NULL(dba_event)) {
|
||||
// DBA_INFO: print into alert.log or other log(observer.log, rootservice.log, election.log)
|
||||
type = FD_ALERT_FILE;
|
||||
} else {
|
||||
// INFO, EDIAG, WDIAG, TRACE, DEBUG: print into observer.log, rootservice.log, election.log, trace.log
|
||||
type = get_fd_type(mod_name);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
int logdata_printf(char *buf, const int64_t buf_len, int64_t &pos, const char *fmt, ...)
|
||||
{
|
||||
@ -463,7 +483,7 @@ void ObLogger::print_trace_buffer(const char* mod_name,
|
||||
return OB_SUCCESS;
|
||||
};
|
||||
// invoke log_it isn't workable,that will recycle infinitely
|
||||
do_log_message(is_async_log_used(), mod_name, level, file, line, function,
|
||||
do_log_message(is_async_log_used(), mod_name, nullptr, level, file, line, function,
|
||||
false, location_hash_val, 0, log_data_func);
|
||||
tb->reset();//reset, than reuse the TraceBuffer
|
||||
}
|
||||
@ -475,7 +495,7 @@ const char *const ObLogger::errstr_[] = {"ERROR", "WARN", "INFO", "EDIAG", "WDIA
|
||||
|
||||
ObLogger::ObLogger()
|
||||
: ObBaseLogWriter(), log_file_(), max_file_size_(DEFAULT_MAX_FILE_SIZE), max_file_index_(0),
|
||||
name_id_map_(), id_level_map_(), wf_level_(OB_LOG_LEVEL_DBA_WARN), level_version_(0),
|
||||
name_id_map_(), id_level_map_(), wf_level_(OB_LOG_LEVEL_DBA_WARN), alert_log_level_(OB_LOG_LEVEL_DBA_INFO), level_version_(0),
|
||||
disable_thread_log_level_(false), force_check_(false), redirect_flag_(false), open_wf_flag_(false),
|
||||
enable_wf_flag_(false), rec_old_file_flag_(false), can_print_(true),
|
||||
enable_async_log_(true), use_multi_flush_(false), stop_append_log_(false), enable_perf_mode_(false),
|
||||
@ -575,13 +595,36 @@ void ObLogger::set_log_level(const int8_t level, int64_t version)
|
||||
update_easy_log_level();
|
||||
}
|
||||
|
||||
void ObLogger::set_alert_log_level(const char *level, int64_t version)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (check_and_set_level_version(version)) {
|
||||
if (NULL != level) {
|
||||
int8_t level_int = OB_LOG_LEVEL_INFO;
|
||||
if (OB_SUCC(level_str2int(level, level_int))) {
|
||||
set_log_level(level_int);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObLogger::set_alert_log_level(const int8_t level, int64_t version)
|
||||
{
|
||||
if (check_and_set_level_version(version)) {
|
||||
if (level >= OB_LOG_LEVEL_DBA_ERROR && level < OB_LOG_LEVEL_DBA_INFO) {
|
||||
alert_log_level_ = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ObLogger::set_file_name(const char *filename,
|
||||
const bool no_redirect_flag,
|
||||
const bool open_wf,
|
||||
const char *rs_filename,
|
||||
const char *elec_filename,
|
||||
const char *trace_filename,
|
||||
const char *audit_filename)
|
||||
const char *audit_filename,
|
||||
const char *alert_filename)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
redirect_flag_ = !no_redirect_flag;
|
||||
@ -601,6 +644,8 @@ void ObLogger::set_file_name(const char *filename,
|
||||
LOG_STDERR("fail to open log_file = %p, ret=%d\n", trace_filename, ret);
|
||||
} else if (NULL != audit_filename && OB_FAIL(log_file_[FD_AUDIT_FILE].open(audit_filename, false, false))) {
|
||||
LOG_STDERR("fail to open log_file = %p, ret=%d\n", audit_filename, ret);
|
||||
} else if (NULL != alert_filename && OB_FAIL(log_file_[FD_ALERT_FILE].open(alert_filename, false, false))) {
|
||||
LOG_STDERR("fail to open log_file = %p, ret=%d\n", alert_filename, ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,6 +717,7 @@ void ts_to_tv(int64_t ts, timeval &tv)
|
||||
|
||||
int ObLogger::log_head(const int64_t ts,
|
||||
const char *mod_name,
|
||||
const char *dba_event,
|
||||
const int32_t level,
|
||||
const char *file,
|
||||
const int32_t line,
|
||||
@ -693,31 +739,43 @@ int ObLogger::log_head(const int64_t ts,
|
||||
const int32_t errcode_buf_size = 32;
|
||||
char errcode_buf[errcode_buf_size];
|
||||
errcode_buf[0] = '\0';
|
||||
if (level == OB_LOG_LEVEL_DBA_ERROR
|
||||
|| level == OB_LOG_LEVEL_DBA_WARN
|
||||
|| level == OB_LOG_LEVEL_WARN
|
||||
|| level == OB_LOG_LEVEL_ERROR) {
|
||||
snprintf(errcode_buf, errcode_buf_size, "[errcode=%d]", errcode);
|
||||
}
|
||||
if (get_fd_type(mod_name) == FD_TRACE_FILE) {
|
||||
//forbid modify the format of logdata_printf
|
||||
ObPLogFDType log_type = get_fd_type(mod_name, level, dba_event);
|
||||
if (log_type == FD_ALERT_FILE) {
|
||||
dba_event = dba_event == nullptr ? "none" : dba_event;
|
||||
ret = logdata_printf(buf, buf_len, pos,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
|
||||
"[%ld][%s][T%lu][%s] ",
|
||||
"%04d-%02d-%02d %02d:%02d:%02d.%06ld"
|
||||
"|%s|%s|%s|%d|%lu|%ld|%s|%s|%s|%s:%d|",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
|
||||
tm.tm_sec, tv.tv_usec, GETTID(), GETTNAME(), GET_TENANT_ID(), ObCurTraceId::get_trace_id_str());
|
||||
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, dba_event, errcode,
|
||||
GET_TENANT_ID(), GETTID(), GETTNAME(), ObCurTraceId::get_trace_id_str(),
|
||||
function, base_file_name, line);
|
||||
} else {
|
||||
constexpr int cluster_id_buf_len = 8;
|
||||
char cluster_id_buf[cluster_id_buf_len] = {'\0'};
|
||||
(void)snprintf(cluster_id_buf, cluster_id_buf_len, "[C%lu]", GET_CLUSTER_ID());
|
||||
ret = logdata_printf(buf, buf_len, pos,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
|
||||
"%-5s %s%s (%s:%d) [%ld][%s]%s[T%lu][%s] [lt=%ld]%s ",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
|
||||
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, function,
|
||||
base_file_name, line, GETTID(), GETTNAME(), is_arb_replica_ ? cluster_id_buf : "",
|
||||
is_arb_replica_ ? GET_ARB_TENANT_ID() : GET_TENANT_ID(), ObCurTraceId::get_trace_id_str(),
|
||||
last_logging_cost_time_us_, errcode_buf);
|
||||
if (level == OB_LOG_LEVEL_DBA_ERROR
|
||||
|| level == OB_LOG_LEVEL_DBA_WARN
|
||||
|| level == OB_LOG_LEVEL_WARN
|
||||
|| level == OB_LOG_LEVEL_ERROR) {
|
||||
snprintf(errcode_buf, errcode_buf_size, "[errcode=%d]", errcode);
|
||||
}
|
||||
if (log_type == FD_TRACE_FILE) {
|
||||
//forbid modify the format of logdata_printf
|
||||
ret = logdata_printf(buf, buf_len, pos,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
|
||||
"[%ld][%s][T%lu][%s] ",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
|
||||
tm.tm_sec, tv.tv_usec, GETTID(), GETTNAME(), GET_TENANT_ID(), ObCurTraceId::get_trace_id_str());
|
||||
} else {
|
||||
constexpr int cluster_id_buf_len = 8;
|
||||
char cluster_id_buf[cluster_id_buf_len] = {'\0'};
|
||||
(void)snprintf(cluster_id_buf, cluster_id_buf_len, "[C%lu]", GET_CLUSTER_ID());
|
||||
ret = logdata_printf(buf, buf_len, pos,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d.%06ld] "
|
||||
"%-5s %s%s (%s:%d) [%ld][%s]%s[T%lu][%s] [lt=%ld]%s ",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
|
||||
tm.tm_sec, tv.tv_usec, errstr_[level], mod_name, function,
|
||||
base_file_name, line, GETTID(), GETTNAME(), is_arb_replica_ ? cluster_id_buf : "",
|
||||
is_arb_replica_ ? GET_ARB_TENANT_ID() : GET_TENANT_ID(), ObCurTraceId::get_trace_id_str(),
|
||||
last_logging_cost_time_us_, errcode_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -826,7 +884,7 @@ void ObLogger::rotate_log(const char *filename,
|
||||
}
|
||||
}
|
||||
|
||||
if (open_wf_flag_ && enable_wf_flag_) {
|
||||
if (open_wf_flag_ && enable_wf_flag_ && ObPLogFDType::FD_ALERT_FILE != fd_type) {
|
||||
if (max_file_index_ > 0) {
|
||||
if (OB_LIKELY(0 == pthread_mutex_lock(&file_index_mutex_))) {
|
||||
if (wf_file_list.size() >= max_file_index_) {
|
||||
@ -866,6 +924,7 @@ void ObLogger::check_file()
|
||||
check_file(log_file_[FD_AUDIT_FILE], false, false);
|
||||
check_file(log_file_[FD_ELEC_FILE], false, open_wf_flag_);
|
||||
check_file(log_file_[FD_TRACE_FILE], false, false);
|
||||
check_file(log_file_[FD_ALERT_FILE], false, false);
|
||||
}
|
||||
|
||||
void ObLogger::check_file(ObPLogFileStruct &log_struct, const bool redirect_flag, const bool open_wf_flag)
|
||||
@ -1091,6 +1150,28 @@ int ObLogger::parse_check(const char *str,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogger::parse_check_alert(const char *str, const int32_t str_length)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
HEAP_VAR(char[OB_MAX_CONFIG_VALUE_LEN], buffer) {
|
||||
const int32_t MAX_LEVEL_NAME_LENGTH = 10;
|
||||
if (NULL == str) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
} else {
|
||||
str_copy_trim(buffer, OB_MAX_CONFIG_VALUE_LEN, str, str_length);
|
||||
int8_t level_int = 0;
|
||||
if (OB_FAIL(level_str2int(buffer, level_int, true))) {
|
||||
OB_LOG(WARN, "failed to get level_int", KCSTRING(buffer), K(str_length), K(ret));
|
||||
} else if (level_int >= OB_LOG_LEVEL_DBA_ERROR && level_int <= OB_LOG_LEVEL_DBA_INFO) {
|
||||
alert_log_level_ = level_int;
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogger::parse_set(const char *str, const int32_t str_length, int64_t version)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -1183,7 +1264,7 @@ int ObLogger::get_mod_set(const char *par_mod, const char *sub_mod, const char *
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogger::level_str2int(const char *level_name, int8_t &level_int)
|
||||
int ObLogger::level_str2int(const char *level_name, int8_t &level_int, bool is_alert_log)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(level_name)) {
|
||||
@ -1192,7 +1273,7 @@ int ObLogger::level_str2int(const char *level_name, int8_t &level_int)
|
||||
} else {
|
||||
bool find_level = false;
|
||||
int8_t level_num = sizeof(errstr_) / sizeof(char *);
|
||||
for (int8_t level_index = 0;!find_level && level_index < level_num; level_index++) {
|
||||
for (int8_t level_index = level_num - 1;!find_level && level_index >= 0; level_index--) {
|
||||
if (0 == STRCASECMP(level_name, errstr_[level_index])) {
|
||||
level_int = level_index;
|
||||
find_level = true;
|
||||
@ -1201,7 +1282,7 @@ int ObLogger::level_str2int(const char *level_name, int8_t &level_int)
|
||||
if (!find_level) {
|
||||
ret = OB_LOG_LEVEL_INVALID;
|
||||
LOG_WARN("Invalid log level", K(ret));
|
||||
} else if (OB_LOG_LEVEL_INFO == level_int && info_as_wdiag_) {
|
||||
} else if (OB_LOG_LEVEL_INFO == level_int && info_as_wdiag_ && !is_alert_log) {
|
||||
level_int = OB_LOG_LEVEL_WARN;
|
||||
}
|
||||
}
|
||||
@ -1264,6 +1345,9 @@ int ObLogger::record_old_log_file()
|
||||
OB_LOG(WARN, "Get log files in log dir error", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_TMP_FAIL(get_log_files_in_dir(log_file_[FD_ALERT_FILE].filename_, &files, &wf_files))) {
|
||||
OB_LOG(WARN, "Get log files in log dir error", K(ret));
|
||||
}
|
||||
if (OB_FAIL(add_files_to_list(&files, &wf_files, file_list_, wf_file_list_))) {
|
||||
OB_LOG(WARN, "Add files to list error", K(ret));
|
||||
}
|
||||
@ -1432,6 +1516,9 @@ int ObLogger::init(const ObBaseLogWriterCfg &log_cfg,
|
||||
const bool is_arb_replica)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
LOG_DBA_INFO_V2(OB_SERVER_SYSLOG_SERVICE_INIT_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer syslog service init begin.");
|
||||
|
||||
static const char *thread_name = "OB_PLOG";
|
||||
void *buf = nullptr;
|
||||
@ -1482,6 +1569,10 @@ int ObLogger::init(const ObBaseLogWriterCfg &log_cfg,
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_SYSLOG_SERVICE_INIT_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer syslog service init fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
if (error_allocator_) {
|
||||
error_allocator_->~ObFIFOAllocator();
|
||||
error_allocator_ = nullptr;
|
||||
@ -1498,6 +1589,10 @@ int ObLogger::init(const ObBaseLogWriterCfg &log_cfg,
|
||||
ob_free(buf);
|
||||
}
|
||||
destroy();
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_SYSLOG_SERVICE_INIT_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer syslog service init success.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1575,7 +1670,7 @@ void ObLogger::flush_logs_to_file(ObPLogItem **log_item, const int64_t count)
|
||||
vec[fd_type][iovcnt[fd_type]].iov_base = log_item[i]->get_buf();
|
||||
vec[fd_type][iovcnt[fd_type]].iov_len = static_cast<size_t>(log_item[i]->get_data_len());
|
||||
iovcnt[fd_type] += 1;
|
||||
if ((enable_wf_flag_ && open_wf_flag_ && log_item[i]->get_log_level() <= wf_level_)) {
|
||||
if (enable_wf_flag_ && open_wf_flag_ && log_item[i]->get_log_level() <= wf_level_ && fd_type != FD_ALERT_FILE) {
|
||||
wf_vec[fd_type][wf_iovcnt[fd_type]].iov_base = log_item[i]->get_buf();
|
||||
wf_vec[fd_type][wf_iovcnt[fd_type]].iov_len = static_cast<size_t>(log_item[i]->get_data_len());
|
||||
wf_iovcnt[fd_type] += 1;
|
||||
@ -1919,8 +2014,10 @@ void ObLogger::issue_dba_error(const int errcode, const char *file, const int li
|
||||
{
|
||||
const char *base_file_name = strrchr(file, '/');
|
||||
base_file_name = (NULL != base_file_name) ? base_file_name + 1 : file;
|
||||
LOG_DBA_ERROR(OB_UNEXPECT_INTERNAL_ERROR,
|
||||
"errcode", errcode, "file", base_file_name, "line_no", line, "info", info_str);
|
||||
LOG_DBA_FORCE_PRINT(ERROR, OB_COMMON_UNEXPECT_INTERNAL_ERROR, OB_UNEXPECT_INTERNAL_ERROR,
|
||||
"An unexpected error(", errcode, ") occurred at ", base_file_name, ":", line, ". ",
|
||||
"Error info:\"", info_str, "\" ",
|
||||
"[suggestion] You can seek help from official technical personnel.");
|
||||
}
|
||||
|
||||
bool ObLogger::is_svr_file_opened()
|
||||
@ -1928,6 +2025,35 @@ bool ObLogger::is_svr_file_opened()
|
||||
return log_file_[FD_SVR_FILE].is_opened();
|
||||
}
|
||||
|
||||
bool ObLogger::need_to_print_dba(const int32_t level, bool force)
|
||||
{
|
||||
static thread_local ObCurTraceId::TraceId dba_log_trace_id[OB_LOG_LEVEL_DBA_WARN + 1];
|
||||
static thread_local int64_t dba_log_count[OB_LOG_LEVEL_DBA_WARN + 1];
|
||||
static const int64_t LOG_COUNT_WARN_THRESHOLD = 20;
|
||||
|
||||
bool need_to_print = false;
|
||||
if (level > alert_log_level_){
|
||||
// false
|
||||
} else if (level == OB_LOG_LEVEL_DBA_INFO) {
|
||||
need_to_print = true;
|
||||
} else if (force) {
|
||||
need_to_print = true;
|
||||
} else if (level == OB_LOG_LEVEL_DBA_ERROR || level == OB_LOG_LEVEL_DBA_WARN) {
|
||||
if (ObCurTraceId::get_trace_id()->is_default()) {
|
||||
need_to_print = true;
|
||||
} else if (dba_log_trace_id[level] != *ObCurTraceId::get_trace_id()) {
|
||||
dba_log_trace_id[level] = *ObCurTraceId::get_trace_id();
|
||||
dba_log_count[level] = 1;
|
||||
need_to_print = true;
|
||||
} else if ((++dba_log_count[level]) % LOG_COUNT_WARN_THRESHOLD == 0) {
|
||||
int ret = OB_ERR_UNEXPECTED;
|
||||
OB_LOG(WARN, "print too many alert logs with same trace id!", K(ret), "log_count", dba_log_count[level]);
|
||||
}
|
||||
}
|
||||
|
||||
return need_to_print;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
112
deps/oblib/src/lib/oblog/ob_log.h
vendored
112
deps/oblib/src/lib/oblog/ob_log.h
vendored
@ -44,6 +44,7 @@
|
||||
#include "lib/oblog/ob_syslog_rate_limiter.h"
|
||||
#include "lib/signal/ob_signal_handlers.h"
|
||||
#include "common/ob_common_utility.h"
|
||||
#include "lib/oblog/ob_log_dba_event.h"
|
||||
|
||||
#define OB_LOG_MAX_PAR_MOD_SIZE 64
|
||||
#define OB_LOG_MAX_SUB_MOD_SIZE 64
|
||||
@ -67,9 +68,11 @@ class ObLogCompressor;
|
||||
extern void allow_next_syslog(int64_t count = 1);
|
||||
extern int logdata_vprintf(char *buf, const int64_t buf_len, int64_t &pos, const char *fmt, va_list args);
|
||||
extern ObPLogFDType get_fd_type(const char *mod_name);
|
||||
extern ObPLogFDType get_fd_type(const char *mod_name, int32_t level, const char *dba_event);
|
||||
|
||||
#define OB_LOGGER ::oceanbase::common::ObLogger::get_logger()
|
||||
#define OB_LOG_NEED_TO_PRINT(level) (OB_UNLIKELY(OB_LOGGER.need_to_print(OB_LOG_LEVEL_##level)))
|
||||
#define OB_LOG_NEED_TO_PRINT_DBA(level, force) (OB_UNLIKELY(OB_LOGGER.need_to_print_dba(OB_LOG_LEVEL_##level, force)))
|
||||
|
||||
//@class ObLogIdLevelMap
|
||||
//@brief stroe the level of each par-module and sub-module. The key is module ID.
|
||||
@ -407,10 +410,13 @@ public:
|
||||
int64_t get_rs_write_size() const { return log_file_[FD_RS_FILE].write_size_; }
|
||||
int64_t get_elec_write_size() const { return log_file_[FD_ELEC_FILE].write_size_; }
|
||||
int64_t get_trace_write_size() const { return log_file_[FD_TRACE_FILE].write_size_; }
|
||||
int64_t get_alert_write_size() const { return log_file_[FD_ALERT_FILE].write_size_; }
|
||||
int64_t get_total_write_count() const { return log_file_[FD_SVR_FILE].write_count_; }
|
||||
int64_t get_rs_total_write_count() const { return log_file_[FD_RS_FILE].write_count_; }
|
||||
int64_t get_elec_total_write_count() const { return log_file_[FD_ELEC_FILE].write_count_; }
|
||||
int64_t get_trace_total_write_count() const { return log_file_[FD_TRACE_FILE].write_count_; }
|
||||
int64_t get_alert_total_write_count() const { return log_file_[FD_ALERT_FILE].write_count_; }
|
||||
|
||||
ObPLogFileStruct &get_elec_log() { return *(log_file_ + FD_ELEC_FILE); }
|
||||
|
||||
void insert_warning_buffer(const UserMsgLevel user_msg_level,
|
||||
@ -507,7 +513,63 @@ public:
|
||||
std::forward<const Args&&>(args)...);
|
||||
return ret;
|
||||
};
|
||||
log_it(mod_name, level, file, line, function, location_hash_val, errcode, log_data_func);
|
||||
log_it(mod_name, nullptr, level, file, line, function, location_hash_val, errcode, log_data_func);
|
||||
}
|
||||
|
||||
// for dba log
|
||||
__attribute__((noinline, cold)) int fill_value(char *buf, const int64_t buf_len, int64_t &pos)
|
||||
{
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
__attribute__((noinline, cold)) int fill_value(char *buf, const int64_t buf_len, int64_t &pos,
|
||||
const ObILogValue &value)
|
||||
{
|
||||
return value.print(buf, buf_len, pos);
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
__attribute__((noinline, cold)) int fill_value(char *buf, const int64_t buf_len, int64_t &pos,
|
||||
const ObILogValue &value,
|
||||
Args const & ... args)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ret = fill_value(buf, buf_len, pos, value);
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = fill_value(buf, buf_len, pos, std::forward<const Args&&>(args)...);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
__attribute__((noinline, cold)) int fill_log_buffer_value(char *data, const int64_t buf_len,
|
||||
int64_t &pos, bool with_quotes,
|
||||
const ObILogValue &value,
|
||||
Args const & ... args)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (with_quotes && OB_FAIL(logdata_printf(data, buf_len, pos, "\""))) {
|
||||
} else if (OB_FAIL(fill_value(data, buf_len, pos, value))) {
|
||||
} else if (OB_FAIL(fill_value(data, buf_len, pos, std::forward<const Args&&>(args)...))) {
|
||||
} else if (with_quotes) {
|
||||
ret = logdata_printf(data, buf_len, pos, "\"");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
__attribute__((noinline, cold)) void log_message_value(const char *mod_name, const char *dba_event,
|
||||
const int32_t level, const char *file, const int32_t line, const char *function,
|
||||
const uint64_t location_hash_val, const int errcode, bool with_quotes,
|
||||
Args const && ... args)
|
||||
{
|
||||
auto &&log_data_func = [&] (char *buf, const int64_t buf_len, int64_t &pos) {
|
||||
int ret = OB_SUCCESS;
|
||||
ret = fill_log_buffer_value(buf, buf_len, pos, with_quotes,
|
||||
std::forward<const Args&&>(args)...);
|
||||
return ret;
|
||||
};
|
||||
log_it(mod_name, dba_event, level, file, line, function, location_hash_val, errcode, log_data_func);
|
||||
}
|
||||
|
||||
|
||||
@ -517,6 +579,7 @@ public:
|
||||
|
||||
//@brief Check whether the level to print.
|
||||
bool __attribute__((weak, noinline, cold)) need_to_print(const int32_t level) { return (level <= get_log_level()); }
|
||||
bool __attribute__((weak, noinline, cold)) need_to_print_dba(const int32_t level, bool force = false);
|
||||
//@brief Check whether the level of the par-module to print.
|
||||
bool __attribute__((weak, noinline, cold)) need_to_print(const uint64_t par_mod_id, const int32_t level);
|
||||
//@brief Check whether the level of the sub-module to print.
|
||||
@ -536,7 +599,8 @@ public:
|
||||
const char *rs_filename = NULL,
|
||||
const char *elec_filename = NULL,
|
||||
const char *trace_filename = NULL,
|
||||
const char *audit_filename = NULL);
|
||||
const char *audit_filename = NULL,
|
||||
const char *alert_filename = NULL);
|
||||
|
||||
//whether log warn/error log to log.wf
|
||||
void set_log_warn(bool log_warn) { enable_wf_flag_ = log_warn; }
|
||||
@ -577,6 +641,8 @@ public:
|
||||
void set_log_level(const int32_t level, int64_t version = 0)
|
||||
{set_log_level(static_cast<int8_t>(level), version);}
|
||||
void set_log_level(const int8_t level, int64_t version = 0);
|
||||
void set_alert_log_level(const char *level, int64_t version = 0);
|
||||
void set_alert_log_level(const int8_t level, int64_t version = 0);
|
||||
int set_mod_log_levels(const char* level_str, int64_t version = 0);
|
||||
|
||||
void down_log_level(int64_t version = 0) {set_log_level(id_level_map_.get_level() + 1, version);}
|
||||
@ -592,9 +658,10 @@ public:
|
||||
void disable_thread_log_level() { disable_thread_log_level_ = true; }
|
||||
|
||||
//@brief Get the int8_t type representing the level in string.
|
||||
int level_str2int(const char *level_name, int8_t &level_int);
|
||||
int level_str2int(const char *level_name, int8_t &level_int, bool is_alert_log = false);
|
||||
|
||||
int parse_check(const char *str, const int32_t str_length);
|
||||
int parse_check_alert(const char *str, const int32_t str_length);
|
||||
//@brief Parse the string like "ALL.*:INFO, SQL.ENG:DEBUG, COMMON.*:ERROR",
|
||||
//and set the global level map.
|
||||
int parse_set(const char *str, const int32_t str_length, int64_t version = 0);
|
||||
@ -653,6 +720,7 @@ private:
|
||||
|
||||
int log_head(const int64_t ts,
|
||||
const char *mod_name,
|
||||
const char *dba_event,
|
||||
const int32_t level,
|
||||
const char *file,
|
||||
const int32_t line,
|
||||
@ -725,6 +793,7 @@ private:
|
||||
template<typename Function>
|
||||
void do_log_message(const bool is_async,
|
||||
const char *mod_name,
|
||||
const char *dba_event,
|
||||
int32_t level,
|
||||
const char *file,
|
||||
int32_t line,
|
||||
@ -736,6 +805,7 @@ private:
|
||||
|
||||
template<typename Function>
|
||||
void log_it(const char *mod_name,
|
||||
const char *dba_event,
|
||||
const int32_t level,
|
||||
const char *file,
|
||||
const int32_t line,
|
||||
@ -783,6 +853,7 @@ private:
|
||||
ObLogNameIdMap name_id_map_;
|
||||
ObLogIdLevelMap id_level_map_;//level of log-file
|
||||
int8_t wf_level_;//level of warning log-file
|
||||
int8_t alert_log_level_;//level of alert log-file
|
||||
int64_t level_version_;//version of log level
|
||||
|
||||
// Whether to disable the Thread Log Level function, the default is false, that is, the Thread Log Level is not disabled
|
||||
@ -915,6 +986,7 @@ inline void ObLogger::check_log_end(ObPLogItem &log_item, int64_t pos)
|
||||
|
||||
template<typename Function>
|
||||
void ObLogger::log_it(const char *mod_name,
|
||||
const char *dba_event,
|
||||
const int32_t level,
|
||||
const char *file,
|
||||
const int32_t line,
|
||||
@ -939,7 +1011,7 @@ void ObLogger::log_it(const char *mod_name,
|
||||
int64_t &pos = tb->get_pos();
|
||||
int64_t orig_pos = pos;
|
||||
int64_t ts = OB_TSC_TIMESTAMP.current_time();
|
||||
ret = log_head(ts, mod_name, level, file, line, function, errcode, buf, buf_len, pos);
|
||||
ret = log_head(ts, mod_name, dba_event, level, file, line, function, errcode, buf, buf_len, pos);
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = log_data_func(buf, buf_len, pos);
|
||||
}
|
||||
@ -957,7 +1029,7 @@ void ObLogger::log_it(const char *mod_name,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
do_log_message(is_async_log_used(), mod_name, level, file, line, function, true,
|
||||
do_log_message(is_async_log_used(), mod_name, dba_event, level, file, line, function, true,
|
||||
location_hash_val, errcode, log_data_func);
|
||||
}
|
||||
}
|
||||
@ -998,7 +1070,7 @@ inline void ObLogger::log_message_va(const char *mod_name,
|
||||
DEFER(va_end(args_cpy));
|
||||
return logdata_vprintf(buf, buf_len, pos, fmt, args_cpy);
|
||||
};
|
||||
log_it(mod_name, level, file, line, function, location_hash_val, errcode, log_data_func);
|
||||
log_it(mod_name, nullptr, level, file, line, function, location_hash_val, errcode, log_data_func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1135,6 +1207,7 @@ inline void ObLogger::check_probe(
|
||||
template<typename Function>
|
||||
inline void ObLogger::do_log_message(const bool is_async,
|
||||
const char *mod_name,
|
||||
const char *dba_event,
|
||||
int32_t level,
|
||||
const char *file,
|
||||
int32_t line,
|
||||
@ -1155,7 +1228,7 @@ inline void ObLogger::do_log_message(const bool is_async,
|
||||
bool disable = false;
|
||||
check_probe(file, line, location_hash_val, force_bt, disable);
|
||||
if(OB_UNLIKELY(disable)) return;
|
||||
auto fd_type = get_fd_type(mod_name);
|
||||
ObPLogFDType fd_type = get_fd_type(mod_name, level, dba_event);
|
||||
const int64_t log_size = limited_left_log_size_ + NORMAL_LOG_SIZE;
|
||||
limited_left_log_size_ = 0;
|
||||
BASIC_TIME_GUARD(tg, "ObLog");
|
||||
@ -1180,7 +1253,7 @@ inline void ObLogger::do_log_message(const bool is_async,
|
||||
int64_t buf_len = log_item->get_buf_size();
|
||||
int64_t pos = log_item->get_data_len();
|
||||
if (with_head) {
|
||||
if (OB_FAIL(log_head(start_ts, mod_name, level, file, line, function, errcode,
|
||||
if (OB_FAIL(log_head(start_ts, mod_name, dba_event, level, file, line, function, errcode,
|
||||
buf, buf_len, pos))) {
|
||||
LOG_STDERR("log_header error ret = %d\n", ret);
|
||||
}
|
||||
@ -1276,7 +1349,7 @@ _Pragma("GCC diagnostic pop")
|
||||
const int64_t buf_len = sizeof buf;
|
||||
int64_t pos = 0;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_TMP_FAIL(log_head(start_ts, mod_name, OB_LOG_LEVEL_ERROR, file, line, function,
|
||||
if (OB_TMP_FAIL(log_head(start_ts, mod_name, dba_event, OB_LOG_LEVEL_ERROR, file, line, function,
|
||||
errcode, buf, buf_len, pos))) {
|
||||
} else if (OB_TMP_FAIL(logdata_printf(buf, buf_len, pos,
|
||||
"LOGGER COST TOO MUCH TIME, cost: %ld, ", cost_time))) {
|
||||
@ -1308,6 +1381,27 @@ void OB_PRINT(const char *mod_name, const int32_t level, const char *file, const
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ... Args>
|
||||
void OB_PRINT_DBA(const char *mod_name, const char *mod_name_bracket,
|
||||
const char *dba_event, bool print_rd_log, const int32_t level,
|
||||
const char *file, const int32_t line,
|
||||
const char *function, const uint64_t location_hash_val,
|
||||
const int errcode,
|
||||
const char *, /* placeholder */
|
||||
Args const && ... args)
|
||||
{
|
||||
if (OB_LIKELY(!OB_LOGGER.get_guard())) {
|
||||
OB_LOGGER.get_guard() = true;
|
||||
OB_LOGGER.log_message_value(mod_name, dba_event, level, file, line, function, location_hash_val, errcode, true,
|
||||
std::forward<const Args&&>(args)...);
|
||||
if (print_rd_log) {
|
||||
OB_LOGGER.log_message_value(mod_name_bracket, nullptr, level, file, line, function, location_hash_val, errcode, false,
|
||||
std::forward<const Args&&>(args)...);
|
||||
}
|
||||
OB_LOGGER.get_guard() = false;
|
||||
}
|
||||
}
|
||||
|
||||
} // common
|
||||
} // oceanbase
|
||||
#endif
|
||||
|
43
deps/oblib/src/lib/oblog/ob_log_compressor.cpp
vendored
43
deps/oblib/src/lib/oblog/ob_log_compressor.cpp
vendored
@ -49,6 +49,7 @@ int ObLogCompressor::init()
|
||||
LOG_ERROR("failed to init ObThreadCond", K(ret));
|
||||
} else {
|
||||
strncpy(syslog_dir_, OB_SYSLOG_DIR, strlen(OB_SYSLOG_DIR));
|
||||
strncpy(alert_log_dir_, OB_ALERT_LOG_DIR, strlen(OB_ALERT_LOG_DIR));
|
||||
stopped_ = false;
|
||||
if (OB_FAIL(TG_SET_RUNNABLE_AND_START(TGDefIDs::SYSLOG_COMPRESS, *this))) {
|
||||
LOG_ERROR("failed to start log compression thread", K(ret));
|
||||
@ -238,6 +239,7 @@ void ObLogCompressor::log_compress_loop_()
|
||||
// record start time
|
||||
int64_t start_time = ObClockGenerator::getClock();
|
||||
bool enable_delete_file = max_disk_size_ > 0 || OB_LOGGER.get_max_file_index() > 0;
|
||||
ret = OB_SUCCESS;
|
||||
|
||||
// check whether need to compress or delete file
|
||||
int64_t total_size = 0;
|
||||
@ -256,7 +258,7 @@ void ObLogCompressor::log_compress_loop_()
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_ERROR("failed to open syslog directory", K(ret), K(errno), K(syslog_dir_));
|
||||
} else {
|
||||
while (OB_NOT_NULL(entry = readdir(dir))) {
|
||||
while (OB_SUCC(ret) && OB_NOT_NULL(entry = readdir(dir))) {
|
||||
if (strncmp(entry->d_name, ".", 1) == 0 || strncmp(entry->d_name, "..", 2) == 0) {
|
||||
continue;
|
||||
}
|
||||
@ -291,6 +293,39 @@ void ObLogCompressor::log_compress_loop_()
|
||||
}
|
||||
if (OB_NOT_NULL(dir)) {
|
||||
closedir(dir);
|
||||
dir = NULL;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
// skip
|
||||
} else if (OB_ISNULL(dir = opendir(alert_log_dir_))) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_ERROR("failed to open alert log directory", K(ret), K(errno), K(alert_log_dir_));
|
||||
} else {
|
||||
while (OB_SUCC(ret) && OB_NOT_NULL(entry = readdir(dir))) {
|
||||
if (strncmp(entry->d_name, ".", 1) == 0 || strncmp(entry->d_name, "..", 2) == 0) {
|
||||
continue;
|
||||
}
|
||||
snprintf(syslog_file.file_name_, OB_MAX_SYSLOG_FILE_NAME_SIZE, "%s/%s", alert_log_dir_, entry->d_name);
|
||||
if (stat(syslog_file.file_name_, &stat_info) == -1) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("failed to get file info", K(ret), K(errno), K(syslog_file.file_name_));
|
||||
continue;
|
||||
}
|
||||
if (S_ISREG(stat_info.st_mode)) {
|
||||
total_size += stat_info.st_size;
|
||||
int64_t tmp_time = stat_info.st_mtim.tv_sec * 1000000000L + stat_info.st_mtim.tv_nsec;
|
||||
syslog_file.mtime_ = tmp_time;
|
||||
if (enable_delete_file
|
||||
&& regexec(®ex_archive, entry->d_name, 0, NULL, 0) == 0
|
||||
&& OB_FAIL(oldest_files_.push(syslog_file))) {
|
||||
LOG_ERROR("failed to put file into array", K(ret), K(syslog_file.file_name_), K(tmp_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_NOT_NULL(dir)) {
|
||||
closedir(dir);
|
||||
dir = NULL;
|
||||
}
|
||||
|
||||
// get disk remaining size
|
||||
@ -301,7 +336,7 @@ void ObLogCompressor::log_compress_loop_()
|
||||
}
|
||||
|
||||
// compress syslog file if necessary
|
||||
if (!stopped_ && is_enable_compress() && disk_remaining_size < OB_SYSLOG_COMPRESS_RESERVE_SIZE) {
|
||||
if (OB_SUCC(ret) && !stopped_ && is_enable_compress() && disk_remaining_size < OB_SYSLOG_COMPRESS_RESERVE_SIZE) {
|
||||
if (compressor_ != next_compressor_) {
|
||||
compressor_ = next_compressor_;
|
||||
}
|
||||
@ -309,7 +344,7 @@ void ObLogCompressor::log_compress_loop_()
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("unexpected error, compressor is null", K(ret));
|
||||
} else {
|
||||
for (int i = 0; i < OB_SYSLOG_COMPRESS_TYPE_COUNT && is_enable_compress(); i++) {
|
||||
for (int i = 0; OB_SUCC(ret) && i < OB_SYSLOG_COMPRESS_TYPE_COUNT && is_enable_compress(); i++) {
|
||||
if (log_file_count[i] > min_uncompressed_count_) {
|
||||
int64_t file_size = get_file_size_(compress_files[i]);
|
||||
if (OB_FAIL(compress_single_file_(compress_files[i], src_buf, dest_buf))) {
|
||||
@ -327,7 +362,7 @@ void ObLogCompressor::log_compress_loop_()
|
||||
|
||||
// delete oldest syslog file if necessary
|
||||
enable_delete_file = enable_delete_file && (max_disk_size_ > 0 || OB_LOGGER.get_max_file_index() > 0);
|
||||
if (!stopped_ && enable_delete_file && disk_remaining_size < OB_SYSLOG_DELETE_RESERVE_SIZE) {
|
||||
if (OB_SUCC(ret) && !stopped_ && enable_delete_file && disk_remaining_size < OB_SYSLOG_DELETE_RESERVE_SIZE) {
|
||||
int array_size = oldest_files_.count();
|
||||
const char *delete_file = NULL;
|
||||
const ObSyslogFile *syslog_ptr = NULL;
|
||||
|
5
deps/oblib/src/lib/oblog/ob_log_compressor.h
vendored
5
deps/oblib/src/lib/oblog/ob_log_compressor.h
vendored
@ -42,6 +42,7 @@ static const int64_t OB_SYSLOG_COMPRESS_RESERVE_SIZE = 4 * (1LL << 30); // 4GB
|
||||
static const int64_t OB_SYSLOG_DELETE_RESERVE_SIZE = 2 * (1LL << 30); // 2GB
|
||||
static const int64_t OB_SYSLOG_COMPRESS_LOOP_INTERVAL = 5000000; // 5s
|
||||
static const char OB_SYSLOG_DIR[] = "log"; // same as LOG_DIR in src/observer/main.cpp
|
||||
static const char OB_ALERT_LOG_DIR[] = "log/alert"; // same as ALERT_DIR in src/observer/main.cpp
|
||||
static const char OB_SYSLOG_COMPRESS_ZSTD_SUFFIX[] = ".zst"; // name suffix of file compressed by zstd
|
||||
static const char OB_UNCOMPRESSED_SYSLOG_FILE_PATTERN[] = "^[a-z]+\\.log\\.[0-9]+$"; // only uncompressed files
|
||||
static const char OB_COMPRESSED_SYSLOG_FILE_PATTERN[] = "^[a-z]+\\.log\\.[0-9]+\\.[a-z0-9]+$"; // only compressed files
|
||||
@ -52,8 +53,9 @@ static const char *OB_SYSLOG_FILE_PREFIX[OB_SYSLOG_COMPRESS_TYPE_COUNT] =
|
||||
"rootservice.log", // FD_RS_FILE
|
||||
"election.log", // FD_ELEC_FILE
|
||||
"trace.log", // FD_TRACE_FILE
|
||||
// no need to compress audit log and alert log
|
||||
};
|
||||
STATIC_ASSERT(MAX_FD_FILE == 5, "if you add a new log type, add it's prefix here !!!");
|
||||
STATIC_ASSERT(MAX_FD_FILE == 6, "if you add a new log type, add it's prefix here !!!");
|
||||
|
||||
#define OB_LOG_COMPRESSOR ::oceanbase::common::ObLogCompressor::get_log_compressor()
|
||||
|
||||
@ -182,6 +184,7 @@ private:
|
||||
int64_t max_disk_size_;
|
||||
int64_t min_uncompressed_count_;
|
||||
char syslog_dir_[64];
|
||||
char alert_log_dir_[64];
|
||||
ObCompressorType compress_func_;
|
||||
ObCompressor *compressor_;
|
||||
ObCompressor *next_compressor_;
|
||||
|
22
deps/oblib/src/lib/oblog/ob_log_dba_event.cpp
vendored
Normal file
22
deps/oblib/src/lib/oblog/ob_log_dba_event.cpp
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "lib/oblog/ob_log_dba_event.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
DEFINE_DBA_EVENT_LIST_CPP(server_start)
|
||||
DEFINE_DBA_EVENT_LIST_CPP(bootstrap)
|
||||
}
|
||||
}
|
254
deps/oblib/src/lib/oblog/ob_log_dba_event.h
vendored
Normal file
254
deps/oblib/src/lib/oblog/ob_log_dba_event.h
vendored
Normal file
@ -0,0 +1,254 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCEANBASE_LIB_OBLOG_OB_LOG_DBA_EVENT_
|
||||
#define OCEANBASE_LIB_OBLOG_OB_LOG_DBA_EVENT_
|
||||
|
||||
#include "lib/utility/ob_macro_utils.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
/* Do not use the following macros */
|
||||
#define DBA_EVENT(event) const char* const event = #event;
|
||||
|
||||
#define DBA_EVENTS_1(obj) DBA_EVENT(obj)
|
||||
#define DBA_EVENTS_2(obj, args...) DBA_EVENT(obj); DBA_EVENTS_1(args)
|
||||
#define DBA_EVENTS_3(obj, args...) DBA_EVENT(obj); DBA_EVENTS_2(args)
|
||||
#define DBA_EVENTS_4(obj, args...) DBA_EVENT(obj); DBA_EVENTS_3(args)
|
||||
#define DBA_EVENTS_5(obj, args...) DBA_EVENT(obj); DBA_EVENTS_4(args)
|
||||
#define DBA_EVENTS_6(obj, args...) DBA_EVENT(obj); DBA_EVENTS_5(args)
|
||||
#define DBA_EVENTS_7(obj, args...) DBA_EVENT(obj); DBA_EVENTS_6(args)
|
||||
#define DBA_EVENTS_8(obj, args...) DBA_EVENT(obj); DBA_EVENTS_7(args)
|
||||
#define DBA_EVENTS_9(obj, args...) DBA_EVENT(obj); DBA_EVENTS_8(args)
|
||||
#define DBA_EVENTS_10(obj, args...) DBA_EVENT(obj); DBA_EVENTS_9(args)
|
||||
#define DBA_EVENTS_11(obj, args...) DBA_EVENT(obj); DBA_EVENTS_10(args)
|
||||
#define DBA_EVENTS_12(obj, args...) DBA_EVENT(obj); DBA_EVENTS_11(args)
|
||||
#define DBA_EVENTS_13(obj, args...) DBA_EVENT(obj); DBA_EVENTS_12(args)
|
||||
#define DBA_EVENTS_14(obj, args...) DBA_EVENT(obj); DBA_EVENTS_13(args)
|
||||
#define DBA_EVENTS_15(obj, args...) DBA_EVENT(obj); DBA_EVENTS_14(args)
|
||||
#define DBA_EVENTS_16(obj, args...) DBA_EVENT(obj); DBA_EVENTS_15(args)
|
||||
#define DBA_EVENTS_17(obj, args...) DBA_EVENT(obj); DBA_EVENTS_16(args)
|
||||
#define DBA_EVENTS_18(obj, args...) DBA_EVENT(obj); DBA_EVENTS_17(args)
|
||||
#define DBA_EVENTS_19(obj, args...) DBA_EVENT(obj); DBA_EVENTS_18(args)
|
||||
#define DBA_EVENTS_20(obj, args...) DBA_EVENT(obj); DBA_EVENTS_19(args)
|
||||
#define DBA_EVENTS_21(obj, args...) DBA_EVENT(obj); DBA_EVENTS_20(args)
|
||||
#define DBA_EVENTS_22(obj, args...) DBA_EVENT(obj); DBA_EVENTS_21(args)
|
||||
#define DBA_EVENTS_23(obj, args...) DBA_EVENT(obj); DBA_EVENTS_22(args)
|
||||
#define DBA_EVENTS_24(obj, args...) DBA_EVENT(obj); DBA_EVENTS_23(args)
|
||||
#define DBA_EVENTS_25(obj, args...) DBA_EVENT(obj); DBA_EVENTS_24(args)
|
||||
#define DBA_EVENTS_26(obj, args...) DBA_EVENT(obj); DBA_EVENTS_25(args)
|
||||
#define DBA_EVENTS_27(obj, args...) DBA_EVENT(obj); DBA_EVENTS_26(args)
|
||||
#define DBA_EVENTS_28(obj, args...) DBA_EVENT(obj); DBA_EVENTS_27(args)
|
||||
#define DBA_EVENTS_29(obj, args...) DBA_EVENT(obj); DBA_EVENTS_28(args)
|
||||
#define DBA_EVENTS_30(obj, args...) DBA_EVENT(obj); DBA_EVENTS_29(args)
|
||||
|
||||
#define DBA_EVENTS_(N, ...) CONCAT(DBA_EVENTS_, N)(__VA_ARGS__)
|
||||
#define DBA_EVENTS(...) DBA_EVENTS_(ARGS_NUM(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define LIST_EVENT_COUNT(list_name) list_name ##_event_count
|
||||
#define LIST_CUR_STEP(list_name) list_name ## _cur_step
|
||||
|
||||
/* You can define DBA event using the following macros. */
|
||||
#define DBA_INFO_EVENT(event) DBA_EVENT(event)
|
||||
#define DBA_WARN_EVENT(event) DBA_EVENT(event)
|
||||
#define DBA_ERROR_EVENT(event) DBA_EVENT(event)
|
||||
|
||||
/* If you need to define a series of steps for a fixed process, you can use the following macro.
|
||||
* DEFINE_DBA_EVENT_LIST_H is used in the current file.
|
||||
* DEFINE_DBA_EVENT_LIST_CPP is used in the corresponding source code file.
|
||||
*/
|
||||
#define DEFINE_DBA_EVENT_LIST_H(list_name, args...) \
|
||||
DBA_EVENTS(args); \
|
||||
static const int LIST_EVENT_COUNT(list_name) = ARGS_NUM(args); \
|
||||
void list_name##_thread_local_step_reset(); \
|
||||
int list_name##_thread_local_step_inc(); \
|
||||
int list_name##_thread_local_step_get();
|
||||
|
||||
#define DEFINE_DBA_EVENT_LIST_CPP(list_name) \
|
||||
static thread_local int LIST_CUR_STEP(list_name); \
|
||||
void list_name##_thread_local_step_reset() { LIST_CUR_STEP(list_name) = 0; } \
|
||||
int list_name##_thread_local_step_inc() \
|
||||
{ \
|
||||
LIST_CUR_STEP(list_name) = (LIST_CUR_STEP(list_name) % LIST_EVENT_COUNT(list_name)) + 1; \
|
||||
return LIST_CUR_STEP(list_name); \
|
||||
} \
|
||||
int list_name##_thread_local_step_get() { return LIST_CUR_STEP(list_name); }
|
||||
|
||||
/* The following macro prints the sequence number of the current step.
|
||||
* DBA_STEP_RESET can reset this sequence number, which you can call before the process starts.
|
||||
* DBA_STEP_INC_INFO will add one to step, and then print the current step number. (for DBA_INFO, DBA_ERROR)
|
||||
* DBA_STEP_INFO just print the current step number. (for DBA_WARN)
|
||||
* for example, use DBA_STEP_INC_INFO(init) may print: "[init 2/9] "
|
||||
*/
|
||||
#define DBA_STEP_INC_INFO(list_name) "[", #list_name, " ", \
|
||||
list_name##_thread_local_step_inc(), "/", \
|
||||
LIST_EVENT_COUNT(list_name), "] "
|
||||
#define DBA_STEP_INFO(list_name) "[", #list_name, " ", \
|
||||
list_name##_thread_local_step_get(), "/", \
|
||||
LIST_EVENT_COUNT(list_name), "] "
|
||||
#define DBA_STEP_RESET(list_name) list_name##_thread_local_step_reset();
|
||||
|
||||
/* common event (common, lib, share) */
|
||||
// DBA INFO
|
||||
|
||||
// DBA WARN
|
||||
DBA_WARN_EVENT(OB_LIB_ALLOCATE_MEMORY_FAIL)
|
||||
|
||||
// DBA ERROR
|
||||
DBA_ERROR_EVENT(OB_SHARE_PRIMARY_KEY_SEQUENCE_EXHAUSTED)
|
||||
DBA_ERROR_EVENT(OB_SHARE_OUTOF_DISK_SPACE)
|
||||
DBA_ERROR_EVENT(OB_COMMON_UNEXPECT_INTERNAL_ERROR)
|
||||
|
||||
/* rpc event */
|
||||
DBA_WARN_EVENT(OB_RPC_COST_TOO_MUCH_TIME)
|
||||
|
||||
/* system event (server) */
|
||||
DBA_ERROR_EVENT(OB_COMMON_DISK_INVALID)
|
||||
DBA_ERROR_EVENT(OB_SERVER_GET_IFNAME_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_SET_LOCAL_IP_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_TENANT_NAME_NOT_EMPTY)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_ALL_PARAMS_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_READ_FILE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_ULIMIT_FILE_NOT_EXIST)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_MAX_MAP_COUNT_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_MIN_FREE_KBYTES_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_OVERCOMMIT_MEMORY_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_FS_FILE_MAX_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_ULIMIT_OPEN_FILES_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_ULIMIT_MAX_USER_PROCESSES_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_ULIMIT_STACK_SIZE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_CHECK_CURRENT_CLOCKSOURCE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_THREAD_PANIC)
|
||||
DBA_ERROR_EVENT(OB_SERVER_PS_STMT_CHECKSUM_MISMATCH)
|
||||
DBA_ERROR_EVENT(OB_SERVER_LISTEN_FAIL)
|
||||
DBA_WARN_EVENT(OB_SERVER_DEVICE_NAME_MISMATCH)
|
||||
|
||||
/* tenant related event */
|
||||
DBA_ERROR_EVENT(OB_TENANT_REQUEST_QUEUE_FULL)
|
||||
|
||||
/* sql event */
|
||||
// ERROR
|
||||
DBA_WARN_EVENT(OB_SQL_INSERT_AFFECTED_ROW_FAIL)
|
||||
DBA_WARN_EVENT(OB_SQL_DELETE_AFFECTED_ROW_FAIL)
|
||||
DBA_WARN_EVENT(OB_SQL_UPDATE_AFFECTED_ROW_FAIL)
|
||||
|
||||
/* storage event */
|
||||
// WARN
|
||||
DBA_WARN_EVENT(OB_STORAGE_LS_COUNT_REACH_UPPER_LIMIT)
|
||||
DBA_WARN_EVENT(OB_STORAGE_MEMTABLE_REFRESH_TOO_MUCH_TIME)
|
||||
|
||||
// ERROR
|
||||
DBA_ERROR_EVENT(OB_STORAGE_MEMTABLE_REFRESH_TIMEOUT)
|
||||
DBA_ERROR_EVENT(OB_STORAGE_DEFENSIVE_CHECK_FAIL)
|
||||
|
||||
/* trans event */
|
||||
// WARN
|
||||
DBA_WARN_EVENT(OB_TRANS_LIVE_TOO_LONG)
|
||||
|
||||
// ERROR
|
||||
DBA_ERROR_EVENT(OB_TRANS_COMMIT_COST_TOO_MUCH_TIME)
|
||||
|
||||
/* rootservice event */
|
||||
// ERROR
|
||||
DBA_ERROR_EVENT(OB_ROOTSERVICE_START_FAIL)
|
||||
|
||||
/* election event */
|
||||
|
||||
/* clog event */
|
||||
// ERROR
|
||||
DBA_ERROR_EVENT(OB_LOG_ALLOCATE_DISK_SPACE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_LOG_NEW_DISK_SIZE_NOT_ENOUGH)
|
||||
DBA_ERROR_EVENT(OB_LOG_CHECKSUM_MISMATCH)
|
||||
DBA_ERROR_EVENT(OB_LOG_DISK_SPACE_ALMOST_FULL)
|
||||
DBA_ERROR_EVENT(OB_LOG_PWRITE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_LOG_EXTERNAL_FILE_EXIST)
|
||||
DBA_ERROR_EVENT(OB_LOG_LEADER_RECONFIRM_TIMEOUT)
|
||||
DBA_ERROR_EVENT(OB_LOG_LEADER_LOG_SYNC_TIMEOUT)
|
||||
DBA_ERROR_EVENT(OB_LOG_REPLAY_FAIL)
|
||||
DBA_ERROR_EVENT(OB_LOG_RECYCLE_BEFORE_ARCHIVE)
|
||||
DBA_ERROR_EVENT(OB_LOG_ARCHIVE_DEVICE_FULL)
|
||||
DBA_ERROR_EVENT(OB_FAILURE_LOG_DISK_HUNG)
|
||||
DBA_ERROR_EVENT(OB_FAILURE_DATA_DISK_HUNG)
|
||||
DBA_ERROR_EVENT(OB_FAILURE_OUTOF_DATA_DISK_SPACE)
|
||||
|
||||
/* observer thread start event */
|
||||
// INFO
|
||||
|
||||
DEFINE_DBA_EVENT_LIST_H(server_start,
|
||||
OB_SERVER_START_BEGIN,
|
||||
OB_SERVER_SYSLOG_SERVICE_INIT_BEGIN,
|
||||
OB_SERVER_SYSLOG_SERVICE_INIT_SUCCESS,
|
||||
OB_SERVER_INIT_BEGIN,
|
||||
OB_SERVER_INIT_SUCCESS,
|
||||
OB_SERVER_INSTANCE_START_BEGIN,
|
||||
OB_SERVER_INSTANCE_START_SUCCESS,
|
||||
OB_SERVER_BLOCK_MANAGER_START_BEGIN,
|
||||
OB_SERVER_BLOCK_MANAGER_START_SUCCESS,
|
||||
OB_SERVER_WAIT_MULTI_TENANT_SYNCED_BEGIN,
|
||||
OB_SERVER_WAIT_MULTI_TENANT_SYNCED_SUCCESS,
|
||||
OB_SERVER_WAIT_SCHEMA_READY_BEGIN,
|
||||
OB_SERVER_WAIT_SCHEMA_READY_SUCCESS,
|
||||
OB_SERVER_CHECK_USER_TENANT_SCHEMA_REFRESHED_BEGIN,
|
||||
OB_SERVER_CHECK_USER_TENANT_SCHEMA_REFRESHED_FINISH,
|
||||
OB_SERVER_CHECK_LOG_REPLAY_OVER_BEGIN,
|
||||
OB_SERVER_CHECK_LOG_REPLAY_OVER_FINISH,
|
||||
OB_SERVER_START_SUCCESS
|
||||
);
|
||||
DBA_INFO_EVENT(OB_SERVER_WAIT_BEGIN)
|
||||
DBA_INFO_EVENT(OB_SERVER_WAIT_SUCCESS)
|
||||
DBA_INFO_EVENT(OB_SERVER_STOP_BEGIN)
|
||||
DBA_INFO_EVENT(OB_SERVER_STOP_SUCCESS)
|
||||
|
||||
// DBA WARN
|
||||
// DBA ERROR
|
||||
DBA_ERROR_EVENT(OB_SERVER_SYSLOG_SERVICE_INIT_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_INIT_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_INSTANCE_START_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_BLOCK_MANAGER_START_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_WAIT_MULTI_TENANT_SYNCED_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_WAIT_SCHEMA_READY_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_START_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_WAIT_FAIL)
|
||||
DBA_ERROR_EVENT(OB_SERVER_STOP_FAIL)
|
||||
|
||||
/* observer bootstrap event */
|
||||
// DBA INFO
|
||||
DEFINE_DBA_EVENT_LIST_H(bootstrap,
|
||||
OB_BOOTSTRAP_BEGIN,
|
||||
OB_BOOTSTRAP_CREATE_ALL_SCHEMA_BEGIN,
|
||||
OB_BOOTSTRAP_CREATE_ALL_SCHEMA_SUCCESS,
|
||||
OB_BOOTSTRAP_CREATE_SYS_TENANT_BEGIN,
|
||||
OB_BOOTSTRAP_CREATE_SYS_TENANT_SUCCESS,
|
||||
OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_BEGIN,
|
||||
OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_SUCCESS,
|
||||
OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_BEGIN,
|
||||
OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_SUCCESS,
|
||||
OB_BOOTSTRAP_SUCCESS
|
||||
);
|
||||
DBA_INFO_EVENT(OB_BOOTSTRAP_PREPARE_BEGIN)
|
||||
DBA_INFO_EVENT(OB_BOOTSTRAP_PREPARE_SUCCESS)
|
||||
|
||||
// DBA WARN
|
||||
// DBA ERROR
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_PREPARE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_CREATE_ALL_SCHEMA_FAIL)
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_CREATE_SYS_TENANT_FAIL)
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_FAIL)
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_FAIL)
|
||||
DBA_ERROR_EVENT(OB_BOOTSTRAP_FAIL)
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
#endif // OCEANBASE_LIB_OBLOG_OB_LOG_DBA_EVENT_
|
1
deps/oblib/src/lib/oblog/ob_log_level.h
vendored
1
deps/oblib/src/lib/oblog/ob_log_level.h
vendored
@ -30,6 +30,7 @@ namespace common
|
||||
|
||||
// WARN log, show as "WARN" in log file
|
||||
#define OB_LOG_LEVEL_DBA_WARN 1
|
||||
#define OB_LOG_LEVEL_DBA_INFO 2
|
||||
#define OB_LOG_LEVEL_INFO 2
|
||||
|
||||
// Error Diagnosis log, LEVEL_ERROR is an alias of EDIAG, show as "EDIAG" in log file
|
||||
|
54
deps/oblib/src/lib/oblog/ob_log_module.h
vendored
54
deps/oblib/src/lib/oblog/ob_log_module.h
vendored
@ -1281,12 +1281,17 @@ extern const char *ob_strerror(const int oberr);
|
||||
} // end namespace common
|
||||
} // end namespace oceanbase
|
||||
|
||||
#define LOG_PREFIX_TO_STRING_(mod) #mod
|
||||
#define LOG_PREFIX_TO_STRING(mod) LOG_PREFIX_TO_STRING_(mod)
|
||||
#define LOG_PREFIX_TO_STRING_BRACKET(mod) "[" LOG_PREFIX_TO_STRING(mod) "] "
|
||||
#define DBA_LOG_PRINT_INTERVAL (10 * 1000 * 1000)
|
||||
|
||||
#define LOG_DBA_ERROR(errcode, args...) \
|
||||
do \
|
||||
{ \
|
||||
CHECK_LOG_USER_CONST_FMT(errcode); \
|
||||
if (OB_LOG_NEED_TO_PRINT(DBA_ERROR)) { \
|
||||
::oceanbase::common::OB_PRINT("", OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_ERROR), errcode, ob_strerror(errcode), LOG_KVS(args)); \
|
||||
::oceanbase::common::OB_PRINT(LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_ERROR), errcode, ob_strerror(errcode), LOG_KVS(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -1295,11 +1300,56 @@ extern const char *ob_strerror(const int oberr);
|
||||
{ \
|
||||
CHECK_LOG_USER_CONST_FMT(errcode); \
|
||||
if (OB_LOG_NEED_TO_PRINT(DBA_WARN)) { \
|
||||
::oceanbase::common::OB_PRINT("", OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_WARN), errcode, ob_strerror(errcode), LOG_KVS(args)); \
|
||||
::oceanbase::common::OB_PRINT(LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_WARN), errcode, ob_strerror(errcode), LOG_KVS(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LOG_DBA_ERROR_BASE(dba_event, print_rd_log, errcode, args...) \
|
||||
do \
|
||||
{ \
|
||||
if ((!ObCurTraceId::get_trace_id()->is_default() || REACH_TIME_INTERVAL(DBA_LOG_PRINT_INTERVAL)) && OB_LOG_NEED_TO_PRINT_DBA(DBA_ERROR, false)) { \
|
||||
::oceanbase::common::OB_PRINT_DBA(LOG_PREFIX_TO_STRING(USING_LOG_PREFIX), LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), \
|
||||
dba_event, print_rd_log, OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_ERROR), errcode, LOG_VALUES(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LOG_DBA_WARN_BASE(dba_event, print_rd_log, errcode, args...) \
|
||||
do \
|
||||
{ \
|
||||
if ((!ObCurTraceId::get_trace_id()->is_default() || REACH_TIME_INTERVAL(DBA_LOG_PRINT_INTERVAL)) && OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false)) { \
|
||||
::oceanbase::common::OB_PRINT_DBA(LOG_PREFIX_TO_STRING(USING_LOG_PREFIX), LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), \
|
||||
dba_event, print_rd_log, OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_WARN), errcode, LOG_VALUES(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define LOG_DBA_INFO_BASE(dba_event, print_rd_log, args...) \
|
||||
do \
|
||||
{ \
|
||||
if (REACH_TIME_INTERVAL(DBA_LOG_PRINT_INTERVAL) && OB_LOG_NEED_TO_PRINT_DBA(DBA_INFO, false)) { \
|
||||
::oceanbase::common::OB_PRINT_DBA(LOG_PREFIX_TO_STRING(USING_LOG_PREFIX), LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), \
|
||||
dba_event, print_rd_log, OB_LOG_LEVEL_DIRECT_NO_ERRCODE(DBA_INFO), OB_SUCCESS, LOG_VALUES(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// LOG_DBA_FORCE_PRINT: print both dba log(alert.log) and rd log(observer.log) forcely
|
||||
#define LOG_DBA_FORCE_PRINT(level, dba_event, errcode, args...) \
|
||||
do \
|
||||
{ \
|
||||
if (OB_LOG_NEED_TO_PRINT_DBA(level, true)) { \
|
||||
::oceanbase::common::OB_PRINT_DBA(LOG_PREFIX_TO_STRING(USING_LOG_PREFIX), LOG_PREFIX_TO_STRING_BRACKET(USING_LOG_PREFIX), \
|
||||
dba_event, true, OB_LOG_LEVEL_DIRECT_NO_ERRCODE(level), errcode, LOG_VALUES(args)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// LOG_DBA_XXX_V2: print both dba log(alert.log) and rd log(observer.log)
|
||||
#define LOG_DBA_ERROR_V2(dba_event, errcode, args...) LOG_DBA_ERROR_BASE(dba_event, true, errcode, args)
|
||||
#define LOG_DBA_WARN_V2(dba_event, errcode, args...) LOG_DBA_WARN_BASE(dba_event, true, errcode, args)
|
||||
#define LOG_DBA_INFO_V2(dba_event, args...) LOG_DBA_INFO_BASE(dba_event, true, args)
|
||||
|
||||
// LOG_DBA_XXX_: print dba log only(alert.log)
|
||||
#define LOG_DBA_ERROR_(dba_event, errcode, args...) LOG_DBA_ERROR_BASE(dba_event, false, errcode, args)
|
||||
#define LOG_DBA_WARN_(dba_event, errcode, args...) LOG_DBA_WARN_BASE(dba_event, false, errcode, args)
|
||||
#define LOG_DBA_INFO_(dba_event, args...) LOG_DBA_INFO_BASE(dba_event, false, args)
|
||||
|
||||
// define USING_LOG_PREFIX in .cpp file to use LOG_ERROR, LOG_WARN ... macros
|
||||
//
|
||||
|
102
deps/oblib/src/lib/oblog/ob_log_print_kv.h
vendored
102
deps/oblib/src/lib/oblog/ob_log_print_kv.h
vendored
@ -578,7 +578,71 @@ private:
|
||||
const T &value_;
|
||||
};
|
||||
|
||||
// for dba log (alert.log)
|
||||
template<class T>
|
||||
inline int logdata_print_value(char *buf, const int64_t buf_len, int64_t &pos, T obj)
|
||||
{
|
||||
return logdata_print_obj(buf, buf_len, pos, obj);
|
||||
}
|
||||
template <>
|
||||
inline int logdata_print_value<char*>(char *buf, const int64_t buf_len, int64_t &pos, char *obj)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (NULL == obj) {
|
||||
ret = logdata_printf(buf, buf_len, pos, "NULL");
|
||||
} else {
|
||||
ret = logdata_printf(buf, buf_len, pos, "%s", obj);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
template <>
|
||||
inline int logdata_print_value<const char*>(char *buf, const int64_t buf_len, int64_t &pos, const char *obj)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (NULL == obj) {
|
||||
ret = logdata_printf(buf, buf_len, pos, "NULL");
|
||||
} else {
|
||||
ret = logdata_printf(buf, buf_len, pos, "%s", obj);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
class ObILogValue
|
||||
{
|
||||
public:
|
||||
virtual int print(char *buf, int64_t buf_len, int64_t &pos) const = 0;
|
||||
};
|
||||
|
||||
template<typename T, const bool is_rvalue>
|
||||
class ObLogValue;
|
||||
|
||||
template<typename T>
|
||||
class ObLogValue<T, false> : public ObILogValue
|
||||
{
|
||||
public:
|
||||
ObLogValue(const T &value) : value_(value) {}
|
||||
int print(char *buf, int64_t buf_len, int64_t &pos) const override
|
||||
{
|
||||
return logdata_print_value(buf, buf_len, pos, value_);
|
||||
}
|
||||
private:
|
||||
const T &value_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ObLogValue<T, true> : public ObILogValue
|
||||
{
|
||||
public:
|
||||
ObLogValue(const T &&value) : value_(unmove(value)) {}
|
||||
int print(char *buf, int64_t buf_len, int64_t &pos) const override
|
||||
{
|
||||
return logdata_print_value(buf, buf_len, pos, value_);
|
||||
}
|
||||
private:
|
||||
const T &value_;
|
||||
};
|
||||
|
||||
} // common
|
||||
}
|
||||
|
||||
#define LOG_PRINT_INFO(obj) \
|
||||
@ -742,4 +806,42 @@ private:
|
||||
#define LOG_KVS_(N, ...) CONCAT(LOG_KVS_, N)(__VA_ARGS__)
|
||||
#define LOG_KVS(...) "placeholder" LOG_KVS_(ARGS_NUM(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#define LOG_VALUE(obj) \
|
||||
(::oceanbase::common::ObILogValue&&)::oceanbase::common::ObLogValue<decltype(obj), \
|
||||
std::is_rvalue_reference<decltype((obj))&&>::value>(obj)
|
||||
#define LOG_VALUES_0()
|
||||
#define LOG_VALUES_1(obj) , LOG_VALUE(obj)
|
||||
#define LOG_VALUES_2(obj, args...) , LOG_VALUE(obj) LOG_VALUES_1(args)
|
||||
#define LOG_VALUES_3(obj, args...) , LOG_VALUE(obj) LOG_VALUES_2(args)
|
||||
#define LOG_VALUES_4(obj, args...) , LOG_VALUE(obj) LOG_VALUES_3(args)
|
||||
#define LOG_VALUES_5(obj, args...) , LOG_VALUE(obj) LOG_VALUES_4(args)
|
||||
#define LOG_VALUES_6(obj, args...) , LOG_VALUE(obj) LOG_VALUES_5(args)
|
||||
#define LOG_VALUES_7(obj, args...) , LOG_VALUE(obj) LOG_VALUES_6(args)
|
||||
#define LOG_VALUES_8(obj, args...) , LOG_VALUE(obj) LOG_VALUES_7(args)
|
||||
#define LOG_VALUES_9(obj, args...) , LOG_VALUE(obj) LOG_VALUES_8(args)
|
||||
#define LOG_VALUES_10(obj, args...) , LOG_VALUE(obj) LOG_VALUES_9(args)
|
||||
#define LOG_VALUES_11(obj, args...) , LOG_VALUE(obj) LOG_VALUES_10(args)
|
||||
#define LOG_VALUES_12(obj, args...) , LOG_VALUE(obj) LOG_VALUES_11(args)
|
||||
#define LOG_VALUES_13(obj, args...) , LOG_VALUE(obj) LOG_VALUES_12(args)
|
||||
#define LOG_VALUES_14(obj, args...) , LOG_VALUE(obj) LOG_VALUES_13(args)
|
||||
#define LOG_VALUES_15(obj, args...) , LOG_VALUE(obj) LOG_VALUES_14(args)
|
||||
#define LOG_VALUES_16(obj, args...) , LOG_VALUE(obj) LOG_VALUES_15(args)
|
||||
#define LOG_VALUES_17(obj, args...) , LOG_VALUE(obj) LOG_VALUES_16(args)
|
||||
#define LOG_VALUES_18(obj, args...) , LOG_VALUE(obj) LOG_VALUES_17(args)
|
||||
#define LOG_VALUES_19(obj, args...) , LOG_VALUE(obj) LOG_VALUES_18(args)
|
||||
#define LOG_VALUES_20(obj, args...) , LOG_VALUE(obj) LOG_VALUES_19(args)
|
||||
#define LOG_VALUES_21(obj, args...) , LOG_VALUE(obj) LOG_VALUES_20(args)
|
||||
#define LOG_VALUES_22(obj, args...) , LOG_VALUE(obj) LOG_VALUES_21(args)
|
||||
#define LOG_VALUES_23(obj, args...) , LOG_VALUE(obj) LOG_VALUES_22(args)
|
||||
#define LOG_VALUES_24(obj, args...) , LOG_VALUE(obj) LOG_VALUES_23(args)
|
||||
#define LOG_VALUES_25(obj, args...) , LOG_VALUE(obj) LOG_VALUES_24(args)
|
||||
#define LOG_VALUES_26(obj, args...) , LOG_VALUE(obj) LOG_VALUES_25(args)
|
||||
#define LOG_VALUES_27(obj, args...) , LOG_VALUE(obj) LOG_VALUES_26(args)
|
||||
#define LOG_VALUES_28(obj, args...) , LOG_VALUE(obj) LOG_VALUES_27(args)
|
||||
#define LOG_VALUES_29(obj, args...) , LOG_VALUE(obj) LOG_VALUES_28(args)
|
||||
#define LOG_VALUES_30(obj, args...) , LOG_VALUE(obj) LOG_VALUES_29(args)
|
||||
|
||||
#define LOG_VALUES_(N, ...) CONCAT(LOG_VALUES_, N)(__VA_ARGS__)
|
||||
#define LOG_VALUES(...) "placeholder" LOG_VALUES_(ARGS_NUM(__VA_ARGS__), __VA_ARGS__)
|
||||
|
||||
#endif
|
||||
|
6
deps/oblib/src/lib/profile/ob_trace_id.h
vendored
6
deps/oblib/src/lib/profile/ob_trace_id.h
vendored
@ -174,10 +174,16 @@ struct ObCurTraceId
|
||||
|
||||
inline int hash(uint64_t &hash_val) const { hash_val = hash(); return OB_SUCCESS; }
|
||||
|
||||
inline bool is_default() { return uval_[0] == 0 && uval_[1] == 0 && uval_[2] == 0 && uval_[3] == 0; }
|
||||
|
||||
inline bool operator == (const TraceId &other) const
|
||||
{
|
||||
return equals(other);
|
||||
}
|
||||
inline bool operator != (const TraceId &other) const
|
||||
{
|
||||
return !equals(other);
|
||||
}
|
||||
private:
|
||||
union
|
||||
{
|
||||
|
10
deps/oblib/src/lib/resource/achunk_mgr.cpp
vendored
10
deps/oblib/src/lib/resource/achunk_mgr.cpp
vendored
@ -259,8 +259,9 @@ AChunk *AChunkMgr::alloc_chunk(const uint64_t size, bool high_prio)
|
||||
chunk->alloc_bytes_ = size;
|
||||
SANITY_UNPOISON(chunk, all_size); // maybe no need?
|
||||
} else if (REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
|
||||
LOG_DBA_WARN(OB_ALLOCATE_MEMORY_FAILED, "msg", "oops, over total memory limit" ,
|
||||
"hold", get_hold(), "limit", get_limit());
|
||||
LOG_DBA_WARN_V2(OB_LIB_ALLOCATE_MEMORY_FAIL, OB_ALLOCATE_MEMORY_FAILED,
|
||||
"[OOPS]: over total memory limit. ", "The details: ",
|
||||
"hold= ", get_hold(), ", limit= ", get_limit());
|
||||
}
|
||||
|
||||
return chunk;
|
||||
@ -320,8 +321,9 @@ AChunk *AChunkMgr::alloc_co_chunk(const uint64_t size)
|
||||
chunk->alloc_bytes_ = size;
|
||||
//SANITY_UNPOISON(chunk, all_size); // maybe no need?
|
||||
} else if (REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
|
||||
LOG_DBA_WARN(OB_ALLOCATE_MEMORY_FAILED, "msg", "oops, over total memory limit" ,
|
||||
"hold", get_hold(), "limit", get_limit());
|
||||
LOG_DBA_WARN_V2(OB_LIB_ALLOCATE_MEMORY_FAIL, OB_ALLOCATE_MEMORY_FAILED,
|
||||
"[OOPS]: over total memory limit. ", "The details: ",
|
||||
"hold= ", get_hold(), ", limit= ", get_limit());
|
||||
}
|
||||
|
||||
return chunk;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "lib/oblog/ob_log.h"
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
#include "common/ob_common_utility.h"
|
||||
#include "common/ob_clock_generator.h"
|
||||
|
||||
extern "C" {
|
||||
void right_to_die_or_duty_to_live_c()
|
||||
@ -45,7 +46,7 @@ void right_to_die_or_duty_to_live()
|
||||
set_fatal_error_thread_id(GETTID());
|
||||
while (true) {
|
||||
const char *info = (NULL == extra_info) ? NULL : to_cstring(*extra_info);
|
||||
LOG_DBA_ERROR(OB_ERR_THREAD_PANIC, "msg", "Trying so hard to die", KCSTRING(info), KCSTRING(lbt()));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_THREAD_PANIC, OB_ERR_THREAD_PANIC, "Trying so hard to die, info= ", info, ", lbt= ", lbt());
|
||||
#ifndef FATAL_ERROR_HANG
|
||||
if (in_try_stmt) {
|
||||
throw OB_EXCEPTION<OB_ERR_UNEXPECTED>();
|
||||
|
5
deps/oblib/src/rpc/obmysql/ob_sql_nio.cpp
vendored
5
deps/oblib/src/rpc/obmysql/ob_sql_nio.cpp
vendored
@ -812,7 +812,10 @@ public:
|
||||
} else {
|
||||
if ((lfd_ = listen_create(!oceanbase::lib::use_ipv6() ? AF_INET : AF_INET6, port, need_monopolize)) < 0) {
|
||||
ret = OB_SERVER_LISTEN_ERROR;
|
||||
LOG_WARN("listen create fail", K(ret), K(port), K(errno), KERRNOMSG(errno));
|
||||
LOG_ERROR("listen create fail", K(ret), K(port), K(errno), KERRNOMSG(errno));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_LISTEN_FAIL, ret,
|
||||
"listen port: ", port, " for mysql service failed. ",
|
||||
"[suggestion] check whether if mysql_port: ", port, " being occupied by another process.");
|
||||
} else if (0 != epoll_regist(epfd_, lfd_, epflag, NULL)) {
|
||||
ret = OB_IO_ERROR;
|
||||
LOG_WARN("regist listen fd fail", K(ret));
|
||||
|
@ -208,6 +208,10 @@ void *ObRpcNetHandler::decode(easy_message_t *ms)
|
||||
if (!pkt->is_resp() && fly_ts > common::OB_MAX_PACKET_FLY_TS && TC_REACH_TIME_INTERVAL(100 * 1000)) {
|
||||
LOG_WARN_RET(common::OB_ERR_TOO_MUCH_TIME, "packet fly cost too much time", "pcode", pkt->get_pcode(),
|
||||
"fly_ts", fly_ts, "send_timestamp", pkt->get_timestamp(), "connection", easy_connection_str(ms->c));
|
||||
LOG_DBA_WARN_V2(OB_RPC_COST_TOO_MUCH_TIME, ret,
|
||||
"The RPC packet delay is large.",
|
||||
" [suggestion] check clockdiff and tcp retransmission rate first, it maybe cost by clock skew"
|
||||
" or network delay. Further more, it may be caused by hardware failure or software failure of the machine");
|
||||
}
|
||||
pkt->set_receive_ts(receive_ts);
|
||||
if (receive_ts - start_ts > common::OB_MAX_PACKET_DECODE_TS && TC_REACH_TIME_INTERVAL(100 * 1000)) {
|
||||
|
8
deps/oblib/src/rpc/obrpc/ob_rpc_packet.h
vendored
8
deps/oblib/src/rpc/obrpc/ob_rpc_packet.h
vendored
@ -27,6 +27,8 @@ namespace oceanbase
|
||||
namespace obrpc
|
||||
{
|
||||
|
||||
#define OB_LOG_LEVEL_MASK (0x7)
|
||||
|
||||
enum ObRpcPriority
|
||||
{
|
||||
ORPR_UNDEF = 0,
|
||||
@ -191,7 +193,7 @@ public:
|
||||
K(trace_id_), K(timeout_), K_(timestamp), K_(dst_cluster_id), K_(cost_time),
|
||||
K(compressor_type_), K(original_len_), K(src_cluster_id_), K(seq_no_));
|
||||
|
||||
ObRpcPacketHeader() { memset(this, 0, sizeof(*this)); flags_ |= (OB_LOG_LEVEL_NONE & 0x7); }
|
||||
ObRpcPacketHeader() { memset(this, 0, sizeof(*this)); flags_ |= (OB_LOG_LEVEL_NONE & OB_LOG_LEVEL_MASK); }
|
||||
static inline int64_t get_encoded_size()
|
||||
{
|
||||
return HEADER_SIZE + ObRpcCostTime::get_encoded_size() + 8 /* for seq no */;
|
||||
@ -707,7 +709,7 @@ const uint64_t *ObRpcPacket::get_trace_id() const
|
||||
|
||||
int8_t ObRpcPacket::get_log_level() const
|
||||
{
|
||||
return hdr_.flags_ & 0x7;
|
||||
return hdr_.flags_ & OB_LOG_LEVEL_MASK;
|
||||
}
|
||||
|
||||
void ObRpcPacket::set_trace_id(const uint64_t *trace_id)
|
||||
@ -722,7 +724,7 @@ void ObRpcPacket::set_trace_id(const uint64_t *trace_id)
|
||||
|
||||
void ObRpcPacket::set_log_level(const int8_t log_level)
|
||||
{
|
||||
hdr_.flags_ &= static_cast<uint16_t>(~0x7); //must set zero first
|
||||
hdr_.flags_ &= static_cast<uint16_t>(~OB_LOG_LEVEL_MASK); //must set zero first
|
||||
hdr_.flags_ |= static_cast<uint16_t>(log_level);
|
||||
}
|
||||
|
||||
|
1
deps/oblib/unittest/lib/CMakeLists.txt
vendored
1
deps/oblib/unittest/lib/CMakeLists.txt
vendored
@ -75,6 +75,7 @@ oblib_addtest(net/test_ob_net_util.cpp)
|
||||
#oblib_addtest(oblog/test_base_log_buffer.cpp)
|
||||
oblib_addtest(oblog/test_base_log_writer.cpp)
|
||||
oblib_addtest(oblog/test_ob_log_compressor.cpp)
|
||||
oblib_addtest(oblog/test_ob_log_dba.cpp)
|
||||
oblib_addtest(oblog/test_ob_log_obj.cpp)
|
||||
oblib_addtest(oblog/test_ob_log_performance.cpp)
|
||||
oblib_addtest(profile/test_ob_trace_id.cpp)
|
||||
|
@ -31,7 +31,8 @@ namespace oceanbase {
|
||||
namespace common {
|
||||
|
||||
const char *TEST_DIR = "testoblogcompressdir";
|
||||
const char *RM_COMMAND = "rm -rf testoblogcompressdir";
|
||||
const char *TEST_ALERT_DIR = "testoblogcompressdiralert";
|
||||
const char *RM_COMMAND = "rm -rf testoblogcompressdir testoblogcompressdiralert";
|
||||
|
||||
#define CREATE_FILES(file_count, modify_time, timestamp) \
|
||||
for (int i = 0; i < file_count; i++) { \
|
||||
@ -304,6 +305,7 @@ TEST(ObLogCompressor, syslog_compressor_thread_test)
|
||||
ASSERT_EQ(OB_SUCCESS, OB_LOG_COMPRESSOR.init());
|
||||
ASSERT_EQ(true, OB_LOG_COMPRESSOR.is_inited_);
|
||||
strncpy(OB_LOG_COMPRESSOR.syslog_dir_, TEST_DIR, strlen(TEST_DIR));
|
||||
strncpy(OB_LOG_COMPRESSOR.alert_log_dir_, TEST_ALERT_DIR, strlen(TEST_ALERT_DIR));
|
||||
|
||||
// prepare syslog file
|
||||
const int MAX_SYSLOG_COUNT = 8;
|
||||
@ -335,6 +337,7 @@ TEST(ObLogCompressor, syslog_compressor_thread_test)
|
||||
last_modified_time -= 1000;
|
||||
ASSERT_EQ(0, system(RM_COMMAND));
|
||||
ASSERT_EQ(0, mkdir(TEST_DIR, 0777));
|
||||
ASSERT_EQ(0, mkdir(TEST_ALERT_DIR, 0777));
|
||||
for (int i = 0; i < OB_SYSLOG_COMPRESS_TYPE_COUNT; i++) {
|
||||
snprintf(file_name, sizeof(file_name), "%s/%s", TEST_DIR, OB_SYSLOG_FILE_PREFIX[i%OB_SYSLOG_COMPRESS_TYPE_COUNT]);
|
||||
FILE *file =fopen(file_name, "w");
|
||||
|
195
deps/oblib/unittest/lib/oblog/test_ob_log_dba.cpp
vendored
Normal file
195
deps/oblib/unittest/lib/oblog/test_ob_log_dba.cpp
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX LIB
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include "lib/oblog/ob_log.h"
|
||||
#include "lib/profile/ob_trace_id.h"
|
||||
#include "common/ob_clock_generator.h"
|
||||
|
||||
using namespace std;
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
|
||||
TEST(ObDbaLog, basic_test)
|
||||
{
|
||||
char buf[100];
|
||||
int64_t len = 100;
|
||||
int64_t pos = 0;
|
||||
ObPLogFDType data_enum = FD_ALERT_FILE;
|
||||
uint8_t data_uint8 = 2;
|
||||
uint16_t data_uint16 = 33;
|
||||
int32_t data_int32 = -444;
|
||||
int64_t data_int64 = 5555;
|
||||
char data_char = '@';
|
||||
float data_float = 3.1415926;
|
||||
double data_double = 233.233;
|
||||
bool data_bool = false;
|
||||
char data_str[10] = {'h','e','l','l','o',' ',0};
|
||||
const char *data_const_str = "world! ";
|
||||
const char *data_null = nullptr;
|
||||
ObClockGenerator *data_obj_ptr = (ObClockGenerator*)0x7fc1d30996d0; // do not access this addr
|
||||
const ObClockGenerator *data_obj_null = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_enum));
|
||||
ASSERT_STREQ(buf, "5");
|
||||
ASSERT_EQ(pos, 1);
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_uint8));
|
||||
ASSERT_EQ(pos, 2);
|
||||
ASSERT_STREQ(buf, "52");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_uint16));
|
||||
ASSERT_EQ(pos, 4);
|
||||
ASSERT_STREQ(buf, "5233");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_int32));
|
||||
ASSERT_EQ(pos, 8);
|
||||
ASSERT_STREQ(buf, "5233-444");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_int64));
|
||||
ASSERT_EQ(pos, 12);
|
||||
ASSERT_STREQ(buf, "5233-4445555");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_char));
|
||||
ASSERT_EQ(pos, 13);
|
||||
ASSERT_STREQ(buf, "5233-4445555@");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_float));
|
||||
ASSERT_EQ(pos, 28);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+00");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_double));
|
||||
ASSERT_EQ(pos, 52);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_bool));
|
||||
ASSERT_EQ(pos, 57);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02false");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_str));
|
||||
ASSERT_EQ(pos, 63);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02falsehello ");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_const_str));
|
||||
ASSERT_EQ(pos, 70);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02falsehello world! ");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_null));
|
||||
ASSERT_EQ(pos, 74);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02falsehello world! NULL");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_obj_ptr));
|
||||
ASSERT_EQ(pos, 88);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02falsehello world! NULL0x7fc1d30996d0");
|
||||
ASSERT_EQ(OB_SUCCESS, logdata_print_value(buf, len, pos, data_obj_null));
|
||||
ASSERT_EQ(pos, 92);
|
||||
ASSERT_STREQ(buf, "5233-4445555@3.141592503e+002.332330000000000041e+02falsehello world! NULL0x7fc1d30996d0NULL");
|
||||
}
|
||||
|
||||
TEST(ObDbaLog, test_1)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObClockGenerator::get_instance().init();
|
||||
|
||||
// 0. alert log level test
|
||||
ASSERT_EQ(OB_SUCCESS, ObLogger::get_logger().parse_check_alert("WARN", 5));
|
||||
ASSERT_EQ(OB_SUCCESS, ObLogger::get_logger().parse_check_alert("ERROR", 5));
|
||||
ASSERT_EQ(OB_SUCCESS, ObLogger::get_logger().parse_check_alert("INFO", 5));
|
||||
|
||||
// 1. base test
|
||||
LOG_DBA_INFO_("TEST_EVENT", "print dba log only");
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", "print both rd and dba log");
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", "print both rd and dba log");
|
||||
LOG_DBA_WARN_("TEST_EVENT", ret, "print dba log only");
|
||||
LOG_DBA_WARN_V2("TEST_EVENT", ret, "print both rd and dba log");
|
||||
LOG_DBA_ERROR_V2("TEST_EVENT", ret, "print both rd and dba log");
|
||||
LOG_DBA_ERROR_("TEST_EVENT", ret, "print dba log only");
|
||||
|
||||
// 2. test REACH_TIME_INTERVAL
|
||||
const char * const str1 = "it's right to print this log";
|
||||
const char * const str2 = "it's wrong to print this log";
|
||||
const char *log_str = str1;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
LOG_DBA_WARN_("TEST_EVENT", ret, log_str);
|
||||
log_str = str2;
|
||||
}
|
||||
ASSERT_EQ(OB_SUCCESS, ObCurTraceId::get_trace_id()->set("Y0-1111111111111111-0-0"));
|
||||
log_str = str1;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
LOG_DBA_INFO_("TEST_EVENT", log_str);
|
||||
log_str = str2;
|
||||
}
|
||||
|
||||
// 3. test need_to_print_dba
|
||||
ASSERT_EQ(OB_SUCCESS, ObCurTraceId::get_trace_id()->set("Y0-0000000000000000-0-0"));
|
||||
ASSERT_EQ(true, OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false));
|
||||
ASSERT_EQ(true, OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false));
|
||||
for (int i = 0; i < 20; i++) {
|
||||
ASSERT_EQ(true, OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false));
|
||||
}
|
||||
ASSERT_EQ(OB_SUCCESS, ObCurTraceId::get_trace_id()->set("Y0-2222222222222222-0-0"));
|
||||
ASSERT_EQ(true, OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false));
|
||||
ASSERT_EQ(false, OB_LOG_NEED_TO_PRINT_DBA(DBA_WARN, false));
|
||||
ASSERT_EQ(OB_SUCCESS, ObCurTraceId::get_trace_id()->set("Y0-3333333333333333-0-0"));
|
||||
ASSERT_EQ(true, OB_LOG_NEED_TO_PRINT_DBA(DBA_ERROR, false));
|
||||
ASSERT_EQ(false, OB_LOG_NEED_TO_PRINT_DBA(DBA_ERROR, false));
|
||||
for (int i = 0; i < 20; i++) {
|
||||
ASSERT_EQ(false, OB_LOG_NEED_TO_PRINT_DBA(DBA_ERROR, false));
|
||||
}
|
||||
ASSERT_EQ(OB_SUCCESS, ObCurTraceId::get_trace_id()->set("Y0-4444444444444444-0-0"));
|
||||
LOG_DBA_WARN_V2("TEST_EVENT", ret, "print both rd and dba log");
|
||||
LOG_DBA_WARN_V2("TEST_EVENT", ret, "print rd log only");
|
||||
LOG_DBA_WARN_V2("TEST_EVENT", ret, "print rd log only");
|
||||
LOG_DBA_ERROR_V2("TEST_EVENT", ret, "print both rd and dba log");
|
||||
LOG_DBA_ERROR_V2("TEST_EVENT", ret, "print rd log only");
|
||||
ObCurTraceId::get_trace_id()->reset();
|
||||
}
|
||||
|
||||
TEST(ObDbaLog, test_2)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
// 1. test DBA_STEP_INC_INFO, DBA_STEP_INFO
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", DBA_STEP_INC_INFO(bootstrap), "print both rd and dba log");
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", DBA_STEP_INC_INFO(bootstrap), "print both rd and dba log");
|
||||
LOG_DBA_INFO_("TEST_EVENT", DBA_STEP_INC_INFO(bootstrap), "print dba log only");
|
||||
ASSERT_EQ(3, bootstrap_thread_local_step_get());
|
||||
LOG_DBA_ERROR_V2("TEST_EVENT", OB_SUCCESS, DBA_STEP_INFO(bootstrap), "print both rd and dba log");
|
||||
LOG_DBA_ERROR_("TEST_EVENT", OB_SUCCESS, DBA_STEP_INFO(bootstrap), "print dba log only");
|
||||
ASSERT_EQ(3, bootstrap_thread_local_step_get());
|
||||
|
||||
// 2. test need_to_print_dba and DBA_STEP_INC_INFO
|
||||
for (int i = 0; i < LIST_EVENT_COUNT(bootstrap) + 1; i++) {
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", DBA_STEP_INC_INFO(bootstrap), "print both rd and dba log");
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", DBA_STEP_INC_INFO(bootstrap), "print both rd and dba log");
|
||||
}
|
||||
ASSERT_EQ(5, bootstrap_thread_local_step_get());
|
||||
}
|
||||
|
||||
TEST(ObDbaLog, test_3)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
// 1. test statvfs
|
||||
int64_t unused_disk_space = 0;
|
||||
struct statvfs file_system;
|
||||
ASSERT_EQ(0, statvfs("./", &file_system));
|
||||
unused_disk_space = file_system.f_bsize * file_system.f_bfree;
|
||||
LOG_DBA_INFO_V2("TEST_EVENT", "free disk size: ", unused_disk_space);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
using namespace oceanbase;
|
||||
using namespace oceanbase::common;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ObLogger &logger = ObLogger::get_logger();
|
||||
logger.set_file_name("test_ob_log_dba.log", true);
|
||||
logger.set_log_level(OB_LOG_LEVEL_WARN);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
11649
hotfuncs.txt
11649
hotfuncs.txt
File diff suppressed because it is too large
Load Diff
@ -47,13 +47,13 @@ int ObLSTabletService::table_scan(ObTableScanIterator &iter, ObTableScanParam &p
|
||||
int ret = OB_SUCCESS;
|
||||
NG_TRACE(S_table_scan_begin);
|
||||
ObTabletHandle data_tablet;
|
||||
AllowToReadMgr::AllowToReadInfo read_info;
|
||||
bool allow_to_read = false;
|
||||
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
STORAGE_LOG(WARN, "not inited", K(ret), K_(is_inited));
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(read_info))) {
|
||||
} else if (!read_info.allow_to_read()) {
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(allow_to_read))) {
|
||||
} else if (!allow_to_read) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
STORAGE_LOG(WARN, "ls is not allow to read", K(ret), KPC(ls_));
|
||||
} else if (OB_FAIL(prepare_scan_table_param(param, *(MTL(ObTenantSchemaService*)->get_schema_service())))) {
|
||||
@ -62,13 +62,6 @@ int ObLSTabletService::table_scan(ObTableScanIterator &iter, ObTableScanParam &p
|
||||
STORAGE_LOG(WARN, "failed to check and get tablet", K(ret), K(param));
|
||||
} else if (OB_FAIL(inner_table_scan(data_tablet, iter, param))) {
|
||||
STORAGE_LOG(WARN, "failed to do table scan", K(ret), KP(&iter), K(param));
|
||||
} else {
|
||||
bool is_same = false;
|
||||
allow_to_read_mgr_.check_read_info_same(read_info, is_same);
|
||||
if (!is_same) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
STORAGE_LOG(WARN, "ls is not allow to read", K(ret), KPC(ls_), KP(&iter));
|
||||
}
|
||||
}
|
||||
NG_TRACE(S_table_scan_end);
|
||||
|
||||
|
795319
observer.prof.1702984872675
795319
observer.prof.1702984872675
File diff suppressed because it is too large
Load Diff
113791
perf.fdata
Normal file
113791
perf.fdata
Normal file
File diff suppressed because it is too large
Load Diff
@ -1040,10 +1040,9 @@ void ObArchiveFetcher::handle_log_fetch_ret_(
|
||||
if (OB_ERR_OUT_OF_LOWER_BOUND == ret_code) {
|
||||
int tmp_ret = OB_CLOG_RECYCLE_BEFORE_ARCHIVE;
|
||||
reason.set(ObArchiveInterruptReason::Factor::LOG_RECYCLE, lbt(), tmp_ret);
|
||||
LOG_DBA_ERROR(OB_CLOG_RECYCLE_BEFORE_ARCHIVE, "msg", "observer clog is recycled "
|
||||
"before archive, check if archive speed is less than clog writing speed "
|
||||
"or archive device is full or archive device is not healthy",
|
||||
"ret", tmp_ret);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_RECYCLE_BEFORE_ARCHIVE, OB_CLOG_RECYCLE_BEFORE_ARCHIVE, "msg", "observer clog is recycled "
|
||||
"before archive.", "[suggesstion] check if archive speed is less than clog writing speed "
|
||||
"or archive device is full or archive device is not healthy");
|
||||
} else {
|
||||
reason.set(ObArchiveInterruptReason::Factor::UNKONWN, lbt(), ret_code);
|
||||
}
|
||||
|
@ -312,10 +312,9 @@ int GenFetchTaskFunctor::generate_log_fetch_task_(const ObLSID &id,
|
||||
int tmp_ret = OB_CLOG_RECYCLE_BEFORE_ARCHIVE;
|
||||
ObArchiveInterruptReason reason;
|
||||
reason.set(ObArchiveInterruptReason::Factor::LOG_RECYCLE, lbt(), tmp_ret);
|
||||
LOG_DBA_ERROR(OB_CLOG_RECYCLE_BEFORE_ARCHIVE, "msg", "observer clog is recycled "
|
||||
"before archive, check if archive speed is less than clog writing speed "
|
||||
"or archive device is full or archive device is not healthy",
|
||||
"ret", tmp_ret);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_RECYCLE_BEFORE_ARCHIVE, tmp_ret, "msg", "observer clog is recycled "
|
||||
"before archive.", "[suggesstion] check if archive speed is less than clog writing speed "
|
||||
"or archive device is full or archive device is not healthy");
|
||||
ls_mgr_->mark_fatal_error(id, station.get_round(), reason);
|
||||
}
|
||||
return ret;
|
||||
|
@ -362,6 +362,7 @@ void ObFailureDetector::detect_palf_hang_failure_()
|
||||
ATOMIC_SET(&has_add_clog_hang_event_, true);
|
||||
LOG_DBA_ERROR(OB_DISK_HUNG, "msg", "clog disk may be hung, add failure event", K(clog_disk_hang_event),
|
||||
K(clog_disk_last_working_time), "hung time", now - clog_disk_last_working_time);
|
||||
LOG_DBA_ERROR_V2(OB_FAILURE_LOG_DISK_HUNG, OB_DISK_HUNG, "clog disk may be hung, add failure event");
|
||||
}
|
||||
} else {
|
||||
if (is_clog_disk_hang) {
|
||||
@ -398,6 +399,7 @@ void ObFailureDetector::detect_data_disk_io_failure_()
|
||||
ATOMIC_SET(&has_add_data_disk_hang_event_, true);
|
||||
LOG_DBA_ERROR(OB_DISK_HUNG, "msg", "data disk may be hung, add failure event", K(data_disk_io_hang_event),
|
||||
K(data_disk_error_start_ts));
|
||||
LOG_DBA_ERROR_V2(OB_FAILURE_DATA_DISK_HUNG, OB_DISK_HUNG, "data disk may be hung, add failure event");
|
||||
}
|
||||
} else {
|
||||
if (ObDeviceHealthStatus::DEVICE_HEALTH_NORMAL != data_disk_status) {
|
||||
@ -432,6 +434,7 @@ void ObFailureDetector::detect_palf_disk_full_()
|
||||
ATOMIC_SET(&has_add_clog_full_event_, true);
|
||||
LOG_DBA_ERROR(OB_LOG_OUTOF_DISK_SPACE, "msg", "clog disk is almost full, add failure event",
|
||||
K(clog_disk_full_event), K(now));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_DISK_SPACE_ALMOST_FULL, OB_LOG_OUTOF_DISK_SPACE, "clog disk is almost full, add failure event");
|
||||
}
|
||||
} else {
|
||||
if (!is_disk_enough) {
|
||||
@ -505,6 +508,7 @@ void ObFailureDetector::detect_data_disk_full_()
|
||||
ATOMIC_SET(&has_add_disk_full_event_, true);
|
||||
LOG_DBA_ERROR(OB_USER_OUTOF_DATA_DISK_SPACE, "msg", "data disk is full, add failure event",
|
||||
K(data_disk_full_event), K(now));
|
||||
LOG_DBA_ERROR_V2(OB_FAILURE_OUTOF_DATA_DISK_SPACE, OB_USER_OUTOF_DATA_DISK_SPACE, "data disk is full, add failure event");
|
||||
}
|
||||
} else {
|
||||
if (!is_disk_enough) {
|
||||
|
@ -10,6 +10,7 @@
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX CLOG
|
||||
#include "ob_server_log_block_mgr.h"
|
||||
#include <fcntl.h> // IO operation
|
||||
#include <type_traits> // decltype
|
||||
@ -33,6 +34,9 @@
|
||||
#include "share/ob_errno.h" // errno
|
||||
#include "logservice/ob_log_service.h" // ObLogService
|
||||
#include "logservice/palf/log_io_utils.h" // renameat_with_retry
|
||||
|
||||
#define BYTE_TO_MB(byte) (byte+1024*1024-1)/1024/1024
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace palf;
|
||||
@ -196,19 +200,30 @@ int ObServerLogBlockMgr::resize_(const int64_t new_size_byte)
|
||||
: SHRINKING_STATUS))) {
|
||||
} else if (aligned_new_size_byte < min_log_disk_size_for_all_tenants_) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_DBA_ERROR(OB_NOT_SUPPORTED,
|
||||
"possible reason",
|
||||
"new log_disk_size is not enough to hold all tenants, please check the configuration about log disk",
|
||||
"new log disk size(MB)", (new_size_byte+1024*1024-1)/1024/1024,
|
||||
"min log disk size(MB)", (min_log_disk_size_for_all_tenants_+1024*1024-1)/1024/1024);
|
||||
} else if (OB_FAIL(
|
||||
do_resize_(old_log_pool_meta, resize_block_cnt, new_log_pool_meta))) {
|
||||
LOG_DBA_ERROR_V2(OB_LOG_NEW_DISK_SIZE_NOT_ENOUGH, ret,
|
||||
"new log_disk_size(", BYTE_TO_MB(new_size_byte), "MB) is not enough to hold all tenants. ",
|
||||
"[suggestion] set log_disk_size greater than ", BYTE_TO_MB(min_log_disk_size_for_all_tenants_), "MB.");
|
||||
} else if (OB_FAIL(do_resize_(old_log_pool_meta, resize_block_cnt, new_log_pool_meta))) {
|
||||
if (OB_ALLOCATE_DISK_SPACE_FAILED == ret) {
|
||||
ret = OB_MACHINE_RESOURCE_NOT_ENOUGH;
|
||||
LOG_DBA_ERROR(OB_ALLOCATE_DISK_SPACE_FAILED,
|
||||
"possible reason",
|
||||
"may be diskspace is not enough, please check the configuration about log disk",
|
||||
"new log disk size(MB)", (new_size_byte+1024*1024-1)/1024/1024);
|
||||
// available disk space = free space in disk + current allocated space
|
||||
int64_t free_disk_space = 0;
|
||||
if (OB_UNLIKELY(OB_SUCCESS != get_free_disk_space(free_disk_space))) {
|
||||
LOG_DBA_ERROR_V2(OB_LOG_ALLOCATE_DISK_SPACE_FAIL, ret,
|
||||
"maybe available disk space(can't get automatically) is not enough to satisfy new log_disk_size(",
|
||||
BYTE_TO_MB(new_size_byte), "MB). "
|
||||
"[suggestion] set log_disk_size less than available disk space(= old log_disk_size + free disk size) "
|
||||
"or link the clog path({data_dir}/clog) to another disk which has more than ",
|
||||
BYTE_TO_MB(new_size_byte), "MB free space.");
|
||||
} else {
|
||||
int64_t available_size_byte = free_disk_space + curr_total_size;
|
||||
LOG_DBA_ERROR_V2(OB_LOG_ALLOCATE_DISK_SPACE_FAIL, ret,
|
||||
"maybe available disk size(", BYTE_TO_MB(available_size_byte), "MB) "
|
||||
"is not enough to satisfy new log_disk_size(", BYTE_TO_MB(new_size_byte), "MB). "
|
||||
"[suggestion] set log_disk_size less than ", BYTE_TO_MB(available_size_byte), "MB "
|
||||
"or link the clog path({data_dir}/clog) to another disk which has more than ",
|
||||
BYTE_TO_MB(new_size_byte), "MB free space.");
|
||||
}
|
||||
} else {
|
||||
CLOG_LOG(ERROR, "do_resize_ failed", K(ret), KPC(this), K(old_log_pool_meta),
|
||||
K(new_log_pool_meta));
|
||||
@ -1243,18 +1258,18 @@ int ObServerLogBlockMgr::get_has_allocated_blocks_cnt_in_(
|
||||
CLOG_LOG(WARN, "is_directory failed", K(ret), K(entry->d_name));
|
||||
} else if (false == is_dir) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected file path", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected file path is ", current_file_path);
|
||||
} else if (true == std::regex_match(current_file_path, pattern_tenant)) {
|
||||
ret = scan_tenant_dir_(current_file_path, has_allocated_block_cnt);
|
||||
} else if (true == std::regex_match(current_file_path, pattern_log_pool)) {
|
||||
CLOG_LOG(INFO, "ignore log_pool path", K(current_file_path), KPC(this));
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected directory", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected directory is ", current_file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1310,6 +1325,20 @@ int ObServerLogBlockMgr::remove_tmp_file_or_directory_for_tenant_(const char *lo
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObServerLogBlockMgr::get_free_disk_space(int64_t &free_disk_space)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
free_disk_space = 0;
|
||||
struct statvfs file_system;
|
||||
if (statvfs(log_pool_path_, &file_system) == -1) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("fail to get disk stat", K(ret), K(strerror(errno)), K(log_pool_path_));
|
||||
} else {
|
||||
free_disk_space = file_system.f_bsize * file_system.f_bavail;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObServerLogBlockMgr::fallocate_until_success_(const palf::FileDesc &src_fd,
|
||||
const int64_t block_size)
|
||||
{
|
||||
@ -1611,18 +1640,18 @@ int ObServerLogBlockMgr::scan_tenant_dir_(const char *tenant_dir,
|
||||
CLOG_LOG(WARN, "is_directory failed", K(ret), K(entry->d_name));
|
||||
} else if (false == is_dir) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected file path", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected file is ", current_file_path);
|
||||
} else if (true == std::regex_match(current_file_path, pattern_log_stream)) {
|
||||
ret = scan_ls_dir_(current_file_path, has_allocated_block_cnt);
|
||||
} else if (true == std::regex_match(current_file_path, pattern_tmp_dir)) {
|
||||
CLOG_LOG(INFO, "ignore tmp_dir", K(current_file_path), K(has_allocated_block_cnt), KPC(this));
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected directory", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected directory is ", current_file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1660,16 +1689,16 @@ int ObServerLogBlockMgr::scan_ls_dir_(const char *ls_dir,
|
||||
CLOG_LOG(WARN, "is_directory failed", K(ret), K(entry->d_name));
|
||||
} else if (false == is_dir) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected file path", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected file is ", current_file_path);
|
||||
} else if (true == std::regex_match(current_file_path, pattern_log)
|
||||
|| true == std::regex_match(current_file_path, pattern_meta)) {
|
||||
GetBlockCountFunctor functor(current_file_path);
|
||||
if (OB_FAIL(palf::scan_dir(current_file_path, functor))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", log directory", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected directory is ", current_file_path);
|
||||
} else {
|
||||
has_allocated_block_cnt += functor.get_block_count();
|
||||
CLOG_LOG(INFO, "get_has_allocated_blocks_cnt_in_ success", K(ret),
|
||||
@ -1677,9 +1706,9 @@ int ObServerLogBlockMgr::scan_ls_dir_(const char *ls_dir,
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase. Please confirm whether manual deletion is required",
|
||||
", unexpected directory", current_file_path);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_EXTERNAL_FILE_EXIST, ret, "Attention!!!", "There are several files in the log directory that are not generated by "
|
||||
"OceanBase.", "[suggestion] Please confirm whether manual deletion is required",
|
||||
", unexpected directory is ", current_file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,6 +279,7 @@ private:
|
||||
int64_t &has_allocated_block_cnt);
|
||||
int64_t lower_align_(const int64_t new_size_byte);
|
||||
int remove_tmp_file_or_directory_for_tenant_(const char *log_disk_path);
|
||||
int get_free_disk_space(int64_t &free_disk_space);
|
||||
private:
|
||||
int open_until_success_(const char *src_block_path, const int flag,
|
||||
palf::FileDesc &out_fd);
|
||||
|
@ -448,6 +448,7 @@ int LogBlockHandler::inner_write_impl_(const int fd, const char *buf, const int6
|
||||
if (palf_reach_time_interval(1000 * 1000, time_interval)) {
|
||||
ret = convert_sys_errno();
|
||||
PALF_LOG(ERROR, "ob_pwrite failed", K(ret), K(fd), K(offset), K(count), K(errno));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_PWRITE_FAIL, ret, "ob_pwrite failed, please check the output of dmesg");
|
||||
}
|
||||
ob_usleep(RETRY_INTERVAL);
|
||||
} else {
|
||||
|
@ -101,6 +101,7 @@ int LogChecksum::verify_accum_checksum(const int64_t old_accum_checksum,
|
||||
ret = common::OB_CHECKSUM_ERROR;
|
||||
LOG_DBA_ERROR(OB_CHECKSUM_ERROR, "msg", "log checksum error", "ret", ret, K(data_checksum),
|
||||
K(expected_accum_checksum), K(old_accum_checksum), K(new_accum_checksum));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_CHECKSUM_MISMATCH, ret, "log checksum error");
|
||||
} else {
|
||||
PALF_LOG(TRACE, "verify_accum_checksum success", K(ret), K(data_checksum),
|
||||
K(expected_accum_checksum), K(old_accum_checksum), K(new_accum_checksum));
|
||||
|
@ -2229,7 +2229,8 @@ int LogSlidingWindow::sliding_cb(const int64_t sn, const FixedSlidingWindowSlot
|
||||
// Verifying accum_checksum firstly.
|
||||
if (OB_FAIL(checksum_.verify_accum_checksum(log_task_header.data_checksum_,
|
||||
log_task_header.accum_checksum_))) {
|
||||
PALF_LOG(ERROR, "verify_accum_checksum failed", K(ret), KPC(this), K(log_id), KPC(log_task));
|
||||
PALF_LOG(ERROR, "verify_accum_checksum failed", KR(ret), KPC(this), K(log_id), KPC(log_task));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_CHECKSUM_MISMATCH, ret, "verify_accum_checksum failed");
|
||||
} else {
|
||||
// Call fs_cb.
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
|
@ -859,6 +859,7 @@ bool LogStateMgr::is_reconfirm_timeout_()
|
||||
if (bool_ret) {
|
||||
if (palf_reach_time_interval(1 * 1000 * 1000, check_reconfirm_timeout_time_)) {
|
||||
PALF_LOG_RET(WARN, OB_TIMEOUT, "leader reconfirm timeout", K_(palf_id), K(start_id), K(is_sw_timeout), K_(reconfirm));
|
||||
LOG_DBA_WARN_V2(OB_LOG_LEADER_RECONFIRM_TIMEOUT, OB_TIMEOUT, "leader reconfirm timeout");
|
||||
(void) sw_->report_log_task_trace(start_id);
|
||||
}
|
||||
} else if (palf_reach_time_interval(100 * 1000, check_reconfirm_timeout_time_)) {
|
||||
@ -928,6 +929,7 @@ bool LogStateMgr::check_leader_log_sync_state_()
|
||||
if (now_us - last_check_start_id_time_us_ > PALF_LEADER_ACTIVE_SYNC_TIMEOUT_US) {
|
||||
if (palf_reach_time_interval(10 * 1000 * 1000, log_sync_timeout_warn_time_)) {
|
||||
PALF_LOG_RET(WARN, OB_TIMEOUT, "log sync timeout on leader", K_(palf_id), K_(self), K(now_us), K(last_check_start_id_time_us_), K(start_id));
|
||||
LOG_DBA_WARN_V2(OB_LOG_LEADER_LOG_SYNC_TIMEOUT, OB_TIMEOUT, "log sync timeout on leader");
|
||||
(void) sw_->report_log_task_trace(start_id);
|
||||
}
|
||||
}
|
||||
|
@ -874,6 +874,7 @@ int LogStorage::read_block_header_(const block_id_t block_id,
|
||||
} else if (false == log_block_header.check_integrity()) {
|
||||
ret = OB_INVALID_DATA;
|
||||
PALF_LOG(ERROR, "info block has been corrupted!!!", K(log_block_header), K(block_id));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_CHECKSUM_MISMATCH, ret, "info block has been corrupted!!!");
|
||||
} else {
|
||||
PALF_LOG(TRACE, "read_block_header_ success", K(ret), K(block_id),
|
||||
K(log_block_header));
|
||||
|
@ -771,20 +771,20 @@ int PalfEnvImpl::try_recycle_blocks()
|
||||
const int64_t log_disk_usage_limit_size = disk_opts_for_stopping_writing.log_disk_usage_limit_size_;
|
||||
const int64_t log_disk_warn_percent = disk_opts_for_stopping_writing.log_disk_utilization_threshold_;
|
||||
const int64_t log_disk_limit_percent = disk_opts_for_stopping_writing.log_disk_utilization_limit_threshold_;
|
||||
LOG_DBA_ERROR(OB_LOG_OUTOF_DISK_SPACE, "msg", "log disk space is almost full", "ret", tmp_ret,
|
||||
"total_size(MB)", log_disk_usage_limit_size/MB,
|
||||
"used_size(MB)", total_used_size_byte/MB,
|
||||
"used_percent(%)", (total_used_size_byte*100) / (log_disk_usage_limit_size+1),
|
||||
"warn_size(MB)", (log_disk_usage_limit_size*log_disk_warn_percent)/100/MB,
|
||||
"warn_percent(%)", log_disk_warn_percent,
|
||||
"limit_size(MB)", (log_disk_usage_limit_size*log_disk_limit_percent)/100/MB,
|
||||
"limit_percent(%)", log_disk_limit_percent,
|
||||
"total_unrecyclable_size_byte(MB)", total_unrecyclable_size_byte/MB,
|
||||
"maximum_used_size(MB)", maximum_used_size/MB,
|
||||
"maximum_log_stream", palf_id,
|
||||
"oldest_log_stream", oldest_palf_id,
|
||||
"oldest_scn", oldest_scn,
|
||||
"in_shrinking", in_shrinking);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_DISK_SPACE_ALMOST_FULL, tmp_ret, "msg", "log disk space is almost full",
|
||||
", total_size(MB)=", log_disk_usage_limit_size/MB,
|
||||
", used_size(MB)=", total_used_size_byte/MB,
|
||||
", used_percent(%)=", (total_used_size_byte*100) / (log_disk_usage_limit_size+1),
|
||||
", warn_size(MB)=", (log_disk_usage_limit_size*log_disk_warn_percent)/100/MB,
|
||||
", warn_percent(%)=", log_disk_warn_percent,
|
||||
", limit_size(MB)=", (log_disk_usage_limit_size*log_disk_limit_percent)/100/MB,
|
||||
", limit_percent(%)=", log_disk_limit_percent,
|
||||
", total_unrecyclable_size_byte(MB)=", total_unrecyclable_size_byte/MB,
|
||||
", maximum_used_size(MB)=", maximum_used_size/MB,
|
||||
", maximum_log_stream=", palf_id,
|
||||
", oldest_log_stream=", oldest_palf_id,
|
||||
", oldest_scn=", oldest_scn,
|
||||
", in_shrinking=", in_shrinking);
|
||||
}
|
||||
} else {
|
||||
if (REACH_TIME_INTERVAL(2 * 1000 * 1000L)) {
|
||||
@ -1345,14 +1345,14 @@ void PalfEnvImpl::period_calc_disk_usage()
|
||||
constexpr int64_t INTERVAL = 1*1000*1000;
|
||||
if (palf_reach_time_interval(INTERVAL, disk_not_enough_print_interval_in_loop_thread_)) {
|
||||
int tmp_ret = OB_LOG_OUTOF_DISK_SPACE;
|
||||
LOG_DBA_ERROR(OB_LOG_OUTOF_DISK_SPACE, "msg", "log disk space is almost full", "ret", tmp_ret,
|
||||
"total_size(MB)", log_disk_usage_limit_size/MB,
|
||||
"used_size(MB)", used_size_byte/MB,
|
||||
"used_percent(%)", (used_size_byte*100) / (log_disk_usage_limit_size + 1),
|
||||
"warn_size(MB)", warn_siz/MB,
|
||||
"warn_percent(%)", log_disk_warn_percent,
|
||||
"limit_size(MB)", usable_disk_limit_size_to_stop_writing/MB,
|
||||
"limit_percent(%)", log_disk_limit_percent);
|
||||
LOG_DBA_ERROR_V2(OB_LOG_DISK_SPACE_ALMOST_FULL, tmp_ret, "msg", "log disk space is almost full",
|
||||
", total_size(MB)=", log_disk_usage_limit_size/MB,
|
||||
", used_size(MB)=", used_size_byte/MB,
|
||||
", used_percent(%)=", (used_size_byte*100) / (log_disk_usage_limit_size + 1),
|
||||
", warn_size(MB)=", warn_siz/MB,
|
||||
", warn_percent(%)=", log_disk_warn_percent,
|
||||
", limit_size(MB)=", usable_disk_limit_size_to_stop_writing/MB,
|
||||
", limit_percent(%)=", log_disk_limit_percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,8 @@ public:
|
||||
void print_error_log(int ret) const
|
||||
{
|
||||
if (need_print_error_ && (OB_INVALID_DATA == ret || OB_CHECKSUM_ERROR == ret)) {
|
||||
PALF_LOG_RET(ERROR, ret, "invalid data or checksum error!!!", KPC(this));
|
||||
PALF_LOG(ERROR, "invalid data or checksum mismatch", KR(ret), KPC(this));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_CHECKSUM_MISMATCH, ret, "invalid data or checksum mismatch");
|
||||
}
|
||||
}
|
||||
void set_need_print_error(const bool need_print_error)
|
||||
|
@ -859,6 +859,7 @@ void ObLogReplayService::process_replay_ret_code_(const int ret_code,
|
||||
replay_task.replay_hint_, false, cur_ts, ret_code);
|
||||
LOG_DBA_ERROR(OB_LOG_REPLAY_ERROR, "msg", "replay task encountered fatal error", "ret", ret_code,
|
||||
K(replay_status), K(replay_task));
|
||||
LOG_DBA_ERROR_V2(OB_LOG_REPLAY_FAIL, ret_code, "replay task encountered fatal error");
|
||||
} else {/*do nothing*/}
|
||||
|
||||
if (OB_SUCCESS == task_queue.get_err_info_ret_code()) {
|
||||
|
@ -482,10 +482,12 @@ int main(int argc, char *argv[])
|
||||
char PID_DIR[] = "run";
|
||||
char CONF_DIR[] = "etc";
|
||||
char AUDIT_DIR[] = "audit";
|
||||
char ALERT_DIR[] = "log/alert";
|
||||
const char *const LOG_FILE_NAME = "log/observer.log";
|
||||
const char *const RS_LOG_FILE_NAME = "log/rootservice.log";
|
||||
const char *const ELECT_ASYNC_LOG_FILE_NAME = "log/election.log";
|
||||
const char *const TRACE_LOG_FILE_NAME = "log/trace.log";
|
||||
const char *const ALERT_LOG_FILE_NAME = "log/alert/alert.log";
|
||||
const char *const PID_FILE_NAME = "run/observer.pid";
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
@ -521,6 +523,8 @@ int main(int argc, char *argv[])
|
||||
MPRINT("create log dir fail: ./etc/");
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(AUDIT_DIR))) {
|
||||
MPRINT("create log dir fail: ./audit/");
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(ALERT_DIR))) {
|
||||
MPRINT("create log dir fail: ./log/alert");
|
||||
} else if (OB_FAIL(ObSecurityAuditUtils::get_audit_file_name(audit_file,
|
||||
ObPLogFileStruct::MAX_LOG_FILE_NAME_SIZE,
|
||||
pos))) {
|
||||
@ -528,6 +532,7 @@ int main(int argc, char *argv[])
|
||||
MPRINT("failed to init crypto malloc");
|
||||
} else if (!opts.nodaemon_ && OB_FAIL(start_daemon(PID_FILE_NAME))) {
|
||||
} else {
|
||||
ObCurTraceId::get_trace_id()->set("Y0-0000000000000001-0-0");
|
||||
CURLcode curl_code = curl_global_init(CURL_GLOBAL_ALL);
|
||||
OB_ASSERT(CURLE_OK == curl_code);
|
||||
|
||||
@ -536,7 +541,8 @@ int main(int argc, char *argv[])
|
||||
OB_LOGGER.set_log_level(opts.log_level_);
|
||||
OB_LOGGER.set_max_file_size(LOG_FILE_SIZE);
|
||||
OB_LOGGER.set_new_file_info(syslog_file_info);
|
||||
OB_LOGGER.set_file_name(LOG_FILE_NAME, false, true, RS_LOG_FILE_NAME, ELECT_ASYNC_LOG_FILE_NAME, TRACE_LOG_FILE_NAME, audit_file);
|
||||
OB_LOGGER.set_file_name(LOG_FILE_NAME, false, true, RS_LOG_FILE_NAME, ELECT_ASYNC_LOG_FILE_NAME,
|
||||
TRACE_LOG_FILE_NAME, audit_file, ALERT_LOG_FILE_NAME);
|
||||
ObPLogWriterCfg log_cfg;
|
||||
// if (OB_SUCCESS != (ret = ASYNC_LOG_INIT(ELECT_ASYNC_LOG_FILE_NAME, opts.log_level_, true))) {
|
||||
// LOG_ERROR("election async log init error.", K(ret));
|
||||
@ -548,6 +554,7 @@ int main(int argc, char *argv[])
|
||||
"election file", ELECT_ASYNC_LOG_FILE_NAME,
|
||||
"trace file", TRACE_LOG_FILE_NAME,
|
||||
K(audit_file),
|
||||
"alert file", ALERT_LOG_FILE_NAME,
|
||||
"max_log_file_size", LOG_FILE_SIZE,
|
||||
"enable_async_log", OB_LOGGER.enable_async_log());
|
||||
if (0 == memory_used) {
|
||||
|
@ -136,17 +136,12 @@ int ObRSTCollector::init()
|
||||
int ObRSTCollector::collect_query_response_time(uint64_t tenant_id, uint64_t time)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id));
|
||||
if (tenant_config.is_valid()) {
|
||||
if (tenant_config->query_response_time_stats) {
|
||||
ObRSTTimeCollector* time_collector;
|
||||
if (OB_FAIL(collector_map_.get_refactored(tenant_id, time_collector))) {
|
||||
SERVER_LOG(WARN, "time collector of the tenant does not exist", K(tenant_id), K(time), K(ret));
|
||||
} else {
|
||||
if(OB_FAIL(time_collector->collect(time))) {
|
||||
SERVER_LOG(WARN, "time collector of the tenant collect time failed", K(tenant_id), K(time), K(ret));
|
||||
}
|
||||
}
|
||||
ObRSTTimeCollector* time_collector;
|
||||
if (OB_FAIL(collector_map_.get_refactored(tenant_id, time_collector))) {
|
||||
SERVER_LOG(WARN, "time collector of the tenant does not exist", K(tenant_id), K(time), K(ret));
|
||||
} else {
|
||||
if(OB_FAIL(time_collector->collect(time))) {
|
||||
SERVER_LOG(WARN, "time collector of the tenant collect time failed", K(tenant_id), K(time), K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -830,6 +830,11 @@ int ObMPStmtExecute::request_params(ObSQLSessionInfo *session,
|
||||
ret = OB_ERR_PREPARE_STMT_CHECKSUM;
|
||||
LOG_ERROR("ps stmt checksum fail", K(ret), "session_id", session->get_sessid(),
|
||||
K(ps_stmt_checksum), K(*ps_session_info));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_PS_STMT_CHECKSUM_MISMATCH, ret,
|
||||
"ps stmt checksum fail. ",
|
||||
"the ps stmt checksum is ", ps_stmt_checksum,
|
||||
", but current session stmt checksum is ", ps_session_info->get_ps_stmt_checksum(),
|
||||
". current session id is ", session->get_sessid(), ". ");
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
LOG_TRACE("ps session info",
|
||||
|
@ -361,6 +361,11 @@ int ObMPStmtPrexecute::before_process()
|
||||
ret = OB_ERR_PREPARE_STMT_CHECKSUM;
|
||||
LOG_ERROR("ps stmt checksum fail", K(ret), "session_id", session->get_sessid(),
|
||||
K(ps_stmt_checksum), K(*ps_session_info));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_PS_STMT_CHECKSUM_MISMATCH, ret,
|
||||
"ps stmt checksum fail. ",
|
||||
"the ps stmt checksum is ", ps_stmt_checksum,
|
||||
", but current session stmt checksum is ", ps_session_info->get_ps_stmt_checksum(),
|
||||
". current session id is ", session->get_sessid(), ". ");
|
||||
} else {
|
||||
PS_DEFENSE_CHECK(4) // extend_flag
|
||||
{
|
||||
|
@ -70,14 +70,23 @@ int CheckAllParams::check_vm_max_map_count(bool strict_check)
|
||||
if (is_path_valid(file_path)) {
|
||||
int64_t max_map_count = 0;
|
||||
if (OB_FAIL(read_one_int(file_path, max_map_count))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "msg", "[check OS params]:read file failed", K(file_path));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL,
|
||||
OB_ERR_UNEXPECTED,
|
||||
"[check OS params]:read file failed. ",
|
||||
"file_path is ",
|
||||
file_path,
|
||||
". [suggestion] Please ensure vm.max_map_count is readable.");
|
||||
} else if (max_map_count >= 327600) {
|
||||
LOG_INFO("[check OS params]:vm.max_map_count is within the range", K(max_map_count));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(
|
||||
OB_IMPROPER_OS_PARAM, "msg", "[check OS params]:vm.max_map_count is less than 327600", K(max_map_count));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_MAX_MAP_COUNT_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:vm.max_map_count is less than 327600. ",
|
||||
"max_map_count is ",
|
||||
max_map_count,
|
||||
". [suggestion] Please modify the value of vm.max_map_count to ensure that it is greater than 327600.");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:vm.max_map_count is less than 327600", K(max_map_count));
|
||||
}
|
||||
@ -95,18 +104,26 @@ int CheckAllParams::check_vm_min_free_kbytes(bool strict_check)
|
||||
if (is_path_valid(file_path)) {
|
||||
int64_t vm_min_free_kbytes = 0;
|
||||
if (OB_FAIL(read_one_int(file_path, vm_min_free_kbytes))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "msg", "[check OS params]:read file failed", K(file_path));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL,
|
||||
OB_ERR_UNEXPECTED,
|
||||
"[check OS params]:read file failed. ",
|
||||
"file_path is ",
|
||||
file_path,
|
||||
". [suggestion] Please ensure vm.min_free_kbytes is readable.");
|
||||
} else if (vm_min_free_kbytes >= 32768 && vm_min_free_kbytes <= 2097152) {
|
||||
LOG_INFO("[check OS params]:vm.min_free_kbytes is within the range", K(vm_min_free_kbytes));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM,
|
||||
"msg",
|
||||
"[check OS params]:vm.min_free_kbytes is not within the allowed range [32768, 2097152]",
|
||||
K(vm_min_free_kbytes));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_MIN_FREE_KBYTES_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:vm.min_free_kbytes is not within the allowed range [32768, 2097152]. ",
|
||||
"vm.min_free_kbytes is ",
|
||||
vm_min_free_kbytes,
|
||||
". [suggestion] Please modify the value of vm.min_free_kbytes to ensure that it is in [32768, 2097152].");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:vm.min_free_kbytes is not within the allowed range [32768, 2097152]", K(vm_min_free_kbytes));
|
||||
LOG_WARN("[check OS params]:vm.min_free_kbytes is not within the allowed range [32768, 2097152]",
|
||||
K(vm_min_free_kbytes));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -122,13 +139,23 @@ int CheckAllParams::check_vm_overcommit_memory(bool strict_check)
|
||||
if (is_path_valid(file_path)) {
|
||||
int64_t vm_overcommit_memory = 0;
|
||||
if (OB_FAIL(read_one_int(file_path, vm_overcommit_memory))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "msg", "[check OS params]:read file failed", K(file_path));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL,
|
||||
OB_ERR_UNEXPECTED,
|
||||
"[check OS params]:read file failed. ",
|
||||
"file_path is ",
|
||||
file_path,
|
||||
". [suggestion] Please ensure vm.overcommit_memory is readable.");
|
||||
} else if (vm_overcommit_memory == 0) {
|
||||
LOG_INFO("[check OS params]:vm.overcommit_memory is equal to 0", K(vm_overcommit_memory));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM, "msg", "[check OS params]:vm.overcommit_memory is not the value:0", K(vm_overcommit_memory));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_OVERCOMMIT_MEMORY_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:vm.overcommit_memory is not the value:0. ",
|
||||
"vm.overcommit_memory is ",
|
||||
vm_overcommit_memory,
|
||||
". [suggestion] Please modify the value of vm.overcommit_memory to ensure that it is 0.");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:vm.overcommit_memory is not within the allowed value:0", K(vm_overcommit_memory));
|
||||
}
|
||||
@ -146,13 +173,23 @@ int CheckAllParams::check_fs_file_max(bool strict_check)
|
||||
if (is_path_valid(file_path)) {
|
||||
int64_t fs_file_max = 0;
|
||||
if (OB_FAIL(read_one_int(file_path, fs_file_max))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "msg", "[check OS params]:read file failed", K(file_path));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL,
|
||||
OB_ERR_UNEXPECTED,
|
||||
"[check OS params]:read file failed. ",
|
||||
"file_path is ",
|
||||
file_path,
|
||||
". [suggestion] Please ensure fs.file-max is readable.");
|
||||
} else if (fs_file_max >= 6573688) {
|
||||
LOG_INFO("[check OS params]:fs.file-max is greater than or equal to 6573688", K(fs_file_max));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM, "msg", "[check OS params]:fs.file-max is less than 6573688", K(fs_file_max));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_FS_FILE_MAX_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:fs.file-max is less than 6573688. ",
|
||||
"fs.file-max is ",
|
||||
fs_file_max,
|
||||
". [suggestion] Please modify the value of fs.file-max to ensure that it is greater than or equal to 6573688.");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:fs.file-max is less than 6573688", K(fs_file_max));
|
||||
}
|
||||
@ -170,22 +207,28 @@ int CheckAllParams::check_ulimit_open_files(bool strict_check)
|
||||
struct rlimit rlim;
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
|
||||
if (rlim.rlim_cur >= 655300 && rlim.rlim_max >= 655300) {
|
||||
LOG_INFO("[check OS params]:open files limit is greater than or equal to 655300", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
LOG_INFO(
|
||||
"[check OS params]:open files limit is greater than or equal to 655300", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM,
|
||||
"msg",
|
||||
"[check OS params]:open files limit's soft nofile or hard nofile is less than 655300, please run 'ulimit -n' to confirm the current limit and find a way to set it to the proper value",
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_ULIMIT_OPEN_FILES_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:open files limit's soft nofile or hard nofile is less than 655300.",
|
||||
" soft nofile is ",
|
||||
rlim.rlim_cur,
|
||||
" hard nofile is ",
|
||||
rlim.rlim_max,
|
||||
". [suggestion] Please run 'ulimit -n' to confirm the current limit and find a way to set it to the proper value.");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:open files limit's soft nofile or hard nofile is less than 655300, please run "
|
||||
"'ulimit -n' to confirm the current limit and find a way to set it to the proper value",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
} else {
|
||||
LOG_WARN(
|
||||
"[check OS params]:open files limit's soft nofile or hard nofile is less than 655300, please run 'ulimit -n' to confirm the current limit and find a way to set it to the proper value", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_DBA_ERROR(OB_FILE_NOT_EXIST, "msg", "read ulimit.open_file_limit file failed");
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL, OB_FILE_NOT_EXIST, "read ulimit.open_file_limit file failed ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -197,23 +240,30 @@ int CheckAllParams::check_ulimit_max_user_processes(bool strict_check)
|
||||
// Check process limit
|
||||
if (getrlimit(RLIMIT_NPROC, &rlim) == 0) {
|
||||
if (rlim.rlim_cur >= 655300 && rlim.rlim_max >= 655300) {
|
||||
LOG_INFO("[check OS params]:ulimit.max_user_processes is greater than or equal to 655300", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
LOG_INFO("[check OS params]:ulimit.max_user_processes is greater than or equal to 655300",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM,
|
||||
"msg",
|
||||
"[check OS params]:ulimit.max_user_processes's soft nofile or hard nofile is less than 655300, please run 'ulimit -u' to confirm the current limit and find a way to set it to the proper value",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_ULIMIT_MAX_USER_PROCESSES_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:ulimit.max_user_processes's soft nofile or hard nofile is less than 655300.",
|
||||
" soft nofile is ",
|
||||
rlim.rlim_cur,
|
||||
" hard nofile is ",
|
||||
rlim.rlim_max,
|
||||
". [suggestion] Please run 'ulimit -u' to confirm the current limit and find a way to set it to the proper "
|
||||
"value");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:ulimit.max_user_processes's soft nofile or hard nofile is less than 655300, please run 'ulimit -u' to confirm the current limit and find a way to set it to the proper value",
|
||||
LOG_WARN("[check OS params]:ulimit.max_user_processes's soft nofile or hard nofile is less than 655300, please "
|
||||
"run 'ulimit -u' to confirm the current limit and find a way to set it to the proper value",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_DBA_ERROR(OB_FILE_NOT_EXIST, "msg", "read ulimit.max_user_processes file failed");
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL, OB_FILE_NOT_EXIST, "read ulimit.max_user_processes file failed ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -227,10 +277,12 @@ int CheckAllParams::check_ulimit_core_file_size(bool strict_check)
|
||||
LOG_INFO("[check OS params]:core file size limit is unlimited");
|
||||
} else {
|
||||
// Violations of the recommended range will only trigger a warning, regardless of strict or non-strict checking.
|
||||
LOG_WARN("[check OS params]:ulimit.core_file_size limit's soft nofile or hard nofile is limited", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
LOG_WARN("[check OS params]:ulimit.core_file_size limit's soft nofile or hard nofile is limited",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
}
|
||||
} else {
|
||||
LOG_DBA_ERROR(OB_FILE_NOT_EXIST, "msg", "read ulimit.core_file_size file failed");
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL, OB_FILE_NOT_EXIST, "read ulimit.core_file_size file failed ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -246,18 +298,24 @@ int CheckAllParams::check_ulimit_stack_size(bool strict_check)
|
||||
} else {
|
||||
if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM,
|
||||
"msg",
|
||||
"[check OS params]: ulimit.stack_size limit's soft nofile or hard nofile is smaller than 1M, please run 'ulimit -s' to confirm the current limit and find a way to set it to the proper value",
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_ULIMIT_STACK_SIZE_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:ulimit.stack_size limit's soft nofile or hard nofile is smaller than 1M.",
|
||||
" soft nofile is ",
|
||||
rlim.rlim_cur,
|
||||
" hard nofile is ",
|
||||
rlim.rlim_max,
|
||||
". [suggestion] Please run 'ulimit -s' to confirm the current limit and find a way to set it to the proper."
|
||||
"value");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]: ulimit.stack_size limit's soft nofile or hard nofile is smaller than 1M, please "
|
||||
"run 'ulimit -s' to confirm the current limit and find a way to set it to the proper value",
|
||||
K(rlim.rlim_cur),
|
||||
K(rlim.rlim_max));
|
||||
} else {
|
||||
LOG_WARN(
|
||||
"[check OS params]: ulimit.stack_size limit's soft nofile or hard nofile is smaller than 1M, please run 'ulimit -s' to confirm the current limit and find a way to set it to the proper value", K(rlim.rlim_cur), K(rlim.rlim_max));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_DBA_ERROR(OB_FILE_NOT_EXIST, "msg", "read ulimit.stack_size file failed");
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL, OB_FILE_NOT_EXIST, "read ulimit.stack_size file failed ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -286,18 +344,31 @@ int CheckAllParams::check_current_clocksource(bool strict_check)
|
||||
if (is_path_valid(file_path)) {
|
||||
char clocksource[256];
|
||||
if (OB_FAIL(read_one_line(file_path, clocksource, sizeof(clocksource)))) {
|
||||
LOG_DBA_ERROR(OB_ERR_UNEXPECTED, "msg", "[check OS params]:read file failed", K(file_path));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_READ_FILE_FAIL,
|
||||
OB_ERR_UNEXPECTED,
|
||||
"[check OS params]:read file failed. ",
|
||||
"file_path is ",
|
||||
file_path,
|
||||
". [suggestion] Please ensure system parameter is readable.");
|
||||
} else {
|
||||
if (clocksource[strlen(clocksource) - 1] == '\n') {
|
||||
clocksource[strlen(clocksource) - 1] = '\0';
|
||||
}
|
||||
if (strcmp(clocksource, "tsc") == 0 || strcmp(clocksource, "kvm-clock") == 0 || strcmp(clocksource, "arch_sys_counter") == 0) {
|
||||
if (strcmp(clocksource, "tsc") == 0 || strcmp(clocksource, "kvm-clock") == 0 ||
|
||||
strcmp(clocksource, "arch_sys_counter") == 0) {
|
||||
LOG_INFO("[check OS params]:current_clocksource is in proper range", K(clocksource), K(ret));
|
||||
} else if (strict_check) {
|
||||
ret = OB_IMPROPER_OS_PARAM;
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM, "msg", "[check OS params]:current_clocksource is not [tsc], [kvm-clock], [arch_sys_counter]", K(clocksource), K(ret));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_CURRENT_CLOCKSOURCE_FAIL,
|
||||
OB_IMPROPER_OS_PARAM,
|
||||
"[check OS params]:current_clocksource is not [tsc], [kvm-clock], [arch_sys_counter]. ",
|
||||
"clocksource is ",
|
||||
clocksource,
|
||||
". [suggestion] Please change current_clocksource to [tsc], [kvm-clock], [arch_sys_counter].");
|
||||
} else {
|
||||
LOG_WARN("[check OS params]:current_clocksource is not [tsc], [kvm-clock], [arch_sys_counter]", K(clocksource), K(ret));
|
||||
LOG_WARN("[check OS params]:current_clocksource is not [tsc], [kvm-clock], [arch_sys_counter]",
|
||||
K(clocksource),
|
||||
K(ret));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -310,7 +381,7 @@ int check_os_params(bool strict_check_params = false)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(CheckAllParams::check_all_params(strict_check_params))) {
|
||||
LOG_DBA_ERROR(OB_IMPROPER_OS_PARAM, "msg", "check os params failed");
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_CHECK_ALL_PARAMS_FAIL, OB_IMPROPER_OS_PARAM, "check os params failed ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -259,6 +259,7 @@ int ObServer::parse_mode()
|
||||
int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
|
||||
{
|
||||
FLOG_INFO("[OBSERVER_NOTICE] start to init observer");
|
||||
DBA_STEP_RESET(server_start);
|
||||
int ret = OB_SUCCESS;
|
||||
opts_ = opts;
|
||||
scramble_rand_.init(static_cast<uint64_t>(start_time_), static_cast<uint64_t>(start_time_ / 2));
|
||||
@ -267,6 +268,12 @@ int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
|
||||
if (OB_FAIL(init_config())) {
|
||||
LOG_ERROR("init config failed", KR(ret));
|
||||
}
|
||||
// set alert log level earlier
|
||||
OB_LOGGER.set_alert_log_level(config_.alert_log_level);
|
||||
LOG_DBA_INFO_V2(OB_SERVER_INIT_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer init begin.");
|
||||
|
||||
//check os params
|
||||
if (OB_SUCC(ret) && OB_FAIL(check_os_params(GCONF.strict_check_os_params))) {
|
||||
LOG_ERROR("check OS params failed", K(GCONF.strict_check_os_params));
|
||||
@ -530,10 +537,16 @@ int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
|
||||
set_stop();
|
||||
destroy();
|
||||
LOG_ERROR("[OBSERVER_NOTICE] fail to init observer", KR(ret));
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_START, "msg", "observer init() has failure", KR(ret));
|
||||
LOG_DBA_FORCE_PRINT(DBA_ERROR, OB_SERVER_INIT_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer init fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
FLOG_INFO("[OBSERVER_NOTICE] success to init observer", "cluster_id", obrpc::ObRpcNetHandler::CLUSTER_ID,
|
||||
"lib::g_runtime_enabled", lib::g_runtime_enabled);
|
||||
LOG_DBA_INFO_V2(OB_SERVER_INIT_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer init success.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -851,6 +864,9 @@ int ObServer::start()
|
||||
gctx_.status_ = SS_STARTING;
|
||||
// begin to start a observer
|
||||
FLOG_INFO("[OBSERVER_NOTICE] start observer begin");
|
||||
LOG_DBA_INFO_V2(OB_SERVER_START_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer start begin.");
|
||||
|
||||
if (is_arbitration_mode()) {
|
||||
#ifdef OB_BUILD_ARBITRATION
|
||||
@ -866,6 +882,9 @@ int ObServer::start()
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_INSTANCE_START_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer instance start begin.");
|
||||
if (OB_FAIL(start_sig_worker_and_handle())) {
|
||||
LOG_ERROR("fail to start signal worker", KR(ret));
|
||||
}
|
||||
@ -1035,9 +1054,17 @@ int ObServer::start()
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
FLOG_INFO("[OBSERVER_NOTICE] server instance start succeed");
|
||||
LOG_DBA_INFO_V2(OB_SERVER_INSTANCE_START_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer instance start success.");
|
||||
prepare_stop_ = false;
|
||||
stop_ = false;
|
||||
has_stopped_ = false;
|
||||
} else {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_INSTANCE_START_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer instance start fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
}
|
||||
// this handler is only used to process tasks during startup. so it can be destroied here.
|
||||
startup_accel_handler_.destroy();
|
||||
@ -1108,16 +1135,25 @@ int ObServer::start()
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_ERROR("failure occurs, try to set stop and wait", KR(ret));
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_START, "msg", "observer start() has failure", KR(ret));
|
||||
LOG_DBA_FORCE_PRINT(DBA_ERROR, OB_SERVER_START_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer start fail, the stop status is ", stop_, ". "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
set_stop();
|
||||
wait();
|
||||
} else if (!stop_) {
|
||||
GCTX.status_ = SS_SERVING;
|
||||
GCTX.start_service_time_ = ObTimeUtility::current_time();
|
||||
FLOG_INFO("[OBSERVER_NOTICE] observer start service", "start_service_time", GCTX.start_service_time_);
|
||||
LOG_DBA_INFO_V2(OB_SERVER_START_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer start success.");
|
||||
} else {
|
||||
FLOG_INFO("[OBSERVER_NOTICE] observer is set to stop", KR(ret), K_(stop));
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_START, "msg", "observer start process is interrupted", KR(ret), K_(stop));
|
||||
LOG_DBA_FORCE_PRINT(DBA_ERROR, OB_SERVER_START_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer start fail, the stop status is ", stop_, ". "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1150,6 +1186,9 @@ int ObServer::check_if_multi_tenant_synced()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool synced = false;
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_MULTI_TENANT_SYNCED_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait multi tenant synced begin.");
|
||||
while (OB_SUCC(ret) && !stop_ && !synced) {
|
||||
synced = multi_tenant_.has_synced();
|
||||
if (!synced) {
|
||||
@ -1157,6 +1196,16 @@ int ObServer::check_if_multi_tenant_synced()
|
||||
}
|
||||
}
|
||||
FLOG_INFO("check if multi tenant synced", KR(ret), K(stop_), K(synced));
|
||||
if (!stop_ && synced) {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_MULTI_TENANT_SYNCED_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait multi tenant synced success.");
|
||||
} else {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_WAIT_MULTI_TENANT_SYNCED_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait multi tenant synced fail, server stop status is ", stop_, ". "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1164,6 +1213,9 @@ int ObServer::check_if_schema_ready()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool schema_ready = false;
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_SCHEMA_READY_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait schema ready begin.");
|
||||
while (OB_SUCC(ret) && !stop_ && !schema_ready) {
|
||||
schema_ready = schema_service_.is_sys_full_schema();
|
||||
if (!schema_ready) {
|
||||
@ -1171,6 +1223,16 @@ int ObServer::check_if_schema_ready()
|
||||
}
|
||||
}
|
||||
FLOG_INFO("check if schema ready", KR(ret), K(stop_), K(schema_ready));
|
||||
if (!stop_ && schema_ready) {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_SCHEMA_READY_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait schema ready success.");
|
||||
} else {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_WAIT_SCHEMA_READY_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"wait schema ready fail, server stop status is ", stop_, ". "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1222,6 +1284,7 @@ int ObServer::stop()
|
||||
int ret = OB_SUCCESS;
|
||||
int fail_ret = OB_SUCCESS;
|
||||
FLOG_INFO("[OBSERVER_NOTICE] stop observer begin");
|
||||
LOG_DBA_INFO_V2(OB_SERVER_STOP_BEGIN, "observer stop begin.");
|
||||
|
||||
FLOG_INFO("begin to stop OB_LOGGER");
|
||||
OB_LOGGER.stop();
|
||||
@ -1535,7 +1598,10 @@ int ObServer::stop()
|
||||
has_stopped_ = true;
|
||||
FLOG_INFO("[OBSERVER_NOTICE] stop observer end", KR(ret));
|
||||
if (OB_SUCCESS != fail_ret) {
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_STOP, "msg", "observer stop() has failure", KR(fail_ret));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_STOP_FAIL, fail_ret, "observer stop fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_STOP_SUCCESS, "observer stop success.");
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1546,6 +1612,7 @@ int ObServer::wait()
|
||||
int ret = OB_SUCCESS;
|
||||
int fail_ret = OB_SUCCESS;
|
||||
FLOG_INFO("[OBSERVER_NOTICE] wait observer begin");
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_BEGIN, "observer process wait begin.");
|
||||
// wait for stop flag
|
||||
|
||||
FLOG_INFO("begin to wait observer setted to stop");
|
||||
@ -1800,7 +1867,10 @@ int ObServer::wait()
|
||||
gctx_.status_ = SS_STOPPED;
|
||||
FLOG_INFO("[OBSERVER_NOTICE] wait observer end", KR(ret));
|
||||
if (OB_SUCCESS != fail_ret) {
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_STOP, "msg", "observer wait() has failure", KR(fail_ret));
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_WAIT_FAIL, fail_ret, "observer process wait fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_WAIT_SUCCESS, "observer process wait succcess.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1972,15 +2042,22 @@ int ObServer::init_local_ip_and_devname()
|
||||
bool has_found = false;
|
||||
if (OB_SUCCESS != obsys::ObNetUtil::get_ifname_by_addr(config_.local_ip, if_name, sizeof(if_name), has_found)) {
|
||||
// if it is incorrect, then ObServer start but log a error.
|
||||
LOG_DBA_WARN(OB_ERR_OBSERVER_START, "get ifname by local_ip failed, local_ip", config_.local_ip.get_value());
|
||||
LOG_DBA_WARN_V2(OB_SERVER_GET_IFNAME_FAIL, OB_ERR_OBSERVER_START,
|
||||
"get ifname by local_ip failed. ",
|
||||
"local_ip is ", config_.local_ip.get_value(),
|
||||
". [suggestion] Verify if your local IP address is a virtual one.");
|
||||
} else if (false == has_found) {
|
||||
LOG_DBA_ERROR(OB_ERR_OBSERVER_START, "local_ip set failed, please check your local_ip", config_.local_ip.get_value());
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_SET_LOCAL_IP_FAIL, OB_ERR_OBSERVER_START,
|
||||
"local_ip set failed, please check your local_ip. ",
|
||||
"local_ip is ", config_.local_ip.get_value(),
|
||||
". [suggestion] Verify if your local IP is right. ");
|
||||
} else if (0 != strcmp(config_.devname, if_name)) {
|
||||
config_.devname.set_value(if_name);
|
||||
config_.devname.set_version(start_time_);
|
||||
// this is done to ensure the consistency of local_ip and devname.
|
||||
LOG_DBA_WARN(OB_ITEM_NOT_MATCH, "the devname has been rewritten, and the new value comes from local_ip, old value",
|
||||
config_.devname.get_value(), "new value", if_name, "local_ip", config_.local_ip.get_value());
|
||||
LOG_DBA_WARN_V2(OB_SERVER_DEVICE_NAME_MISMATCH, OB_ITEM_NOT_MATCH,
|
||||
"the devname has been rewritten, and the new value comes from local_ip, old value: ",
|
||||
config_.devname.get_value(), " new value: ", if_name, " local_ip: ", config_.local_ip.get_value());
|
||||
}
|
||||
} else {
|
||||
if (config_.use_ipv6) {
|
||||
@ -3093,6 +3170,9 @@ void ObServer::check_user_tenant_schema_refreshed(const ObIArray<uint64_t> &tena
|
||||
bool is_dropped = false;
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t tenant_id = OB_INVALID_TENANT_ID;
|
||||
LOG_DBA_INFO_V2(OB_SERVER_CHECK_USER_TENANT_SCHEMA_REFRESHED_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer check user tenant schema refreshed begin.");
|
||||
|
||||
for (int64_t i = 0; i < tenant_ids.count()
|
||||
&& ObTimeUtility::current_time() < expire_time; ++i) {
|
||||
@ -3130,10 +3210,16 @@ void ObServer::check_user_tenant_schema_refreshed(const ObIArray<uint64_t> &tena
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_DBA_INFO_V2(OB_SERVER_CHECK_USER_TENANT_SCHEMA_REFRESHED_FINISH,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer check user tenant schema refreshed finish.");
|
||||
}
|
||||
|
||||
void ObServer::check_log_replay_over(const ObIArray<uint64_t> &tenant_ids, const int64_t expire_time)
|
||||
{
|
||||
LOG_DBA_INFO_V2(OB_SERVER_CHECK_LOG_REPLAY_OVER_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer check log replay over begin.");
|
||||
for (int64_t i = 0; i < tenant_ids.count()
|
||||
&& ObTimeUtility::current_time() < expire_time; ++i) {
|
||||
SCN min_version;
|
||||
@ -3157,6 +3243,9 @@ void ObServer::check_log_replay_over(const ObIArray<uint64_t> &tenant_ids, const
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_DBA_INFO_V2(OB_SERVER_CHECK_LOG_REPLAY_OVER_FINISH,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"observer check log replay over finish.");
|
||||
}
|
||||
|
||||
ObServer::ObCTASCleanUpTask::ObCTASCleanUpTask()
|
||||
|
@ -203,7 +203,8 @@ int get_user_tenant(ObRequest &req, char *user_name_buf, char *tenant_name_buf)
|
||||
// not from LB, do nothing
|
||||
} else if (!tenant_name.empty()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_DBA_WARN(OB_INVALID_CONFIG, "msg", "connect from LB, but tenant_name is not empty");
|
||||
LOG_DBA_WARN_V2(OB_SERVER_TENANT_NAME_NOT_EMPTY, OB_INVALID_CONFIG,
|
||||
"The connections from the load balancer cannot have tenant names.");
|
||||
} else {
|
||||
const int64_t endpoint_tenant_mapping_buf_len = STRLEN(GCONF._endpoint_tenant_mapping.str());
|
||||
endpoint_tenant_mapping_buf =
|
||||
@ -280,7 +281,11 @@ int dispatch_req(const uint64_t tenant_id, ObRequest &req, QueueThread *global_m
|
||||
} else if (!mysql_queue->queue_.push(&req, MAX_QUEUE_LEN)) { // MAX_QUEUE_LEN = 10000;
|
||||
ret = OB_QUEUE_OVERFLOW;
|
||||
EVENT_INC(MYSQL_DELIVER_FAIL);
|
||||
LOG_ERROR("deliver request fail", K(ret), K(tenant_id), K(req));
|
||||
LOG_ERROR("deliver mysql login request fail", K(ret), K(tenant_id), K(req));
|
||||
LOG_DBA_ERROR_V2(OB_TENANT_REQUEST_QUEUE_FULL, ret,
|
||||
"tenant: ", tenant_id, " mysql login request queue is full. ",
|
||||
" [suggestion] check T", tenant_id, "_MysqlQueueTh thread stack to see which"
|
||||
" procedure is taking too long or is blocked.");
|
||||
} else {
|
||||
LOG_INFO("succeed to dispatch to tenant mysql queue", K(tenant_id));
|
||||
}
|
||||
@ -742,11 +747,16 @@ int ObSrvDeliver::deliver_mysql_request(ObRequest &req)
|
||||
LOG_WARN("tenant is stopped", K(ret), K(tenant->id()));
|
||||
} else if (OB_FAIL(tenant->recv_request(req))) {
|
||||
EVENT_INC(MYSQL_DELIVER_FAIL);
|
||||
LOG_ERROR("deliver request fail", K(req), K(*tenant));
|
||||
LOG_ERROR("deliver request fail", K(req), K(ret), K(*tenant));
|
||||
if (OB_SIZE_OVERFLOW == ret) {
|
||||
LOG_DBA_ERROR_V2(OB_TENANT_REQUEST_QUEUE_FULL, ret,
|
||||
"deliver mysql request to tenant: ", tenant->id(), " queue failed, the queue is full. ",
|
||||
"[suggestion] check T", tenant->id(), "_L0_G0 thread stack to see which "
|
||||
"procedure is taking too long or is blocked or check __all_virtual_thread view.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX SERVER
|
||||
#include "io/easy_maccept.h"
|
||||
#include "observer/ob_srv_network_frame.h"
|
||||
#include "rpc/obmysql/ob_sql_nio_server.h"
|
||||
#include "observer/mysql/obsm_conn_callback.h"
|
||||
@ -167,6 +166,11 @@ int ObSrvNetworkFrame::init()
|
||||
} else {
|
||||
if (OB_FAIL(obrpc::global_poc_server.start(rpc_port, io_cnt, &deliver_))) {
|
||||
LOG_ERROR("poc rpc server start fail", K(ret));
|
||||
if (OB_SERVER_LISTEN_ERROR == ret) {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_LISTEN_FAIL, ret,
|
||||
"listen port: ", rpc_port, " for rpc service failed. ",
|
||||
"[suggestion] check whether if rpc_port: ", rpc_port, " being occupied by another process.");
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("poc rpc server start successfully");
|
||||
}
|
||||
|
@ -162,6 +162,18 @@ int ObPLPackageManager::read_and_exec_package_sql(
|
||||
// but we need to create system packages with oralce compatibility
|
||||
// here hack to oracle mode
|
||||
bool eof = false;
|
||||
bool skip_affected_rows_check = false;
|
||||
ObSessionParam param;
|
||||
ObSessionParam *param_ptr = nullptr;
|
||||
char *last_slash = strrchr(const_cast<char*>(package_full_path), '/');
|
||||
const char *pacakge_filename = (last_slash != NULL) ? last_slash + 1 : package_full_path;
|
||||
int64_t sql_mode = SMO_STRICT_ALL_TABLES | SMO_NO_ZERO_IN_DATE | SMO_NO_AUTO_CREATE_USER;
|
||||
// allow affected_rows > 0 when exec sql in external_table_alert_log.sql
|
||||
if (strcmp(pacakge_filename, "external_table_alert_log.sql") == 0) {
|
||||
skip_affected_rows_check = true;
|
||||
param.sql_mode_ = &sql_mode;
|
||||
param_ptr = ¶m;
|
||||
}
|
||||
SMART_VAR(char[OB_MAX_SQL_LENGTH], sql_buf) {
|
||||
while (OB_SUCC(ret) && !eof) {
|
||||
if (OB_FAIL(read_package_sql(file, sql_buf, OB_MAX_SQL_LENGTH, eof))) {
|
||||
@ -170,9 +182,10 @@ int ObPLPackageManager::read_and_exec_package_sql(
|
||||
&& OB_FAIL(sql_proxy.write(OB_SYS_TENANT_ID,
|
||||
sql_buf,
|
||||
affected_rows,
|
||||
static_cast<int64_t>(compa_mode)))) {
|
||||
static_cast<int64_t>(compa_mode),
|
||||
param_ptr))) {
|
||||
LOG_WARN("fail to exec package sql", K(sql_buf), K(ret));
|
||||
} else if (affected_rows != 0) {
|
||||
} else if (affected_rows != 0 && !skip_affected_rows_check) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("affected_rows expected to be zero", K(affected_rows), K(ret));
|
||||
} else {
|
||||
@ -288,7 +301,8 @@ static ObSysPackageFile mysql_sys_package_file_table[] = {
|
||||
{"dbms_mview_stats", "dbms_mview_stats_mysql.sql", "dbms_mview_stats_body_mysql.sql"},
|
||||
{"dbms_trusted_certificate_manager", "dbms_trusted_certificate_manager_mysql.sql", "dbms_trusted_certificate_manager_body_mysql.sql"},
|
||||
{"dbms_ob_limit_calculator", "dbms_ob_limit_calculator_mysql.sql", "dbms_ob_limit_calculator_body_mysql.sql"},
|
||||
{"dbms_external_table", "dbms_external_table_mysql.sql", "dbms_external_table_body_mysql.sql"}
|
||||
{"dbms_external_table", "dbms_external_table_mysql.sql", "dbms_external_table_body_mysql.sql"},
|
||||
{"external_table_alert_log", "external_table_alert_log.sql", "none"}
|
||||
};
|
||||
|
||||
int ObPLPackageManager::load_sys_package(ObMySQLProxy &sql_proxy, ObString &package_name, ObCompatibilityMode compa_mode)
|
||||
|
@ -240,6 +240,7 @@ int ObPreBootstrap::prepare_bootstrap(ObAddr &master_rs)
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_empty = false;
|
||||
bool match = false;
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_PREPARE_BEGIN, "bootstrap prepare begin.");
|
||||
begin_ts_ = ObTimeUtility::current_time();
|
||||
if (OB_FAIL(check_inner_stat())) {
|
||||
LOG_WARN("check_inner_stat failed", KR(ret));
|
||||
@ -267,6 +268,12 @@ int ObPreBootstrap::prepare_bootstrap(ObAddr &master_rs)
|
||||
LOG_WARN("failed to wait elect master partition", KR(ret));
|
||||
}
|
||||
BOOTSTRAP_CHECK_SUCCESS();
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_ERROR_V2(OB_BOOTSTRAP_PREPARE_FAIL, ret, "bootstrap prepare fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_PREPARE_SUCCESS, "bootstrap prepare success.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -591,18 +598,50 @@ int ObBootstrap::execute_bootstrap(rootserver::ObServerZoneOpService &server_zon
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(init_system_data())) {
|
||||
LOG_WARN("failed to init system data", KR(ret));
|
||||
} else if (OB_FAIL(ddl_service_.refresh_schema(OB_SYS_TENANT_ID))) {
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_BEGIN,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap refresh all schema begin.");
|
||||
}
|
||||
if (FAILEDx(ddl_service_.refresh_schema(OB_SYS_TENANT_ID))) {
|
||||
LOG_WARN("failed to refresh_schema", K(ret));
|
||||
LOG_DBA_ERROR_V2(OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap refresh all schema fail. [suggestion] you can: "
|
||||
"1. Search previous error logs that may indicate the cause of this failure. "
|
||||
"2. Check if other nodes are accessible via ssh. "
|
||||
"2. Check whether other nodes can establish connections through sql client. "
|
||||
"3. Check the alert.log on others node to see if there are other error logs.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_REFRESH_ALL_SCHEMA_SUCCESS,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap refresh all schema success.");
|
||||
}
|
||||
}
|
||||
BOOTSTRAP_CHECK_SUCCESS_V2("refresh_schema");
|
||||
|
||||
if (FAILEDx(add_servers_in_rs_list(server_zone_op_service))) {
|
||||
LOG_WARN("fail to add servers in rs_list_", KR(ret));
|
||||
} else if (OB_FAIL(wait_all_rs_in_service())) {
|
||||
LOG_WARN("failed to wait all rs in service", KR(ret));
|
||||
} else {
|
||||
ROOTSERVICE_EVENT_ADD("bootstrap", "bootstrap_succeed");
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_BEGIN,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap wait all rootservice in service begin.");
|
||||
if (OB_FAIL(wait_all_rs_in_service())) {
|
||||
LOG_WARN("failed to wait all rs in service", KR(ret));
|
||||
LOG_DBA_ERROR_V2(OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap wait all rootservice in service fail. "
|
||||
"[suggestion] maybe this node is not leader anymore or just timeout.(depends on error code) you can:"
|
||||
"1. Check whether the current node is the leader through oceanbase.CDB_OB_LS; "
|
||||
"2. Check whether the network between nodes is connected; "
|
||||
"3. Check the alert.log on other nodes;");
|
||||
} else {
|
||||
ROOTSERVICE_EVENT_ADD("bootstrap", "bootstrap_succeed");
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_WAIT_ALL_ROOTSERVICE_SUCCESS,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap wait all rootservice in service success.");
|
||||
}
|
||||
}
|
||||
|
||||
BOOTSTRAP_CHECK_SUCCESS();
|
||||
@ -962,6 +1001,9 @@ int ObBootstrap::create_all_schema(ObDDLService &ddl_service,
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t begin_time = ObTimeUtility::current_time();
|
||||
LOG_INFO("start create all schemas", "table count", table_schemas.count());
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_CREATE_ALL_SCHEMA_BEGIN,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create all schema begin.");
|
||||
if (table_schemas.count() <= 0) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("table_schemas is empty", K(table_schemas), K(ret));
|
||||
@ -1008,6 +1050,16 @@ int ObBootstrap::create_all_schema(ObDDLService &ddl_service,
|
||||
}
|
||||
LOG_INFO("end create all schemas", K(ret), "table count", table_schemas.count(),
|
||||
"time_used", ObTimeUtility::current_time() - begin_time);
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_ERROR_V2(OB_BOOTSTRAP_CREATE_ALL_SCHEMA_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create all schema fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_CREATE_ALL_SCHEMA_SUCCESS,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create all schema success.");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1435,6 +1487,9 @@ int ObBootstrap::insert_sys_ls_(const share::schema::ObTenantSchema &tenant_sche
|
||||
int ObBootstrap::init_system_data()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_CREATE_SYS_TENANT_BEGIN,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create sys tenant begin.");
|
||||
if (OB_FAIL(check_inner_stat())) {
|
||||
LOG_WARN("check_inner_stat failed", KR(ret));
|
||||
} else if (OB_FAIL(unit_mgr_.load())) {
|
||||
@ -1448,6 +1503,16 @@ int ObBootstrap::init_system_data()
|
||||
} else if (OB_FAIL(init_all_zone_table())) {
|
||||
LOG_WARN("failed to init all zone table", KR(ret));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_ERROR_V2(OB_BOOTSTRAP_CREATE_SYS_TENANT_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create sys tenant fail. maybe some resources are not enough. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_CREATE_SYS_TENANT_SUCCESS,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"bootstrap create sys tenant success.");
|
||||
}
|
||||
BOOTSTRAP_CHECK_SUCCESS();
|
||||
return ret;
|
||||
}
|
||||
|
@ -1958,6 +1958,10 @@ int ObRootService::execute_bootstrap(const obrpc::ObBootstrapArg &arg)
|
||||
int ret = OB_SUCCESS;
|
||||
const obrpc::ObServerInfoList &server_list = arg.server_list_;
|
||||
BOOTSTRAP_LOG(INFO, "STEP_1.1:execute_bootstrap start to executor.");
|
||||
DBA_STEP_RESET(bootstrap);
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_BEGIN,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"cluster bootstrap begin.");
|
||||
if (!inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("root_service not inited", K(ret));
|
||||
@ -2040,6 +2044,17 @@ int ObRootService::execute_bootstrap(const obrpc::ObBootstrapArg &arg)
|
||||
ret = OB_SUCC(ret) ? tmp_ret : ret;
|
||||
}
|
||||
BOOTSTRAP_LOG(INFO, "execute_bootstrap finished", K(ret));
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_FORCE_PRINT(DBA_ERROR, OB_BOOTSTRAP_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"cluster bootstrap fail. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_BOOTSTRAP_SUCCESS,
|
||||
DBA_STEP_INC_INFO(bootstrap),
|
||||
"cluster bootstrap success.");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -10992,11 +11007,14 @@ void ObRootService::update_fail_count(int ret)
|
||||
if (count > OB_ROOT_SERVICE_START_FAIL_COUNT_UPPER_LIMIT
|
||||
&& REACH_TIME_INTERVAL(60 * 1000 * 1000)) {
|
||||
LOG_ERROR("rs_monitor_check : fail to start root service", KR(ret), K(count));
|
||||
LOG_DBA_FORCE_PRINT(DBA_ERROR, OB_ROOTSERVICE_START_FAIL, ret,
|
||||
"rootservice start()/do_restart() has failed ", count, " times. "
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_WARN("rs_monitor_check : fail to start root service", KR(ret), K(count));
|
||||
LOG_DBA_WARN(OB_ERR_ROOTSERVICE_START, "msg", "rootservice start()/do_restart() has failure",
|
||||
KR(ret), "fail_cnt", count);
|
||||
}
|
||||
LOG_DBA_WARN(OB_ERR_ROOTSERVICE_START, "msg", "rootservice start()/do_restart() has failure",
|
||||
KR(ret), "fail_cnt", count);
|
||||
}
|
||||
|
||||
int ObRootService::send_physical_restore_result(const obrpc::ObPhysicalRestoreResult &res)
|
||||
|
@ -453,6 +453,12 @@ bool ObConfigLogLevelChecker::check(const ObConfigItem &t) const
|
||||
|| OB_SUCCESS == OB_LOGGER.parse_check(tmp_str.ptr(), tmp_str.length()));
|
||||
}
|
||||
|
||||
bool ObConfigAlertLogLevelChecker::check(const ObConfigItem &t) const
|
||||
{
|
||||
const ObString tmp_str(t.str());
|
||||
return OB_SUCCESS == OB_LOGGER.parse_check_alert(tmp_str.ptr(), tmp_str.length());
|
||||
}
|
||||
|
||||
bool ObConfigAuditTrailChecker::check(const ObConfigItem &t) const
|
||||
{
|
||||
common::ObString tmp_string(t.str());
|
||||
|
@ -324,6 +324,18 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObConfigLogLevelChecker);
|
||||
};
|
||||
|
||||
class ObConfigAlertLogLevelChecker
|
||||
: public ObConfigChecker
|
||||
{
|
||||
public:
|
||||
ObConfigAlertLogLevelChecker() {}
|
||||
virtual ~ObConfigAlertLogLevelChecker() {};
|
||||
bool check(const ObConfigItem &t) const;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObConfigAlertLogLevelChecker);
|
||||
};
|
||||
|
||||
class ObConfigAuditTrailChecker
|
||||
: public ObConfigChecker
|
||||
{
|
||||
|
@ -0,0 +1,31 @@
|
||||
#package_name: external_table_alert_log
|
||||
#author: liangjinrong.ljr
|
||||
|
||||
create database if not exists sys_external_tbs;
|
||||
//
|
||||
|
||||
create external table if not exists sys_external_tbs.__all_external_alert_log_info (
|
||||
time varchar(30) as (metadata$filecol1),
|
||||
level varchar(10) as (metadata$filecol2),
|
||||
module varchar(30) as (metadata$filecol3),
|
||||
event varchar(100) as (metadata$filecol4),
|
||||
errcode int as (metadata$filecol5),
|
||||
ip varchar(100) as (substr(metadata$fileurl, 1, instr(metadata$fileurl, ':') - 1)),
|
||||
port varchar(100) as (substr(metadata$fileurl, instr(metadata$fileurl, ':') + 1, instr(metadata$fileurl, '%') - instr(metadata$fileurl, ':') - 1)),
|
||||
tenant_id int as (metadata$filecol6),
|
||||
thread_id int as (metadata$filecol7),
|
||||
thread_name varchar(50) as (metadata$filecol8),
|
||||
trace_id varchar(50) as (metadata$filecol9),
|
||||
func_name varchar(100) as (metadata$filecol10),
|
||||
code_location varchar(100) as (metadata$filecol11),
|
||||
message longtext as (metadata$filecol12)
|
||||
)
|
||||
location = 'log/alert'
|
||||
format = (
|
||||
type = 'csv'
|
||||
field_delimiter = '|'
|
||||
field_optionally_enclosed_by = '"'
|
||||
)
|
||||
pattern = 'alert.log[.0-9]*'
|
||||
;
|
||||
//
|
@ -3471,7 +3471,9 @@ void ObIOFaultDetector::set_device_error()
|
||||
last_device_error_ts_ = ObTimeUtility::fast_current_time();
|
||||
is_device_error_ = true;
|
||||
LOG_ERROR_RET(OB_IO_ERROR, "set_disk_error: attention!!!");
|
||||
LOG_DBA_ERROR(OB_DISK_ERROR, "msg", "The disk may be corrupted");
|
||||
LOG_DBA_ERROR_V2(OB_COMMON_DISK_INVALID, OB_DISK_ERROR,
|
||||
"The disk may be corrupted. ",
|
||||
"[suggestion] check disk.");
|
||||
}
|
||||
|
||||
ObIOTracer::ObIOTracer()
|
||||
|
@ -1399,7 +1399,10 @@ int ObLocalDevice::check_space_full(const int64_t required_size) const
|
||||
&& used_percent >= GCONF.data_disk_usage_limit_percentage) {
|
||||
ret = OB_SERVER_OUTOF_DISK_SPACE;
|
||||
if (REACH_TIME_INTERVAL(24 * 3600LL * 1000 * 1000 /* 24h */)) {
|
||||
LOG_DBA_ERROR(OB_SERVER_OUTOF_DISK_SPACE, "msg", "disk is almost full", K(ret), K(required_size), K(used_percent));
|
||||
LOG_DBA_ERROR_V2(OB_SHARE_OUTOF_DISK_SPACE, OB_SERVER_OUTOF_DISK_SPACE,
|
||||
"disk is almost full. resuired size is ", required_size,
|
||||
" and used percent is ", used_percent, "%. ",
|
||||
"[suggestion] Increase the datafile_size or datafile_disk_percentage parameter. ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,17 @@ int ObTabletAutoincMgr::fetch_new_range(const ObTabletAutoincParam ¶m,
|
||||
LOG_WARN("failed to get autoinc cache", K(ret));
|
||||
} else if (tablet_id.is_user_normal_rowid_table_tablet() && node.cache_end_ > OB_MAX_AUTOINC_SEQ_VALUE) {
|
||||
ret = OB_HEAP_TABLE_EXAUSTED;
|
||||
LOG_DBA_ERROR(OB_HEAP_TABLE_EXAUSTED, "msg", "The hidden primary key sequence has exhausted", K(tablet_id), "current_seq", node.cache_end_);
|
||||
LOG_DBA_ERROR_V2(OB_SHARE_PRIMARY_KEY_SEQUENCE_EXHAUSTED, OB_HEAP_TABLE_EXAUSTED,
|
||||
"The hidden primary key sequence has exhausted. ",
|
||||
"tablet_id is ", tablet_id.id(), " and current_seq is ", node.cache_end_, ". ",
|
||||
"[suggestion] If you need a larger key range, ",
|
||||
"you can connect cluster by current tenant and execute sql command: ",
|
||||
"alter table {database_name}.{table_name} set enable_extended_rowid = true; ",
|
||||
"If you don't know the {database_name} or {table_name}, you can get them by executing sql command: ",
|
||||
"(Mysql mode): ",
|
||||
"select distinct database_name, table_name from oceanbase.DBA_OB_TABLE_LOCATIONS where tablet_id = ", tablet_id.id(), "; ",
|
||||
"(Oracle mode): ",
|
||||
"select distinct database_name, table_name from sys.DBA_OB_TABLE_LOCATIONS where tablet_id = ", tablet_id.id(), "; ");
|
||||
LOG_WARN("tablet autoinc seq has reached max", K(ret), K(node));
|
||||
} else {
|
||||
LOG_INFO("fetch new range success", K(tablet_id), K(node));
|
||||
|
@ -189,6 +189,10 @@ DEF_STR(obconfig_url, OB_CLUSTER_PARAMETER, "", "URL for OBConfig service",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_LOG_LEVEL(syslog_level, OB_CLUSTER_PARAMETER, "WDIAG", "specifies the current level of logging. There are DEBUG, TRACE, WDIAG, EDIAG, INFO, WARN, ERROR, seven different log levels.",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_STR_WITH_CHECKER(alert_log_level, OB_CLUSTER_PARAMETER, "INFO",
|
||||
common::ObConfigAlertLogLevelChecker,
|
||||
"specifies the current level of alert log. There are INFO, WARN, ERROR, three different log levels.",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
DEF_CAP(syslog_io_bandwidth_limit, OB_CLUSTER_PARAMETER, "30MB",
|
||||
"Syslog IO bandwidth limitation, exceeding syslog would be truncated. Use 0 to disable ERROR log.",
|
||||
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
|
||||
|
@ -752,8 +752,8 @@ int ObTscCgService::generate_access_ctdef(const ObLogTableScan &op,
|
||||
OZ(access_column_ids.push_back(common::OB_HIDDEN_GROUP_IDX_COLUMN_ID));
|
||||
} else if (T_PSEUDO_EXTERNAL_FILE_COL == expr->get_expr_type()) {
|
||||
//TODO EXTERNAL-TABLE
|
||||
} else if (T_PSEUDO_PARTITION_LIST_COL == expr->get_expr_type()) {
|
||||
} else if (T_PSEUDO_EXTERNAL_FILE_URL == expr->get_expr_type()) {
|
||||
} else if (T_PSEUDO_PARTITION_LIST_COL == expr->get_expr_type()) {
|
||||
} else {
|
||||
ObColumnRefRawExpr* col_expr = static_cast<ObColumnRefRawExpr *>(expr);
|
||||
bool is_mapping_vt_table = op.get_real_ref_table_id() != op.get_ref_table_id();
|
||||
|
@ -146,6 +146,72 @@ int ObDASInsertOp::insert_rows()
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObDASInsertOp::insert_index_with_fetch(ObAccessService *as,
|
||||
ObNewRowIterator &dml_iter,
|
||||
ObDASConflictIterator *result_iter,
|
||||
const ObDASInsCtDef *ins_ctdef,
|
||||
ObDASInsRtDef *ins_rtdef,
|
||||
storage::ObStoreCtxGuard &store_ctx_guard,
|
||||
const UIntFixedArray *duplicated_column_ids,
|
||||
common::ObTabletID tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObNewRow *insert_row = NULL;
|
||||
int64_t affected_rows = 0;
|
||||
ObDMLBaseParam dml_param;
|
||||
if (OB_FAIL(ObDMLService::init_dml_param(*ins_ctdef,
|
||||
*ins_rtdef,
|
||||
*snapshot_,
|
||||
write_branch_id_,
|
||||
op_alloc_,
|
||||
store_ctx_guard,
|
||||
dml_param))) {
|
||||
LOG_WARN("init index dml param failed", K(ret), KPC(ins_ctdef), KPC(ins_rtdef));
|
||||
}
|
||||
while (OB_SUCC(ret) && OB_SUCC(dml_iter.get_next_row(insert_row))) {
|
||||
ObNewRowIterator *duplicated_rows = NULL;
|
||||
if (OB_ISNULL(insert_row)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("insert_row is null", K(ret));
|
||||
} else if (OB_FAIL(as->insert_row(ls_id_,
|
||||
tablet_id,
|
||||
*trans_desc_,
|
||||
dml_param,
|
||||
ins_ctdef->column_ids_,
|
||||
*duplicated_column_ids,
|
||||
*insert_row,
|
||||
INSERT_RETURN_ALL_DUP,
|
||||
affected_rows,
|
||||
duplicated_rows))) {
|
||||
if (OB_ERR_PRIMARY_KEY_DUPLICATE == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
bool is_local_index_table = ins_ctdef->table_param_.get_data_table().is_index_local_storage();
|
||||
bool is_unique_index = ins_ctdef->table_param_.get_data_table().is_unique_index();
|
||||
if (is_local_index_table && !is_unique_index) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected duplicate key error", K(ret), K(ins_ctdef->table_param_.get_data_table()));
|
||||
} else if (OB_ISNULL(duplicated_rows)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("duplicated_row is null", K(ret));
|
||||
} else if (OB_FAIL(result_iter->get_duplicated_iter_array().push_back(duplicated_rows))) {
|
||||
LOG_WARN("fail to push duplicated_row iter", K(ret));
|
||||
} else {
|
||||
// TODO aozeliu.azl fix lob
|
||||
// LOG_DEBUG("insert one row and conflicted", KPC(insert_row));
|
||||
ins_rtdef_->is_duplicated_ = true;
|
||||
is_duplicated_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(duplicated_rows)) {
|
||||
ObQueryIteratorFactory::free_insert_dup_iter(duplicated_rows);
|
||||
duplicated_rows = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ret = OB_ITER_END == ret ? OB_SUCCESS : ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDASInsertOp::insert_row_with_fetch()
|
||||
{
|
||||
@ -169,9 +235,6 @@ int ObDASInsertOp::insert_row_with_fetch()
|
||||
write_branch_id_,
|
||||
store_ctx_guard))) {
|
||||
LOG_WARN("fail to get_write_store_ctx_guard", K(ret), K(ls_id_));
|
||||
} else if (OB_FAIL(ObDMLService::init_dml_param(*ins_ctdef_, *ins_rtdef_,
|
||||
*snapshot_, write_branch_id_, op_alloc_, store_ctx_guard, dml_param))) {
|
||||
LOG_WARN("init dml param failed", K(ret), KPC_(ins_ctdef), KPC_(ins_rtdef));
|
||||
} else if (OB_ISNULL(buf = op_alloc_.alloc(sizeof(ObDASConflictIterator)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to allocate ObDASConflictIterator", K(ret));
|
||||
@ -181,119 +244,77 @@ int ObDASInsertOp::insert_row_with_fetch()
|
||||
result_ = result_iter;
|
||||
}
|
||||
|
||||
while (OB_SUCC(ret) && OB_SUCC(dml_iter.get_next_row(insert_row))) {
|
||||
ObNewRowIterator *duplicated_rows = NULL;
|
||||
if (OB_ISNULL(insert_row)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("insert_row is null", K(ret));
|
||||
} else if (OB_FAIL(as->insert_row(ls_id_,
|
||||
tablet_id_,
|
||||
*trans_desc_,
|
||||
dml_param,
|
||||
ins_ctdef_->column_ids_,
|
||||
ins_ctdef_->table_rowkey_cids_,
|
||||
*insert_row,
|
||||
INSERT_RETURN_ALL_DUP,
|
||||
affected_rows,
|
||||
duplicated_rows))) {
|
||||
if (OB_ERR_PRIMARY_KEY_DUPLICATE == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(duplicated_rows)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("duplicated_row is null", K(ret));
|
||||
} else if (OB_FAIL(result_iter->get_duplicated_iter_array().push_back(duplicated_rows))) {
|
||||
LOG_WARN("fail to push duplicated_row iter", K(ret));
|
||||
} else {
|
||||
// TODO aozeliu.azl fix lob
|
||||
// LOG_DEBUG("insert one row and conflicted", KPC(insert_row));
|
||||
ins_rtdef_->is_duplicated_ = true;
|
||||
is_duplicated_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(duplicated_rows)) {
|
||||
ObQueryIteratorFactory::free_insert_dup_iter(duplicated_rows);
|
||||
duplicated_rows = NULL;
|
||||
}
|
||||
// 1. insert primary table
|
||||
if (OB_FAIL(ret)) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(insert_index_with_fetch(as,
|
||||
dml_iter,
|
||||
result_iter,
|
||||
ins_ctdef_,
|
||||
ins_rtdef_,
|
||||
store_ctx_guard,
|
||||
&ins_ctdef_->table_rowkey_cids_,
|
||||
tablet_id_))) {
|
||||
LOG_WARN("fail to insert primary table", K(ret));
|
||||
}
|
||||
ret = OB_ITER_END == ret ? OB_SUCCESS : ret;
|
||||
|
||||
// 2. insert unique index
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < related_ctdefs_.count(); ++i) {
|
||||
const ObDASInsCtDef *index_ins_ctdef = static_cast<const ObDASInsCtDef*>(related_ctdefs_.at(i));
|
||||
ObDASInsRtDef *index_ins_rtdef = static_cast<ObDASInsRtDef*>(related_rtdefs_.at(i));
|
||||
ObTabletID index_tablet_id = related_tablet_ids_.at(i);
|
||||
ObDASMLogDMLIterator mlog_iter(index_tablet_id, dml_param, &dml_iter, DAS_OP_TABLE_INSERT);
|
||||
ObNewRowIterator *new_iter = nullptr;
|
||||
if (index_ins_ctdef->table_param_.get_data_table().is_mlog_table()
|
||||
&& !index_ins_ctdef->is_access_mlog_as_master_table_) {
|
||||
new_iter = &mlog_iter;
|
||||
} else {
|
||||
new_iter = &dml_iter;
|
||||
}
|
||||
|
||||
if (OB_FAIL(dml_iter.rewind(index_ins_ctdef))) {
|
||||
const bool is_local_unique_index = index_ins_ctdef->table_param_.get_data_table().is_unique_index();
|
||||
if (!is_local_unique_index) {
|
||||
// insert it later
|
||||
} else if (OB_FAIL(dml_iter.rewind(index_ins_ctdef))) {
|
||||
LOG_WARN("rewind dml iter failed", K(ret));
|
||||
} else if (OB_FAIL(ObDMLService::init_dml_param(*index_ins_ctdef,
|
||||
*index_ins_rtdef,
|
||||
*snapshot_,
|
||||
write_branch_id_,
|
||||
op_alloc_,
|
||||
store_ctx_guard,
|
||||
dml_param))) {
|
||||
LOG_WARN("init index dml param failed", K(ret), KPC(index_ins_ctdef), KPC(index_ins_rtdef));
|
||||
} else if (OB_FAIL(insert_index_with_fetch(as,
|
||||
dml_iter,
|
||||
result_iter,
|
||||
index_ins_ctdef,
|
||||
index_ins_rtdef,
|
||||
store_ctx_guard,
|
||||
&ins_ctdef_->table_rowkey_cids_,
|
||||
index_tablet_id))) {
|
||||
LOG_WARN("fail to insert local unique index", K(ret), K(index_ins_ctdef->table_param_.get_data_table()));
|
||||
}
|
||||
}
|
||||
|
||||
const UIntFixedArray *duplicated_column_ids = nullptr;
|
||||
// 3. insert non_unique index
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < related_ctdefs_.count(); ++i) {
|
||||
const ObDASInsCtDef *index_ins_ctdef = static_cast<const ObDASInsCtDef*>(related_ctdefs_.at(i));
|
||||
ObDASInsRtDef *index_ins_rtdef = static_cast<ObDASInsRtDef*>(related_rtdefs_.at(i));
|
||||
ObTabletID index_tablet_id = related_tablet_ids_.at(i);
|
||||
const bool is_local_unique_index = index_ins_ctdef->table_param_.get_data_table().is_unique_index();
|
||||
if (is_local_unique_index) {
|
||||
duplicated_column_ids = &(ins_ctdef_->table_rowkey_cids_);
|
||||
// insert it before
|
||||
} else if (is_duplicated_) {
|
||||
LOG_TRACE("is duplicated before, not need write non_unique index");
|
||||
} else if (OB_FAIL(dml_iter.rewind(index_ins_ctdef))) {
|
||||
LOG_WARN("rewind dml iter failed", K(ret));
|
||||
} else {
|
||||
// For non-unique local index, We check for duplications on all columns because the partition key is not stored in storage level
|
||||
duplicated_column_ids = &(index_ins_ctdef->column_ids_);
|
||||
}
|
||||
|
||||
while (OB_SUCC(ret) && OB_SUCC(new_iter->get_next_row(insert_row))) {
|
||||
ObNewRowIterator *duplicated_rows = NULL;
|
||||
if (OB_ISNULL(insert_row)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("insert_row is null", K(ret));
|
||||
} else if (OB_FAIL(as->insert_row(ls_id_,
|
||||
index_tablet_id,
|
||||
*trans_desc_,
|
||||
dml_param,
|
||||
index_ins_ctdef->column_ids_,
|
||||
*duplicated_column_ids,
|
||||
*insert_row,
|
||||
INSERT_RETURN_ALL_DUP,
|
||||
affected_rows,
|
||||
duplicated_rows))) {
|
||||
if (OB_ERR_PRIMARY_KEY_DUPLICATE == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(duplicated_rows)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("duplicated_row is null", K(ret));
|
||||
} else if (is_local_unique_index) {
|
||||
// push the duplicated_row of local unique index, ignore the duplicated_row of local non-unique index
|
||||
if (OB_FAIL(result_iter->get_duplicated_iter_array().push_back(duplicated_rows))) {
|
||||
LOG_WARN("fail to push duplicated_row iter", K(ret));
|
||||
} else {
|
||||
// TODO aozeliu.azl fix lob
|
||||
// LOG_DEBUG("insert one row and conflicted", KPC(insert_row));
|
||||
ins_rtdef_->is_duplicated_ = true;
|
||||
is_duplicated_ = true;
|
||||
}
|
||||
} else {
|
||||
// 需要释放iter的内存, 否则会内存泄漏
|
||||
ObQueryIteratorFactory::free_insert_dup_iter(duplicated_rows);
|
||||
duplicated_rows = NULL;
|
||||
}
|
||||
}
|
||||
ObDASMLogDMLIterator mlog_iter(index_tablet_id, dml_param, &dml_iter, DAS_OP_TABLE_INSERT);
|
||||
ObNewRowIterator *new_iter = nullptr;
|
||||
if (index_ins_ctdef->table_param_.get_data_table().is_mlog_table()
|
||||
&& !index_ins_ctdef->is_access_mlog_as_master_table_) {
|
||||
new_iter = &mlog_iter;
|
||||
} else {
|
||||
new_iter = &dml_iter;
|
||||
}
|
||||
if (OB_FAIL(ret) && OB_NOT_NULL(duplicated_rows)) {
|
||||
ObQueryIteratorFactory::free_insert_dup_iter(duplicated_rows);
|
||||
duplicated_rows = NULL;
|
||||
if (OB_FAIL(insert_index_with_fetch(as,
|
||||
*new_iter,
|
||||
result_iter,
|
||||
index_ins_ctdef,
|
||||
index_ins_rtdef,
|
||||
store_ctx_guard,
|
||||
&(index_ins_ctdef->column_ids_),
|
||||
index_tablet_id))) {
|
||||
// For non-unique local index,
|
||||
// We check for duplications on all columns because the partition key is not stored in storage level
|
||||
LOG_WARN("fail to insert non_unique index", K(ret), K(index_ins_ctdef->table_param_.get_data_table()));
|
||||
}
|
||||
}
|
||||
ret = OB_ITER_END == ret ? OB_SUCCESS : ret;
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
|
@ -20,8 +20,36 @@ namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ObDASInsertResult;
|
||||
|
||||
typedef common::ObList<ObNewRowIterator *, common::ObIAllocator> ObDuplicatedIterList;
|
||||
class ObDASConflictIterator : public common::ObNewRowIterator
|
||||
{
|
||||
public:
|
||||
ObDASConflictIterator(const ObjMetaFixedArray &output_types,
|
||||
common::ObIAllocator &alloc)
|
||||
: output_types_(output_types),
|
||||
duplicated_iter_list_(alloc),
|
||||
curr_iter_(duplicated_iter_list_.begin())
|
||||
{
|
||||
}
|
||||
|
||||
~ObDASConflictIterator() {};
|
||||
|
||||
virtual int get_next_row(common::ObNewRow *&row) override;
|
||||
virtual int get_next_row() override;
|
||||
virtual void reset() override;
|
||||
|
||||
void init_curr_iter()
|
||||
{ curr_iter_ = duplicated_iter_list_.begin(); }
|
||||
ObDuplicatedIterList &get_duplicated_iter_array()
|
||||
{ return duplicated_iter_list_; }
|
||||
private:
|
||||
const ObjMetaFixedArray &output_types_;
|
||||
ObDuplicatedIterList duplicated_iter_list_;
|
||||
ObDuplicatedIterList::iterator curr_iter_;
|
||||
};
|
||||
|
||||
class ObDASInsertOp : public ObIDASTaskOp
|
||||
{
|
||||
OB_UNIS_VERSION(1);
|
||||
@ -63,6 +91,15 @@ private:
|
||||
int insert_row_with_fetch();
|
||||
int store_conflict_row(ObDASInsertResult &ins_result);
|
||||
|
||||
int insert_index_with_fetch(ObAccessService *as,
|
||||
common::ObNewRowIterator &dml_iter,
|
||||
ObDASConflictIterator *result_iter,
|
||||
const ObDASInsCtDef *ins_ctdef,
|
||||
ObDASInsRtDef *ins_rtdef,
|
||||
storage::ObStoreCtxGuard &store_ctx_guard,
|
||||
const UIntFixedArray *duplicated_column_ids,
|
||||
common::ObTabletID tablet_id);
|
||||
|
||||
private:
|
||||
const ObDASInsCtDef *ins_ctdef_;
|
||||
ObDASInsRtDef *ins_rtdef_;
|
||||
@ -72,34 +109,6 @@ private:
|
||||
bool is_duplicated_; // local execute result, no need to serialize
|
||||
};
|
||||
|
||||
typedef common::ObList<ObNewRowIterator *, common::ObIAllocator> ObDuplicatedIterList;
|
||||
class ObDASConflictIterator : public common::ObNewRowIterator
|
||||
{
|
||||
public:
|
||||
ObDASConflictIterator(const ObjMetaFixedArray &output_types,
|
||||
common::ObIAllocator &alloc)
|
||||
: output_types_(output_types),
|
||||
duplicated_iter_list_(alloc),
|
||||
curr_iter_(duplicated_iter_list_.begin())
|
||||
{
|
||||
}
|
||||
|
||||
~ObDASConflictIterator() {};
|
||||
|
||||
virtual int get_next_row(common::ObNewRow *&row) override;
|
||||
virtual int get_next_row() override;
|
||||
virtual void reset() override;
|
||||
|
||||
void init_curr_iter()
|
||||
{ curr_iter_ = duplicated_iter_list_.begin(); }
|
||||
ObDuplicatedIterList &get_duplicated_iter_array()
|
||||
{ return duplicated_iter_list_; }
|
||||
private:
|
||||
const ObjMetaFixedArray &output_types_;
|
||||
ObDuplicatedIterList duplicated_iter_list_;
|
||||
ObDuplicatedIterList::iterator curr_iter_;
|
||||
};
|
||||
|
||||
class ObDASInsertResult : public ObIDASTaskResult, public common::ObNewRowIterator
|
||||
{
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
@ -347,10 +347,12 @@ int ObTableDeleteOp::check_delete_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_delete_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table delete affected row is not match with index table",
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK, "Fatal Error!!! data table delete affected row is not match with index table",
|
||||
K(ret), K(primary_write_rows), K(index_write_rows),
|
||||
KPC(primary_del_ctdef), K(primary_del_rtdef),
|
||||
KPC(index_del_ctdef), K(index_del_rtdef));
|
||||
LOG_DBA_ERROR_V2(OB_SQL_DELETE_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table delete affected row is not match with index table"
|
||||
", data table delete affected_rows is: ", primary_write_rows, ", index table delete affected_rows is: ", index_write_rows);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
@ -358,9 +360,12 @@ int ObTableDeleteOp::check_delete_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_delete_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table delete affected row is not match with found rows",
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK, "Fatal Error!!! data table delete affected row is not match with found rows",
|
||||
K(ret), K(primary_write_rows), K(primary_del_rtdef.cur_row_num_),
|
||||
KPC(primary_del_ctdef), K(primary_del_rtdef));
|
||||
LOG_DBA_ERROR_V2(OB_SQL_DELETE_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table delete affected row is not match with index table"
|
||||
", data table delete affected row is: ", primary_write_rows,
|
||||
", data table found_rows is: ", primary_del_rtdef.cur_row_num_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -362,13 +362,18 @@ OB_INLINE int ObTableInsertOp::check_insert_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_insert_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table insert affected row is not match with index table", K(ret),
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! data table insert affected row is not match with index table",
|
||||
K(ret),
|
||||
"primary_affected_rows", pri_rtdef.das_rtdef_.affected_rows_,
|
||||
"index_affected_rows", idx_rtdef.das_rtdef_.affected_rows_,
|
||||
"primary_ins_ctdef", pri_ctdef,
|
||||
"index_ins_ctdef", idx_ctdef,
|
||||
"primary_ins_rtdef", pri_rtdef,
|
||||
"index_ins_rtdef", idx_rtdef);
|
||||
LOG_DBA_ERROR_V2(OB_SQL_INSERT_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table delete affected row is not match with index table "
|
||||
", data table delete affected_rows is: ", pri_rtdef.das_rtdef_.affected_rows_,
|
||||
", index table delete affected_rows is: ", idx_rtdef.das_rtdef_.affected_rows_);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && !pri_ctdef.das_ctdef_.is_ignore_) {
|
||||
@ -376,10 +381,14 @@ OB_INLINE int ObTableInsertOp::check_insert_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_insert_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table insert affected row is not match with found rows", K(ret),
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK, "Fatal Error!!! data table insert affected row is not match with found rows", K(ret),
|
||||
"primary_affected_rows", pri_rtdef.das_rtdef_.affected_rows_,
|
||||
"primary_found_rows", pri_rtdef.cur_row_num_,
|
||||
"primary_ins_ctdef", pri_ctdef,
|
||||
"primary_ins_rtdef", pri_rtdef);
|
||||
LOG_DBA_ERROR_V2(OB_SQL_INSERT_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table insert affected row is not match with found rows"
|
||||
", primary_affected_rows is: ", pri_rtdef.das_rtdef_.affected_rows_,
|
||||
", primary_get_rows is: ", pri_rtdef.cur_row_num_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,10 +432,13 @@ int ObTableUpdateOp::check_update_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_update_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table update affected row is not match with index table",
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK, "Fatal Error!!! data table update affected row is not match with index table",
|
||||
K(ret), K(primary_write_rows), K(index_write_rows),
|
||||
KPC(primary_upd_ctdef), K(primary_upd_rtdef),
|
||||
KPC(index_upd_ctdef), K(index_upd_rtdef));
|
||||
LOG_DBA_ERROR_V2(OB_SQL_UPDATE_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table update affected row is not match with index table"
|
||||
", primary_write_rows is: ", primary_write_rows,
|
||||
", index_write_rows: ", index_write_rows);
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && !primary_upd_ctdef->dupd_ctdef_.is_ignore_) {
|
||||
@ -443,9 +446,12 @@ int ObTableUpdateOp::check_update_affected_row()
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_update_affected_row");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! data table update affected row is not match with found rows",
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK, "Fatal Error!!! data table update affected row is not match with found rows",
|
||||
K(ret), K(primary_write_rows), K(primary_upd_rtdef.found_rows_),
|
||||
KPC(primary_upd_ctdef), K(primary_upd_rtdef));
|
||||
LOG_DBA_ERROR_V2(OB_SQL_UPDATE_AFFECTED_ROW_FAIL, ret, "Attention!!!", "data table update affected row is not match with found rows",
|
||||
", primary_write_rows is: ", primary_write_rows,
|
||||
", primary_found_rows is: ", primary_upd_rtdef.found_rows_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -481,6 +481,8 @@ int ObLogTableScan::generate_access_exprs()
|
||||
&& static_cast<ObPseudoColumnRawExpr*>(expr)->get_table_id() == table_id_) {
|
||||
if (OB_FAIL(add_var_to_array_no_dup(ext_file_column_exprs_, expr))) {
|
||||
LOG_WARN("fail to push back expr", K(ret));
|
||||
} else if (OB_FAIL(add_var_to_array_no_dup(output_exprs_, expr))) {
|
||||
LOG_WARN("fail to push back expr", K(ret));
|
||||
} else if (OB_FAIL(access_exprs_.push_back(expr))) { //add access expr temp
|
||||
LOG_WARN("fail to push back expr", K(ret));
|
||||
}
|
||||
|
@ -2323,6 +2323,7 @@ OB_INLINE int ObPlanCache::construct_plan_cache_key(ObSQLSessionInfo &session,
|
||||
// if `use_rich_format()` is used as part of key, added plan's key will be `false + other_info`.
|
||||
pc_key.use_rich_vector_format_ = session.initial_use_rich_format();
|
||||
pc_key.config_use_rich_format_ = session.config_use_rich_format();
|
||||
pc_key.sys_var_config_hash_val_ = session.get_sys_var_config_hash_val();
|
||||
pc_key.is_weak_read_ = is_weak;
|
||||
return ret;
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
db_id_(common::OB_INVALID_ID),
|
||||
sessid_(0),
|
||||
mode_(PC_TEXT_MODE),
|
||||
flag_(0) {}
|
||||
flag_(0),
|
||||
sys_var_config_hash_val_(0) {}
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
@ -69,6 +70,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
config_str_.reset();
|
||||
flag_ = 0;
|
||||
namespace_ = NS_INVALID;
|
||||
sys_var_config_hash_val_ = 0;
|
||||
}
|
||||
|
||||
virtual inline int deep_copy(common::ObIAllocator &allocator,
|
||||
@ -93,6 +95,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
mode_ = pc_key.mode_;
|
||||
namespace_ = pc_key.namespace_;
|
||||
flag_ = pc_key.flag_;
|
||||
sys_var_config_hash_val_ = pc_key.sys_var_config_hash_val_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -111,14 +114,14 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
}
|
||||
virtual inline uint64_t hash() const
|
||||
{
|
||||
uint64_t hash_ret = name_.hash();
|
||||
int ret = common::OB_SUCCESS;
|
||||
uint64_t hash_ret = sys_var_config_hash_val_;
|
||||
hash_ret = name_.hash(hash_ret);
|
||||
hash_ret = common::murmurhash(&key_id_, sizeof(uint64_t), hash_ret);
|
||||
hash_ret = common::murmurhash(&db_id_, sizeof(uint64_t), hash_ret);
|
||||
hash_ret = common::murmurhash(&sessid_, sizeof(uint32_t), hash_ret);
|
||||
hash_ret = common::murmurhash(&mode_, sizeof(PlanCacheMode), hash_ret);
|
||||
hash_ret = common::murmurhash(&flag_, sizeof(flag_), hash_ret);
|
||||
hash_ret = sys_vars_str_.hash(hash_ret);
|
||||
hash_ret = config_str_.hash(hash_ret);
|
||||
hash_ret = common::murmurhash(&namespace_, sizeof(ObLibCacheNameSpace), hash_ret);
|
||||
|
||||
return hash_ret;
|
||||
@ -135,7 +138,8 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
sys_vars_str_ == pc_key.sys_vars_str_ &&
|
||||
config_str_ == pc_key.config_str_ &&
|
||||
flag_ == pc_key.flag_ &&
|
||||
namespace_ == pc_key.namespace_;
|
||||
namespace_ == pc_key.namespace_&&
|
||||
sys_var_config_hash_val_ == pc_key.sys_var_config_hash_val_;
|
||||
|
||||
return cmp_ret;
|
||||
}
|
||||
@ -170,6 +174,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
|
||||
uint16_t reserved_ : 13; // reserved
|
||||
};
|
||||
};
|
||||
uint64_t sys_var_config_hash_val_;
|
||||
};
|
||||
|
||||
//记录快速化参数后不需要扣参数的原始字符串及相关信息
|
||||
|
@ -3998,8 +3998,8 @@ int ObRawExprPrinter::print(ObPseudoColumnRawExpr *expr)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case T_PSEUDO_EXTERNAL_FILE_URL:
|
||||
case T_PSEUDO_PARTITION_LIST_COL:
|
||||
case T_PSEUDO_EXTERNAL_FILE_URL:
|
||||
case T_PSEUDO_EXTERNAL_FILE_COL: {
|
||||
if (!expr->get_table_name().empty()) {
|
||||
PRINT_IDENT(expr->get_table_name());
|
||||
|
@ -4835,7 +4835,7 @@ int ObResolverUtils::build_file_column_expr(ObRawExprFactory &expr_factory,
|
||||
ObCharsetType cs_type,
|
||||
const ObColumnSchemaV2 *generated_column)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int ret = OB_SUCCESS;
|
||||
ObPseudoColumnRawExpr *file_column_expr = nullptr;
|
||||
ObItemType type = T_INVALID;
|
||||
uint64_t extra = UINT64_MAX;
|
||||
@ -8355,6 +8355,11 @@ int ObResolverUtils::escape_char_for_oracle_mode(ObIAllocator &allocator,
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Submit a product behavior change request before modifying the whitelist.
|
||||
static const char * const sys_tenant_white_list[] = {
|
||||
"log/alert"
|
||||
};
|
||||
|
||||
int ObResolverUtils::check_secure_path(const common::ObString &secure_file_priv, const common::ObString &full_path)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -8364,8 +8369,6 @@ int ObResolverUtils::check_secure_path(const common::ObString &secure_file_priv,
|
||||
|
||||
if (secure_file_priv.empty() || 0 == secure_file_priv.case_compare(N_NULL)) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(full_path));
|
||||
} else if (OB_UNLIKELY(secure_file_priv.length() >= DEFAULT_BUF_LENGTH)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("secure file priv string length exceeds default buf length", K(ret),
|
||||
@ -8378,8 +8381,6 @@ int ObResolverUtils::check_secure_path(const common::ObString &secure_file_priv,
|
||||
stat(buf, &path_stat);
|
||||
if (0 == S_ISDIR(path_stat.st_mode)) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(full_path));
|
||||
} else {
|
||||
MEMSET(buf, 0, sizeof(buf));
|
||||
char *real_secure_file = nullptr;
|
||||
@ -8390,21 +8391,51 @@ int ObResolverUtils::check_secure_path(const common::ObString &secure_file_priv,
|
||||
const int64_t pos = secure_file_priv_tmp.length();
|
||||
if (full_path.length() < secure_file_priv_tmp.length()) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(secure_file_priv_tmp), K(full_path));
|
||||
} else if (!full_path.prefix_match(secure_file_priv_tmp)) {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(secure_file_priv_tmp), K(full_path));
|
||||
} else if (full_path.length() > secure_file_priv_tmp.length()
|
||||
&& secure_file_priv_tmp != "/" && full_path[pos] != '/') {
|
||||
ret = OB_ERR_NO_PRIVILEGE;
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(secure_file_priv_tmp), K(full_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_ERR_NO_PRIVILEGE == ret && OB_SYS_TENANT_ID == MTL_ID()) {
|
||||
char buf[DEFAULT_BUF_LENGTH] = { 0 };
|
||||
const int list_size = ARRAYSIZEOF(sys_tenant_white_list);
|
||||
for (int i = 0; OB_ERR_NO_PRIVILEGE == ret && i < list_size; i++) {
|
||||
const char * const secure_file_path = sys_tenant_white_list[i];
|
||||
struct stat path_stat;
|
||||
stat(secure_file_path, &path_stat);
|
||||
if (0 == S_ISDIR(path_stat.st_mode)) {
|
||||
// continue
|
||||
} else {
|
||||
MEMSET(buf, 0, sizeof(buf));
|
||||
char *real_secure_file = nullptr;
|
||||
if (NULL == (real_secure_file = ::realpath(secure_file_path, buf))) {
|
||||
// continue
|
||||
} else {
|
||||
ObString secure_file_path_tmp(real_secure_file);
|
||||
const int64_t pos = secure_file_path_tmp.length();
|
||||
if (full_path.length() < secure_file_path_tmp.length()) {
|
||||
// continue
|
||||
} else if (!full_path.prefix_match(secure_file_path_tmp)) {
|
||||
// continue
|
||||
} else if (full_path.length() > secure_file_path_tmp.length()
|
||||
&& secure_file_path_tmp != "/" && full_path[pos] != '/') {
|
||||
// continue
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
LOG_INFO("check sys tenant whitelist success.", K(ret), K(secure_file_path), K(full_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_ERR_NO_PRIVILEGE == ret) {
|
||||
FORWARD_USER_ERROR_MSG(ret, "%s", access_denied_notice_message);
|
||||
LOG_WARN("no priv", K(ret), K(secure_file_priv), K(full_path));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -162,7 +162,8 @@ ObBasicSessionInfo::ObBasicSessionInfo(const uint64_t tenant_id)
|
||||
use_rich_vector_format_(false),
|
||||
last_refresh_schema_version_(OB_INVALID_VERSION),
|
||||
force_rich_vector_format_(ForceRichFormatStatus::Disable),
|
||||
config_use_rich_format_(true)
|
||||
config_use_rich_format_(true),
|
||||
sys_var_config_hash_val_(0)
|
||||
{
|
||||
thread_data_.reset();
|
||||
MEMSET(sys_vars_, 0, sizeof(sys_vars_));
|
||||
@ -472,6 +473,7 @@ void ObBasicSessionInfo::reset(bool skip_sys_var)
|
||||
last_refresh_schema_version_ = OB_INVALID_VERSION;
|
||||
proxy_user_id_ = OB_INVALID_ID;
|
||||
config_use_rich_format_ = true;
|
||||
sys_var_config_hash_val_ = 0;
|
||||
}
|
||||
|
||||
int ObBasicSessionInfo::reset_timezone()
|
||||
@ -1522,6 +1524,14 @@ int ObBasicSessionInfo::get_influence_plan_sys_var(ObSysVarInPC &sys_vars) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObBasicSessionInfo::eval_sys_var_config_hash_val()
|
||||
{
|
||||
if (!sys_var_in_pc_str_.empty() && !config_in_pc_str_.empty()) {
|
||||
sys_var_config_hash_val_ = sys_var_in_pc_str_.hash();
|
||||
sys_var_config_hash_val_ = config_in_pc_str_.hash(sys_var_config_hash_val_);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
**内部session与用户session对应的影响plan的系统变量的顺序
|
||||
*
|
||||
@ -1599,6 +1609,7 @@ int ObBasicSessionInfo::gen_sys_var_in_pc_str()
|
||||
} else {
|
||||
(void)sys_var_in_pc_str_.assign(buf, int32_t(pos));
|
||||
}
|
||||
OX (eval_sys_var_config_hash_val());
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1801,6 +1812,7 @@ int ObBasicSessionInfo::gen_configs_in_pc_str()
|
||||
(void)config_in_pc_str_.assign(buf, int32_t(pos));
|
||||
inf_pc_configs_.update_version(cluster_config_version, cached_tenant_config_version_);
|
||||
}
|
||||
OX (eval_sys_var_config_hash_val());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -4610,6 +4622,7 @@ OB_DEF_SERIALIZE(ObBasicSessionInfo)
|
||||
thread_data_.proxy_host_name_,
|
||||
enable_role_ids_);
|
||||
}
|
||||
OB_UNIS_ENCODE(sys_var_config_hash_val_);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -4888,6 +4901,7 @@ OB_DEF_DESERIALIZE(ObBasicSessionInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
OB_UNIS_DECODE(sys_var_config_hash_val_);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -5169,6 +5183,7 @@ OB_DEF_SERIALIZE_SIZE(ObBasicSessionInfo)
|
||||
thread_data_.proxy_user_name_,
|
||||
thread_data_.proxy_host_name_,
|
||||
enable_role_ids_);
|
||||
OB_UNIS_ADD_LEN(sys_var_config_hash_val_);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -712,6 +712,8 @@ public:
|
||||
int get_influence_plan_sys_var(ObSysVarInPC &sys_vars) const;
|
||||
const common::ObString &get_sys_var_in_pc_str() const { return sys_var_in_pc_str_; }
|
||||
const common::ObString &get_config_in_pc_str() const { return config_in_pc_str_; }
|
||||
uint64_t get_sys_var_config_hash_val() const { return sys_var_config_hash_val_; }
|
||||
void eval_sys_var_config_hash_val();
|
||||
int gen_sys_var_in_pc_str();
|
||||
int gen_configs_in_pc_str();
|
||||
uint32_t get_sessid() const { return sessid_; }
|
||||
@ -2417,6 +2419,7 @@ private:
|
||||
bool config_use_rich_format_;
|
||||
|
||||
common::ObSEArray<uint64_t, 4> enable_role_ids_;
|
||||
uint64_t sys_var_config_hash_val_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1574,9 +1574,13 @@ int ObMultipleMerge::handle_4377(const char* func)
|
||||
} else {
|
||||
ObString func_name = ObString::make_string(func);
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg",
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error! index lookup: row not found in data-table",
|
||||
K(ret), KPC(access_ctx_->store_ctx_));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"msg", "Fatal Error!!! Catch a defensive error!",
|
||||
"index lookup: row not found in data-table");
|
||||
concurrency_control::ObDataValidationService::set_delay_resource_recycle(access_ctx_->ls_id_);
|
||||
dump_table_statistic_for_4377();
|
||||
dump_tx_statistic_for_4377(access_ctx_->store_ctx_);
|
||||
|
@ -196,6 +196,9 @@ int ObBlockManager::start(const int64_t reserved_size)
|
||||
opts.opt_cnt_ = 1;
|
||||
opts.opts_ = &(opt);
|
||||
opt.set("reserved size", reserved_size);
|
||||
LOG_DBA_INFO_V2(OB_SERVER_BLOCK_MANAGER_START_BEGIN,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"block manager start begin.");
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -244,6 +247,17 @@ int ObBlockManager::start(const int64_t reserved_size)
|
||||
LOG_INFO("start block manager", K(need_format));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
LOG_DBA_ERROR_V2(OB_SERVER_BLOCK_MANAGER_START_FAIL, ret,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"block manager start fail. ",
|
||||
"you may find solutions in previous error logs or seek help from official technicians.");
|
||||
} else {
|
||||
LOG_DBA_INFO_V2(OB_SERVER_BLOCK_MANAGER_START_SUCCESS,
|
||||
DBA_STEP_INC_INFO(server_start),
|
||||
"block manager start success.");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -637,26 +637,19 @@ int ObLSTabletService::table_scan(ObTabletHandle &tablet_handle, ObTableScanIter
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
NG_TRACE(S_table_scan_begin);
|
||||
AllowToReadMgr::AllowToReadInfo read_info;
|
||||
bool allow_to_read = false;
|
||||
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(read_info))) {
|
||||
} else if (!read_info.allow_to_read()) {
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(allow_to_read))) {
|
||||
} else if (!allow_to_read) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
} else if (OB_FAIL(prepare_scan_table_param(param, *(MTL(ObTenantSchemaService*)->get_schema_service())))) {
|
||||
LOG_WARN("failed to prepare scan table param", K(ret), K(param));
|
||||
} else if (OB_FAIL(inner_table_scan(tablet_handle, iter, param))) {
|
||||
LOG_WARN("failed to do table scan", K(ret), KP(&iter), K(param));
|
||||
} else {
|
||||
bool is_same = false;
|
||||
allow_to_read_mgr_.check_read_info_same(read_info, is_same);
|
||||
if (!is_same) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_), KP(&iter));
|
||||
}
|
||||
}
|
||||
NG_TRACE(S_table_scan_end);
|
||||
|
||||
@ -667,7 +660,7 @@ int ObLSTabletService::table_rescan(ObTabletHandle &tablet_handle, ObTableScanPa
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
NG_TRACE(S_table_rescan_begin);
|
||||
AllowToReadMgr::AllowToReadInfo read_info;
|
||||
bool allow_to_read = false;
|
||||
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -675,8 +668,8 @@ int ObLSTabletService::table_rescan(ObTabletHandle &tablet_handle, ObTableScanPa
|
||||
} else if (OB_ISNULL(result)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret));
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(read_info))) {
|
||||
} else if (!read_info.allow_to_read()) {
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(allow_to_read))) {
|
||||
} else if (!allow_to_read) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
} else if (OB_FAIL(prepare_scan_table_param(param, *(MTL(ObTenantSchemaService*)->get_schema_service())))) {
|
||||
@ -687,15 +680,6 @@ int ObLSTabletService::table_rescan(ObTabletHandle &tablet_handle, ObTableScanPa
|
||||
LOG_WARN("failed to do table scan", K(ret), K(result), K(param));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
bool is_same = false;
|
||||
allow_to_read_mgr_.check_read_info_same(read_info, is_same);
|
||||
if (!is_same) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
}
|
||||
}
|
||||
NG_TRACE(S_table_rescan_end);
|
||||
return ret;
|
||||
}
|
||||
@ -2387,29 +2371,15 @@ int ObLSTabletService::create_memtable(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSTabletService::check_allow_to_read(AllowToReadMgr::AllowToReadInfo &read_info)
|
||||
int ObLSTabletService::check_allow_to_read()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
allow_to_read_mgr_.load_allow_to_read_info(read_info);
|
||||
bool allow_to_read = false;
|
||||
allow_to_read_mgr_.load_allow_to_read_info(allow_to_read);
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||
} else if (!read_info.allow_to_read()) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSTabletService::check_read_info_same(const AllowToReadMgr::AllowToReadInfo &read_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_same = false;
|
||||
allow_to_read_mgr_.check_read_info_same(read_info, is_same);
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||
} else if (!is_same) {
|
||||
} else if (!allow_to_read) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
}
|
||||
@ -2430,7 +2400,7 @@ int ObLSTabletService::get_read_tables(
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle &handle = iter.tablet_handle_;
|
||||
iter.reset();
|
||||
AllowToReadMgr::AllowToReadInfo read_info;
|
||||
bool allow_to_read = false;
|
||||
ObTabletMapKey key;
|
||||
key.tablet_id_ = tablet_id;
|
||||
|
||||
@ -2440,8 +2410,8 @@ int ObLSTabletService::get_read_tables(
|
||||
} else if (OB_UNLIKELY(!tablet_id.is_valid() || snapshot_version < 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid arguments", K(ret), K(tablet_id), K(snapshot_version));
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(read_info))) {
|
||||
} else if (!read_info.allow_to_read()) {
|
||||
} else if (FALSE_IT(allow_to_read_mgr_.load_allow_to_read_info(allow_to_read))) {
|
||||
} else if (!allow_to_read) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
} else if (FALSE_IT(key.ls_id_ = ls_->get_ls_id())) {
|
||||
@ -2458,13 +2428,6 @@ int ObLSTabletService::get_read_tables(
|
||||
} else if (OB_FAIL(handle.get_obj()->get_read_tables(snapshot_version, iter, allow_no_ready_read))) {
|
||||
LOG_WARN("fail to get read tables", K(ret), K(handle), K(tablet_id), K(snapshot_version),
|
||||
K(iter), K(allow_no_ready_read));
|
||||
} else {
|
||||
bool is_same = false;
|
||||
allow_to_read_mgr_.check_read_info_same(read_info, is_same);
|
||||
if (!is_same) {
|
||||
ret = OB_REPLICA_NOT_READABLE;
|
||||
LOG_WARN("ls is not allow to read", K(ret), KPC(ls_));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -2883,7 +2846,8 @@ int ObLSTabletService::insert_row(
|
||||
} else {
|
||||
tbl_row.flag_.set_flag(ObDmlFlag::DF_INSERT);
|
||||
tbl_row.row_val_ = row;
|
||||
if (OB_FAIL(insert_row_to_tablet(true /*check_exist*/,
|
||||
const bool check_exist = !data_table.is_storage_index_table() || data_table.is_unique_index();
|
||||
if (OB_FAIL(insert_row_to_tablet(check_exist,
|
||||
tablet_handle,
|
||||
run_ctx,
|
||||
tbl_row))) {
|
||||
@ -3893,14 +3857,19 @@ int ObLSTabletService::check_old_row_legitimacy(
|
||||
if (OB_ERR_DEFENSIVE_CHECK == ret) {
|
||||
ObString func_name = ObString::make_string("check_old_row_legitimacy");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
"column_id", column_ids,
|
||||
KPC(storage_old_row),
|
||||
"sql_old_row", old_row,
|
||||
"dml_param", run_ctx.dml_param_,
|
||||
"dml_flag", run_ctx.dml_flag_,
|
||||
"store_ctx", run_ctx.store_ctx_,
|
||||
"relative_table", run_ctx.relative_table_);
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!",
|
||||
K(ret),
|
||||
"column_id", column_ids,
|
||||
KPC(storage_old_row),
|
||||
"sql_old_row", old_row,
|
||||
"dml_param", run_ctx.dml_param_,
|
||||
"dml_flag", run_ctx.dml_flag_,
|
||||
"store_ctx", run_ctx.store_ctx_,
|
||||
"relative_table", run_ctx.relative_table_);
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
concurrency_control::ObDataValidationService::set_delay_resource_recycle(run_ctx.store_ctx_.ls_id_);
|
||||
LOG_ERROR("Dump data table info", K(ret), K(data_table));
|
||||
run_ctx.store_ctx_.force_print_trace_log();
|
||||
@ -4890,61 +4859,53 @@ int ObLSTabletService::process_data_table_row(
|
||||
K(is_update_total_quantity_log), K(rowkey_change));
|
||||
} else {
|
||||
const ObColDescIArray &col_descs = *run_ctx.col_descs_;
|
||||
bool exists = false;
|
||||
if (rowkey_change && OB_FAIL(data_tablet.get_obj()->rowkey_exists(
|
||||
relative_table,
|
||||
ctx,
|
||||
new_tbl_row.row_val_,
|
||||
exists))) {
|
||||
LOG_WARN("failed to check rowkey exists", K(ret), K(new_tbl_row));
|
||||
} else if (exists) {
|
||||
char buffer[OB_TMP_BUF_SIZE_256];
|
||||
ObStoreRowkey rowkey;
|
||||
ret = OB_ERR_PRIMARY_KEY_DUPLICATE;
|
||||
if (OB_SUCCESS != rowkey.assign(new_tbl_row.row_val_.cells_, relative_table.get_rowkey_column_num())) {
|
||||
LOG_WARN("Failed to assign rowkey", K(new_tbl_row));
|
||||
} else if (OB_SUCCESS != extract_rowkey(relative_table, rowkey, buffer, OB_TMP_BUF_SIZE_256, tz_info)) {
|
||||
LOG_WARN("extract rowkey failed", K(rowkey));
|
||||
} else {
|
||||
ObString index_name = "PRIMARY";
|
||||
if (relative_table.is_index_table()) {
|
||||
relative_table.get_index_name(index_name);
|
||||
ObStoreRow new_row;
|
||||
new_row.flag_.set_flag(rowkey_change ? ObDmlFlag::DF_INSERT : ObDmlFlag::DF_UPDATE);
|
||||
new_row.row_val_ = new_tbl_row.row_val_;
|
||||
|
||||
if (!rowkey_change) {
|
||||
ObStoreRow old_row;
|
||||
old_row.flag_.set_flag(ObDmlFlag::DF_UPDATE);
|
||||
old_row.row_val_ = old_tbl_row.row_val_;
|
||||
if (!is_update_total_quantity_log) {
|
||||
// For minimal mode, set pk columns of old_row to nop value, because
|
||||
// they are already stored in new_row.
|
||||
const int64_t rowkey_col_cnt = relative_table.get_rowkey_column_num();
|
||||
for (int64_t i = 0; i < rowkey_col_cnt; ++i) {
|
||||
(old_row.row_val_.cells_[i]).set_nop_value();
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(data_tablet.get_obj()->update_row(relative_table,
|
||||
ctx, col_descs, update_idx, old_row, new_row, run_ctx.dml_param_.encrypt_meta_))) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("failed to update to row", K(ret), K(old_row), K(new_row));
|
||||
}
|
||||
LOG_USER_ERROR(OB_ERR_PRIMARY_KEY_DUPLICATE, buffer, index_name.length(), index_name.ptr());
|
||||
}
|
||||
LOG_WARN("rowkey already exists", K(ret), K(new_tbl_row));
|
||||
} else {
|
||||
ObStoreRow new_row;
|
||||
new_row.flag_.set_flag(rowkey_change ? ObDmlFlag::DF_INSERT : ObDmlFlag::DF_UPDATE);
|
||||
new_row.row_val_ = new_tbl_row.row_val_;
|
||||
if (!rowkey_change) {
|
||||
ObStoreRow old_row;
|
||||
old_row.flag_.set_flag(ObDmlFlag::DF_UPDATE);
|
||||
old_row.row_val_ = old_tbl_row.row_val_;
|
||||
if (!is_update_total_quantity_log) {
|
||||
// For minimal mode, set pk columns of old_row to nop value, because
|
||||
// they are already stored in new_row.
|
||||
const int64_t rowkey_col_cnt = relative_table.get_rowkey_column_num();
|
||||
for (int64_t i = 0; i < rowkey_col_cnt; ++i) {
|
||||
(old_row.row_val_.cells_[i]).set_nop_value();
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(data_tablet.get_obj()->update_row(relative_table,
|
||||
ctx, col_descs, update_idx, old_row, new_row, run_ctx.dml_param_.encrypt_meta_))) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("failed to update to row", K(ret), K(old_row), K(new_row));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(data_tablet.get_obj()->insert_row_without_rowkey_check(relative_table,
|
||||
ctx,
|
||||
false /*check_exist*/,
|
||||
col_descs,
|
||||
new_row,
|
||||
run_ctx.dml_param_.encrypt_meta_))) {
|
||||
if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("failed to update to row", K(ret), K(new_row));
|
||||
const bool check_exist = !relative_table.is_storage_index_table() || relative_table.is_unique_index();
|
||||
if (OB_FAIL(data_tablet.get_obj()->insert_row_without_rowkey_check(relative_table,
|
||||
ctx,
|
||||
check_exist,
|
||||
col_descs,
|
||||
new_row,
|
||||
run_ctx.dml_param_.encrypt_meta_))) {
|
||||
if (OB_ERR_PRIMARY_KEY_DUPLICATE == ret) {
|
||||
char buffer[OB_TMP_BUF_SIZE_256];
|
||||
ObStoreRowkey rowkey;
|
||||
if (OB_SUCCESS != rowkey.assign(new_tbl_row.row_val_.cells_, relative_table.get_rowkey_column_num())) {
|
||||
LOG_WARN("Failed to assign rowkey", K(new_tbl_row));
|
||||
} else if (OB_SUCCESS != extract_rowkey(relative_table, rowkey, buffer, OB_TMP_BUF_SIZE_256, tz_info)) {
|
||||
LOG_WARN("extract rowkey failed", K(rowkey));
|
||||
} else {
|
||||
ObString index_name = "PRIMARY";
|
||||
if (relative_table.is_index_table()) {
|
||||
relative_table.get_index_name(index_name);
|
||||
}
|
||||
LOG_USER_ERROR(OB_ERR_PRIMARY_KEY_DUPLICATE, buffer, index_name.length(), index_name.ptr());
|
||||
}
|
||||
LOG_WARN("rowkey already exists", K(ret), K(new_tbl_row));
|
||||
} else if (OB_TRY_LOCK_ROW_CONFLICT != ret && OB_TRANSACTION_SET_VIOLATION != ret) {
|
||||
LOG_WARN("failed to update to row", K(ret), K(new_row));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4992,8 +4953,12 @@ int ObLSTabletService::check_new_row_nullable_value(
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_new_row_nullable_value");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(column_ids), K(new_row), K(data_table));
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(column_ids), K(new_row), K(data_table));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
}
|
||||
} else if (new_row.get_cell(i).is_number()) {
|
||||
number::ObNumber num;
|
||||
@ -5006,8 +4971,12 @@ int ObLSTabletService::check_new_row_nullable_value(
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_new_row_nullable_value");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(column_ids), K(new_row), K(data_table));
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(column_ids), K(new_row), K(data_table));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5055,8 +5024,12 @@ int ObLSTabletService::check_new_row_nullable_value(const ObIArray<ObColDesc> &c
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_new_row_nullable_value");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(col_descs), K(new_row), K(relative_table));
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(col_descs), K(new_row), K(relative_table));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
}
|
||||
} else if (new_row.get_cell(i).is_number()) {
|
||||
number::ObNumber num;
|
||||
@ -5069,8 +5042,12 @@ int ObLSTabletService::check_new_row_nullable_value(const ObIArray<ObColDesc> &c
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_new_row_nullable_value");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(col_descs), K(new_row), K(relative_table));
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
K(column_id), K(col_descs), K(new_row), K(relative_table));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5130,10 +5107,14 @@ int ObLSTabletService::check_new_row_shadow_pk(
|
||||
ret = OB_ERR_DEFENSIVE_CHECK;
|
||||
ObString func_name = ObString::make_string("check_new_row_shadow_pk");
|
||||
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
|
||||
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
"column_id", column_ids, K(new_row), K(data_table),
|
||||
K(spk_value), "pk_value", new_row.get_cell(pk_idx),
|
||||
K(pk_idx), K(i), K(spk_column_id), K(real_pk_id));
|
||||
LOG_ERROR_RET(OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!", K(ret),
|
||||
"column_id", column_ids, K(new_row), K(data_table),
|
||||
K(spk_value), "pk_value", new_row.get_cell(pk_idx),
|
||||
K(pk_idx), K(i), K(spk_column_id), K(real_pk_id));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_DEFENSIVE_CHECK_FAIL,
|
||||
OB_ERR_DEFENSIVE_CHECK,
|
||||
"Fatal Error!!! Catch a defensive error!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6395,46 +6376,32 @@ int ObLSTabletService::SetMemtableFrozenOperator::operator()(const common::ObTab
|
||||
|
||||
void ObLSTabletService::AllowToReadMgr::disable_to_read()
|
||||
{
|
||||
AllowToReadInfo read_info;
|
||||
AllowToReadInfo next_read_info;
|
||||
bool old_v = false;
|
||||
bool new_v = false;
|
||||
do {
|
||||
LOAD128(read_info, &read_info_);
|
||||
if (!read_info.allow_to_read()) {
|
||||
old_v = ATOMIC_LOAD(&allow_to_read_);
|
||||
if (old_v == new_v) {
|
||||
break;
|
||||
} else {
|
||||
next_read_info.info_.allow_to_read_ = 0;
|
||||
next_read_info.info_.seq_ = read_info.info_.seq_ + 1;
|
||||
}
|
||||
} while (!CAS128(&read_info_, read_info, next_read_info));
|
||||
} while (ATOMIC_CAS(&allow_to_read_, old_v, new_v) != old_v);
|
||||
}
|
||||
|
||||
void ObLSTabletService::AllowToReadMgr::enable_to_read()
|
||||
{
|
||||
AllowToReadInfo read_info;
|
||||
AllowToReadInfo next_read_info;
|
||||
bool old_v = false;
|
||||
bool new_v = true;
|
||||
do {
|
||||
LOAD128(read_info, &read_info_);
|
||||
if (read_info.allow_to_read()) {
|
||||
old_v = ATOMIC_LOAD(&allow_to_read_);
|
||||
if (old_v == new_v) {
|
||||
break;
|
||||
} else {
|
||||
next_read_info.info_.allow_to_read_ = 1;
|
||||
next_read_info.info_.seq_ = read_info.info_.seq_;
|
||||
}
|
||||
} while (!CAS128(&read_info_, read_info, next_read_info));
|
||||
} while (ATOMIC_CAS(&allow_to_read_, old_v, new_v) != old_v);
|
||||
}
|
||||
|
||||
void ObLSTabletService::AllowToReadMgr::load_allow_to_read_info(
|
||||
AllowToReadInfo &read_info)
|
||||
bool &allow_to_read)
|
||||
{
|
||||
LOAD128(read_info, &read_info_);
|
||||
}
|
||||
|
||||
void ObLSTabletService::AllowToReadMgr::check_read_info_same(
|
||||
const AllowToReadInfo &read_info, bool &is_same)
|
||||
{
|
||||
AllowToReadInfo current_read_info;
|
||||
LOAD128(current_read_info, &read_info_);
|
||||
is_same = read_info == current_read_info;
|
||||
allow_to_read = ATOMIC_LOAD(&allow_to_read_);
|
||||
}
|
||||
|
||||
int ObLSTabletService::get_all_tablet_ids(
|
||||
|
@ -110,41 +110,13 @@ public:
|
||||
class AllowToReadMgr final
|
||||
{
|
||||
public:
|
||||
struct AllowToReadInfo final
|
||||
{
|
||||
AllowToReadInfo() { info_.seq_ = 0; info_.allow_to_read_ = 0; info_.reserved_ = 0; }
|
||||
~AllowToReadInfo() = default;
|
||||
bool allow_to_read() const { return info_.allow_to_read_ == 1; }
|
||||
bool operator==(const AllowToReadInfo &other) const {
|
||||
return info_.seq_ == other.info_.seq_
|
||||
&& info_.allow_to_read_ == other.info_.allow_to_read_
|
||||
&& info_.reserved_ == other.info_.reserved_;
|
||||
}
|
||||
|
||||
TO_STRING_KV(K_(info));
|
||||
static const int32_t RESERVED = 63;
|
||||
union InfoUnion
|
||||
{
|
||||
struct types::uint128_t v128_;
|
||||
struct
|
||||
{
|
||||
uint64_t seq_ : 64;
|
||||
uint8_t allow_to_read_ : 1;
|
||||
uint64_t reserved_ : RESERVED;
|
||||
};
|
||||
TO_STRING_KV(K_(seq), K_(allow_to_read), K_(reserved));
|
||||
};
|
||||
InfoUnion info_;
|
||||
} __attribute__((__aligned__(16)));
|
||||
public:
|
||||
AllowToReadMgr(): read_info_() {}
|
||||
AllowToReadMgr() : allow_to_read_(false) {}
|
||||
~AllowToReadMgr() = default;
|
||||
void disable_to_read();
|
||||
void enable_to_read();
|
||||
void load_allow_to_read_info(AllowToReadInfo &read_info);
|
||||
void check_read_info_same(const AllowToReadInfo &read_info, bool &is_same);
|
||||
void load_allow_to_read_info(bool &allow_to_read);
|
||||
private:
|
||||
AllowToReadInfo read_info_;
|
||||
bool allow_to_read_;
|
||||
};
|
||||
private:
|
||||
// for replay
|
||||
@ -304,8 +276,7 @@ public:
|
||||
const int64_t snapshot_version,
|
||||
ObTabletTableIterator &iter,
|
||||
const bool allow_no_ready_read = false);
|
||||
int check_allow_to_read(AllowToReadMgr::AllowToReadInfo &read_info);
|
||||
int check_read_info_same(const AllowToReadMgr::AllowToReadInfo &read_info);
|
||||
int check_allow_to_read();
|
||||
int set_tablet_status(
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObTabletCreateDeleteMdsUserData &tablet_status,
|
||||
@ -619,8 +590,6 @@ private:
|
||||
ObObj &obj,
|
||||
ObLobAccessParam *del_param,
|
||||
ObLobCommon *lob_common);
|
||||
static int check_lob_tablet_valid(
|
||||
ObTabletHandle &data_tablet);
|
||||
static int insert_lob_tablet_row(
|
||||
ObTabletHandle &data_tablet,
|
||||
ObDMLRunningCtx &run_ctx,
|
||||
|
@ -419,8 +419,20 @@ bool ObStorageTableGuard::need_to_refresh_table(ObTableStoreIterator &iter)
|
||||
const common::ObTabletID &tablet_id = tablet_->get_tablet_meta().tablet_id_;
|
||||
if (need_log_error) {
|
||||
LOG_ERROR_RET(OB_ERR_TOO_MUCH_TIME, "refresh table too much times", K(ret), K(exit_flag), K(ls_id), K(tablet_id), KP(table));
|
||||
LOG_DBA_ERROR_V2(OB_STORAGE_MEMTABLE_REFRESH_TIMEOUT,
|
||||
OB_ERR_TOO_MUCH_TIME,
|
||||
"refresh table too much times",
|
||||
", with ls_id=", ls_id,
|
||||
", with tablet_id=", tablet_id,
|
||||
", with exit_flag=", exit_flag);
|
||||
} else {
|
||||
LOG_WARN_RET(OB_ERR_TOO_MUCH_TIME, "refresh table too much times", K(ret), K(exit_flag), K(ls_id), K(tablet_id), KP(table));
|
||||
LOG_DBA_WARN_V2(OB_STORAGE_MEMTABLE_REFRESH_TOO_MUCH_TIME,
|
||||
OB_ERR_TOO_MUCH_TIME,
|
||||
"refresh table too much times",
|
||||
", with ls_id=", ls_id,
|
||||
", with tablet_id=", tablet_id,
|
||||
", with exit_flag=", exit_flag);
|
||||
}
|
||||
if (0 == exit_flag) {
|
||||
LOG_WARN("table is null or not memtable", K(ret), K(ls_id), K(tablet_id), KP(table));
|
||||
|
@ -3278,7 +3278,6 @@ int ObTablet::get_src_tablet_read_tables_(
|
||||
succ_get_src_tables = false;
|
||||
ObTabletCreateDeleteMdsUserData user_data;
|
||||
ObLSTabletService *tablet_service = nullptr;
|
||||
ObLSTabletService::AllowToReadMgr::AllowToReadInfo read_info;
|
||||
SCN max_decided_scn;
|
||||
if (OB_UNLIKELY(snapshot_version < 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
@ -3302,7 +3301,7 @@ int ObTablet::get_src_tablet_read_tables_(
|
||||
} else if (OB_ISNULL(tablet_service = ls->get_tablet_svr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ls tablet service should not be NULL", K(ret), KP(ls));
|
||||
} else if (OB_FAIL(tablet_service->check_allow_to_read(read_info))) {
|
||||
} else if (OB_FAIL(tablet_service->check_allow_to_read())) {
|
||||
if (OB_REPLICA_NOT_READABLE == ret) {
|
||||
LOG_WARN("replica unreadable", K(ret), "ls_id", ls->get_ls_id(), "tablet_id", tablet_meta_.tablet_id_, K(user_data));
|
||||
} else {
|
||||
@ -3339,8 +3338,6 @@ int ObTablet::get_src_tablet_read_tables_(
|
||||
*(iter.table_store_iter_.transfer_src_table_store_handle_),
|
||||
allow_no_ready_read))) {
|
||||
LOG_WARN("failed to get read tables from table store", K(ret), KPC(tablet));
|
||||
} else if (OB_FAIL(tablet_service->check_read_info_same(read_info))) {
|
||||
LOG_WARN("failed to check read info same", K(ret), KPC(tablet));
|
||||
} else {
|
||||
succ_get_src_tables = true;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ int ObLSTxCtxMgr::get_tx_ctx_(const ObTransID &tx_id, const bool for_replay, ObP
|
||||
// ls_tx_ctx_map_.revert(tmp_ctx);
|
||||
// tmp_ctx = NULL;
|
||||
// }
|
||||
ctx = dynamic_cast<transaction::ObPartTransCtx*>(tmp_ctx);
|
||||
ctx = static_cast<transaction::ObPartTransCtx*>(tmp_ctx);
|
||||
}
|
||||
} else if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_TRANS_CTX_NOT_EXIST;
|
||||
|
@ -572,19 +572,21 @@ int ObPartTransCtx::handle_timeout(const int64_t delay)
|
||||
if (part_trans_action_ == ObPartTransAction::COMMIT || part_trans_action_ == ObPartTransAction::ABORT) {
|
||||
if (now >= trans_expired_time_ + OB_TRANS_WARN_USE_TIME) {
|
||||
tmp_ret = OB_TRANS_COMMIT_TOO_MUCH_TIME;
|
||||
LOG_DBA_ERROR(OB_TRANS_COMMIT_TOO_MUCH_TIME,
|
||||
"msg", "transaction commit cost too much time",
|
||||
"ret", tmp_ret,
|
||||
K(*this));
|
||||
LOG_DBA_ERROR_V2(OB_TRANS_COMMIT_COST_TOO_MUCH_TIME, tmp_ret,
|
||||
"Transaction commit cost too much time. ",
|
||||
"trans_id is ", trans_id_, ". ls_id is ", ls_id_, ". ",
|
||||
"[suggestion] You can query GV$OB_PROCESSLIST view to get more information.");
|
||||
}
|
||||
} else {
|
||||
if (now >= ctx_create_time_ + OB_TRANS_WARN_USE_TIME) {
|
||||
print_first_mvcc_callback_();
|
||||
tmp_ret = OB_TRANS_LIVE_TOO_MUCH_TIME;
|
||||
LOG_DBA_WARN(OB_TRANS_LIVE_TOO_MUCH_TIME,
|
||||
"msg", "transaction live cost too much time without commit or abort",
|
||||
"ret", tmp_ret,
|
||||
K(*this));
|
||||
LOG_DBA_WARN_V2(OB_TRANS_LIVE_TOO_LONG, tmp_ret,
|
||||
"Transaction live too long without commit or abort. ",
|
||||
"trans_id is ", trans_id_, ". ls_id is ", ls_id_, ". ",
|
||||
"[suggestion] This may be normal and simply because the client hasn't executed the 'commit' command yet. ",
|
||||
"You can query GV$OB_PROCESSLIST view to get more information ",
|
||||
"and confirm whether you need to submit this transaction.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,11 +524,10 @@ int ObAccessService::construct_store_ctx_other_variables_(
|
||||
int ret = OB_SUCCESS;
|
||||
const share::ObLSID &ls_id = ls.get_ls_id();
|
||||
ObLSTabletService *tablet_service = ls.get_tablet_svr();
|
||||
ObLSTabletService::AllowToReadMgr::AllowToReadInfo read_info;
|
||||
if (OB_ISNULL(tablet_service)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tablet service should not be null.", K(ret), K(ls_id));
|
||||
} else if (OB_FAIL(tablet_service->check_allow_to_read(read_info))) {
|
||||
} else if (OB_FAIL(tablet_service->check_allow_to_read())) {
|
||||
if (OB_REPLICA_NOT_READABLE == ret) {
|
||||
LOG_WARN("replica unreadable", K(ret), K(ls_id), K(tablet_id));
|
||||
} else {
|
||||
|
@ -403,6 +403,15 @@ int ObLSService::check_tenant_ls_num_()
|
||||
ret = OB_TOO_MANY_TENANT_LS;
|
||||
LOG_WARN("too many ls of a tenant", K(ret), K(normal_ls_count), K(removeing_ls_count),
|
||||
K(min_constraint_type), K(get_constraint_type_name(min_constraint_type)), K(min_constraint_value));
|
||||
LOG_DBA_WARN_(OB_STORAGE_LS_COUNT_REACH_UPPER_LIMIT, ret,
|
||||
"The current tenant has too many log streams. ",
|
||||
"normal_ls_count(", normal_ls_count, ") + removeing_ls_count(", removeing_ls_count,
|
||||
") >= min_constraint_value(", min_constraint_value, "). ",
|
||||
"The resource of ", get_constraint_type_name(min_constraint_type),
|
||||
" limits the number of log streams. ",
|
||||
"[suggestion] Expand the tenant's unit resources. ",
|
||||
"You can also query the GV$OB_TENANT_RESOURCE_LIMIT_DETAIL view ",
|
||||
"to get which resource limits the number of log streams. ");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -23,6 +23,7 @@ default_value varchar(65536) NO NULL
|
||||
isdefault bigint(20) NO NULL
|
||||
select name from __all_virtual_sys_parameter_stat where name not like "module_test_%" group by name order by name;
|
||||
name
|
||||
alert_log_level
|
||||
all_server_list
|
||||
arbitration_timeout
|
||||
archive_lag_target
|
||||
|
Loading…
x
Reference in New Issue
Block a user