[FEAT MERGE] Merge syslog user experience improvement to master

Co-authored-by: Charles0429 <xiezhenjiang@gmail.com>
Co-authored-by: tino247 <tino247@126.com>
Co-authored-by: chaser-ch <chaser.ch@antgroup.com>
This commit is contained in:
stdliu 2023-02-06 15:52:23 +08:00 committed by ob-robot
parent 1de9266dd0
commit f8c5c2647f
796 changed files with 4465 additions and 3036 deletions

View File

@ -496,7 +496,7 @@ const char *ObLogDataWriter::select_pool_file(char *buf, const int64_t buf_len)
char *result = NULL;
int64_t len = 0;
if (OB_ISNULL(buf) || buf_len < 0) {
SHARE_LOG(WARN, "invalid argument", KP(buf), K(buf_len));
SHARE_LOG_RET(WARN, OB_INVALID_ARGUMENT, "invalid argument", KP(buf), K(buf_len));
} else if (OB_ISNULL(min_avail_file_id_getter_)) {
// do nothing
} else if (0 == min_file_id_) {
@ -504,16 +504,16 @@ const char *ObLogDataWriter::select_pool_file(char *buf, const int64_t buf_len)
SHARE_LOG(INFO, "min_file_id has not inited, can not reuse file, "
"will create new file num_file_to_add", K(num_file_to_add_));
} else if (min_file_id_ < 0) {
SHARE_LOG(ERROR, "min_file_id < 0", K(min_file_id_));
SHARE_LOG_RET(ERROR, OB_ERROR, "min_file_id < 0", K(min_file_id_));
} else if (num_file_to_add_ > 0) {
num_file_to_add_--;
SHARE_LOG(INFO, "num_file_to_add >= 0 will create new file.", K(num_file_to_add_));
} else if (min_file_id_ > min_avail_file_id_
&& min_file_id_ > (min_avail_file_id_ = min_avail_file_id_getter_->get())) {
SHARE_LOG(WARN, "can not select pool_file", K(min_file_id_), K(min_avail_file_id_));
SHARE_LOG_RET(WARN, OB_ERROR, "can not select pool_file", K(min_file_id_), K(min_avail_file_id_));
} else if ((len = snprintf(buf, buf_len, "%s/%ld", log_dir_, min_file_id_)) < 0
|| len >= buf_len) {
SHARE_LOG(ERROR, "gen fname fail", K(buf_len), KCSTRING(log_dir_), K(min_file_id_));
SHARE_LOG_RET(ERROR, OB_ERROR, "gen fname fail", K(buf_len), KCSTRING(log_dir_), K(min_file_id_));
} else {
result = buf;
min_file_id_++;

View File

@ -176,12 +176,12 @@ uint64_t ObBalanceFilter::filt(const uint64_t input)
void ObBalanceFilter::migrate(const int64_t bucket_pos, const int64_t thread_pos)
{
if (!inited_) {
_OB_LOG(WARN, "have not inited");
_OB_LOG_RET(WARN, OB_NOT_INIT, "have not inited");
} else if (0 > bucket_pos
|| bucket_node_num_ <= bucket_pos
|| 0 > thread_pos
|| thread_node_num_ <= thread_pos) {
_OB_LOG(WARN, "invalid param, bucket_pos=%ld thread_pos=%ld", bucket_pos, thread_pos);
_OB_LOG_RET(WARN, OB_NOT_INIT, "invalid param, bucket_pos=%ld thread_pos=%ld", bucket_pos, thread_pos);
} else {
_OB_LOG(INFO, "migrate bucket_pos=%ld bucket_cnt=%ld thread_pos from %ld:%ld to %ld:%ld",
bucket_pos, bucket_nodes_[bucket_pos].cnt,

View File

@ -86,7 +86,7 @@ void ObClockGenerator::run1()
break;
} else {
if (REACH_TIME_INTERVAL(PRINT_LOG_INTERVAL_US)) {
TRANS_LOG(WARN, "clock out of order", K(cur_ts), K(cur_ts_), K(delta));
TRANS_LOG_RET(WARN, OB_ERR_SYS, "clock out of order", K(cur_ts), K(cur_ts_), K(delta));
}
::usleep(SLEEP_US);
}

View File

@ -63,7 +63,7 @@ inline int64_t ObClockGenerator::getClock()
int64_t ts = 0;
if (OB_UNLIKELY(!clock_generator_.inited_)) {
TRANS_LOG(WARN, "clock generator not inited");
TRANS_LOG_RET(WARN, common::OB_NOT_INIT, "clock generator not inited");
ts = clock_generator_.get_us();
} else {
ts = ATOMIC_LOAD(&clock_generator_.cur_ts_);
@ -120,7 +120,7 @@ inline void ObClockGenerator::try_advance_cur_ts(const int64_t cur_ts)
if (origin_cur_ts < cur_ts) {
break;
} else {
TRANS_LOG(WARN, "timestamp rollback, need advance cur ts", K(origin_cur_ts), K(cur_ts));
TRANS_LOG_RET(WARN, common::OB_ERR_SYS, "timestamp rollback, need advance cur ts", K(origin_cur_ts), K(cur_ts));
}
} while (false == ATOMIC_BCAS(&clock_generator_.cur_ts_, origin_cur_ts, cur_ts));
}

View File

@ -90,7 +90,7 @@ template <int64_t MAX_SIZE, typename T>
T &BaseLearnerList<MAX_SIZE, T>::get_learner(const int64_t idx)
{
if (idx < 0) {
COMMON_LOG(ERROR, "get_index_by_addr failed", K(idx));
COMMON_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "get_index_by_addr failed", K(idx));
}
return learner_array_[idx];
}
@ -233,7 +233,7 @@ BaseLearnerList<MAX_SIZE, T> &BaseLearnerList<MAX_SIZE, T>::operator=(const Base
if (this != &learner_list) {
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = deep_copy(learner_list))) {
COMMON_LOG(ERROR, "deep_copy failed", K(tmp_ret));
COMMON_LOG_RET(ERROR, tmp_ret, "deep_copy failed", K(tmp_ret));
}
}
return *this;

View File

@ -270,7 +270,7 @@ ObMemberListBase<MAX_MEMBER_NUM> &ObMemberListBase<MAX_MEMBER_NUM>::operator=(co
if (this != &member_list) {
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = deep_copy(member_list))) {
COMMON_LOG(WARN, "deep_copy failed", K(tmp_ret));
COMMON_LOG_RET(WARN, tmp_ret, "deep_copy failed", K(tmp_ret));
}
}
return *this;
@ -301,7 +301,7 @@ int64_t ObMemberListBase<MAX_MEMBER_NUM>::to_string(char *buf, const int64_t buf
databuff_printf(buf, buf_len , pos, "%ld", member_number_);
for (int64_t i = 0; i < member_number_; ++i) {
if (OB_SUCCESS != (tmp_ret = databuff_print_obj(buf, buf_len, pos, member_[i]))) {
COMMON_LOG(WARN, "databuff_print_objfailed", K(tmp_ret));
COMMON_LOG_RET(WARN, tmp_ret, "databuff_print_objfailed", K(tmp_ret));
}
}
return pos;

View File

@ -25,7 +25,7 @@ ObCond::ObCond(const int64_t spin_wait_num) : spin_wait_num_(spin_wait_num),
{
pthread_mutex_init(&mutex_, NULL);
if (0 != pthread_cond_init(&cond_, NULL)) {
_OB_LOG(ERROR, "pthread_cond_init failed");
_OB_LOG_RET(ERROR, common::OB_ERR_SYS, "pthread_cond_init failed");
}
}
@ -423,7 +423,7 @@ void *S2MQueueThread::thread_func_(void *data)
ThreadConf *const tc = (ThreadConf *)data;
if (NULL == tc
|| NULL == tc->host) {
_OB_LOG(WARN, "thread_func param null pointer");
_OB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "thread_func param null pointer");
} else {
tc->host->thread_index() = tc->index;
void *pdata = tc->host->on_begin();
@ -611,7 +611,7 @@ void *M2SQueueThread::thread_func_(void *data)
{
M2SQueueThread *const host = (M2SQueueThread *)data;
if (NULL == host) {
_OB_LOG(WARN, "thread_func param null pointer");
_OB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "thread_func param null pointer");
} else {
void *pdata = host->on_begin();
while (host->run_flag_)

View File

@ -28,19 +28,19 @@ ObServerExt::~ObServerExt()
int ObServerExt::init(char *hname, common::ObAddr server)
{
int err = OB_SUCCESS;
int ret = OB_SUCCESS;
if (NULL == hname || static_cast<int64_t>(strlen(hname)) >= OB_MAX_HOST_NAME_LENGTH) {
_OB_LOG(WARN, "invalid param, hname=%s", hname);
err = OB_INVALID_ARGUMENT;
ret = OB_INVALID_ARGUMENT;
} else {
MEMCPY(hostname_, hname, strlen(hname) + 1);
if (!server_.set_ipv4_addr(server.get_ipv4(), server.get_port())) {
err = OB_ERR_UNEXPECTED;
_OB_LOG(WARN, "fail to set ipv4 addr, ret=%d", err);
ret = OB_ERR_UNEXPECTED;
_OB_LOG(WARN, "fail to set ipv4 addr, ret=%d", ret);
}
}
_OB_LOG(INFO, "magic_num=%ld", magic_num_);
return err;
return ret;
}
const char *ObServerExt::get_hostname() const
@ -62,14 +62,14 @@ char *ObServerExt::get_hostname()
}
int ObServerExt::set_hostname(const char *hname)
{
int err = OB_SUCCESS;
int ret = OB_SUCCESS;
if (NULL == hname || static_cast<int64_t>(strlen(hname)) >= OB_MAX_HOST_NAME_LENGTH) {
_OB_LOG(WARN, "invalid param, hname=%s", hname);
err = OB_INVALID_ARGUMENT;
ret = OB_INVALID_ARGUMENT;
} else {
MEMCPY(hostname_, hname, strlen(hname) + 1);
}
return err;
return ret;
}
const ObAddr &ObServerExt::get_server()const
@ -84,16 +84,16 @@ ObAddr &ObServerExt::get_server()
int ObServerExt::serialize(char *buf, const int64_t buf_len, int64_t &pos)const
{
int err = OB_SUCCESS;
int ret = OB_SUCCESS;
if (NULL == buf || buf_len <= 0 || pos >= buf_len) {
_OB_LOG(WARN, "invalid param, buf=%p, buf_len=%ld, pos=%ld", buf, buf_len, pos);
err = OB_INVALID_ARGUMENT;
ret = OB_INVALID_ARGUMENT;
} else {
int64_t str_len = strlen(hostname_);
if (pos + str_len + (int64_t)sizeof(int64_t) * 2 >= buf_len) {
_OB_LOG(WARN, "buf is not enough, pos=%ld, buf_len=%ld", pos, buf_len);
err = OB_ERROR;
ret = OB_ERROR;
} else {
*(reinterpret_cast<int64_t *>(buf + pos)) = magic_num_;
pos += sizeof(int64_t);
@ -101,28 +101,28 @@ int ObServerExt::serialize(char *buf, const int64_t buf_len, int64_t &pos)const
pos += sizeof(int64_t);
strncpy(buf + pos, hostname_, str_len);
pos += str_len;
err = server_.serialize(buf, buf_len, pos);
if (OB_SUCCESS != err) {
ret = server_.serialize(buf, buf_len, pos);
if (OB_SUCCESS != ret) {
_OB_LOG(WARN, "ObAddr rs_server serialize fail");
}
}
}
return err;
return ret;
}
int ObServerExt::deserialize(const char *buf, const int64_t buf_len, int64_t &pos)
{
int err = OB_SUCCESS;
int ret = OB_SUCCESS;
if (NULL == buf || buf_len <= 0 || pos >= buf_len) {
_OB_LOG(WARN, "invalid param, buf=%p, buf_len=%ld, pos=%ld", buf, buf_len, pos);
err = OB_INVALID_ARGUMENT;
ret = OB_INVALID_ARGUMENT;
} else {
int64_t magic_num = 0;
magic_num = *(reinterpret_cast<const int64_t *>(buf + pos));
if (magic_num_ != magic_num) {
err = OB_NOT_THE_OBJECT;
_OB_LOG(WARN, "wrong magic num, can't deserilize the buffer to ObServerExt, err=%d", err);
ret = OB_NOT_THE_OBJECT;
_OB_LOG(WARN, "wrong magic num, can't deserilize the buffer to ObServerExt, ret=%d", ret);
} else {
pos += sizeof(int64_t);
int64_t str_len = 0;
@ -131,13 +131,13 @@ int ObServerExt::deserialize(const char *buf, const int64_t buf_len, int64_t &po
strncpy(hostname_, buf + pos, str_len);
hostname_[str_len] = '\0';
pos += str_len;
err = server_.deserialize(buf, buf_len, pos);
if (OB_SUCCESS != err) {
ret = server_.deserialize(buf, buf_len, pos);
if (OB_SUCCESS != ret) {
_OB_LOG(WARN, "ObAddr rs_server deserialize fail.");
}
}
}
return err;
return ret;
}
int64_t ObServerExt::get_serialize_size(void)const

View File

@ -46,7 +46,7 @@ ObTimeoutCtx::~ObTimeoutCtx()
{
if (NULL != header()) {
if (this != header()) {
LOG_ERROR("destruct timeout context should be header");
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "destruct timeout context should be header");
} else {
header() = next_;
}

View File

@ -40,7 +40,7 @@ inline ObZoneStatus::Status ObZoneStatus::get_status(const common::ObString &sta
} else if (status_str == common::ObString::make_string(get_status_str(ACTIVE))) {
ret_status = ACTIVE;
} else {
SERVER_LOG(WARN, "invalid status_str, return UNKNOWN status", K(status_str));
SERVER_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "invalid status_str, return UNKNOWN status", K(status_str));
}
return ret_status;
}
@ -56,7 +56,7 @@ inline const char *ObZoneStatus::get_status_str(const ObZoneStatus::Status statu
str = "INACTIVE";
break;
default:
SERVER_LOG(WARN, "unknown zone status, fatal error", K(status));
SERVER_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "unknown zone status, fatal error", K(status));
break;
}

View File

@ -26,7 +26,7 @@ const char *zone_type_to_str(ObZoneType zone_type)
{
const char *zone_type_str = NULL;
if (zone_type < ObZoneType::ZONE_TYPE_READWRITE || zone_type > ObZoneType::ZONE_TYPE_INVALID) {
LOG_ERROR("fatal error, unknown zone_type", K(zone_type));
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "fatal error, unknown zone_type", K(zone_type));
} else {
int index = static_cast<int>(zone_type);
zone_type_str = zone_type_strs[index];
@ -38,7 +38,7 @@ ObZoneType str_to_zone_type(const char *zone_type_str)
{
ObZoneType zone_type = ObZoneType::ZONE_TYPE_INVALID;
if (NULL == zone_type_str) {
LOG_ERROR("empty zone_type_str", KP(zone_type_str));
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "empty zone_type_str", KP(zone_type_str));
} else {
for (int64_t i = 0; i <= ObZoneType::ZONE_TYPE_INVALID; ++i) {
if (0 == strncasecmp(zone_type_strs[i], zone_type_str, strlen(zone_type_strs[i]))) {

View File

@ -37,7 +37,7 @@ bool is_calc_with_end_space(ObObjType type1, ObObjType type2,
}
#define OBJ_TYPE_CLASS_CHECK(obj, tc)\
if (OB_UNLIKELY(obj.get_type_class() != tc)) { \
LOG_ERROR("unexpected error. mismatch function for comparison", K(obj), K(tc));\
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "unexpected error. mismatch function for comparison", K(obj), K(tc));\
right_to_die_or_duty_to_live();\
}
@ -720,7 +720,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -743,7 +743,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -765,7 +765,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
OBJ_TYPE_CLASS_CHECK(obj2, ObRawTC); \
if (CS_TYPE_BINARY != obj1.get_collation_type() \
|| CS_TYPE_BINARY != obj2.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(cmp_ctx.cmp_cs_type_)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(cmp_ctx.cmp_cs_type_)); \
} else { \
ret = static_cast<int>(ObCharset::strcmpsp(CS_TYPE_BINARY, obj1.v_.string_, obj1.val_len_, \
obj2.v_.string_, obj2.val_len_, CALC_WITH_END_SPACE(obj1, obj2, cmp_ctx)) op_str 0); \
@ -784,7 +784,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
OBJ_TYPE_CLASS_CHECK(obj2, ObRawTC);\
if (CS_TYPE_BINARY != obj1.get_collation_type() \
|| CS_TYPE_BINARY != obj2.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(cmp_ctx.cmp_cs_type_)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(cmp_ctx.cmp_cs_type_)); \
} else { \
ret = INT_TO_CR(ObCharset::strcmpsp(CS_TYPE_BINARY, obj1.v_.string_, obj1.val_len_, \
obj2.v_.string_, obj2.val_len_, CALC_WITH_END_SPACE(obj1, obj2, cmp_ctx))); \
@ -811,7 +811,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -846,7 +846,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -902,7 +902,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -941,7 +941,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -983,7 +983,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
int64_t v2 = obj2.get_datetime(); \
if (obj1.get_type() != obj2.get_type()) { \
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) { \
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else { \
/*same tc while not same type*/ \
@ -1015,7 +1015,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
int64_t v2 = obj2.get_datetime();\
if (obj1.get_type() != obj2.get_type()) { \
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) { \
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else { \
/*same tc while not same type*/ \
@ -1059,7 +1059,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
ObOTimestampData v2 = obj2.get_otimestamp_value();\
if (!obj2.is_timestamp_nano()) { \
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else {\
v1.time_us_ -= cmp_ctx.tz_off_;\
@ -1083,7 +1083,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
ObOTimestampData v2 = obj2.get_otimestamp_value(); \
if (!obj2.is_timestamp_nano()) { \
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else {\
v1.time_us_ -= cmp_ctx.tz_off_;\
@ -1115,7 +1115,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
v2.time_us_ = obj2.get_datetime();\
if (!obj1.is_timestamp_nano()) {\
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else {\
v2.time_us_ -= cmp_ctx.tz_off_;\
@ -1139,7 +1139,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
v2.time_us_ = obj2.get_datetime();\
if (!obj1.is_timestamp_nano()) {\
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else {\
v2.time_us_ -= cmp_ctx.tz_off_;\
@ -1168,7 +1168,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
ObOTimestampData v2 = obj2.get_otimestamp_value(); \
if (obj1.is_timestamp_nano() != obj2.is_timestamp_nano()) { \
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else {\
if (obj1.is_timestamp_nano()) {\
@ -1195,7 +1195,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
ObOTimestampData v2 = obj2.get_otimestamp_value();\
if (obj1.is_timestamp_nano() != obj2.is_timestamp_nano()) {\
if (OB_UNLIKELY(INVALID_TZ_OFF == cmp_ctx.tz_off_)) {\
LOG_ERROR("invalid timezone offset", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid timezone offset", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else if (obj1.is_timestamp_nano()) {\
v1.time_us_ -= cmp_ctx.tz_off_;\
@ -1225,7 +1225,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
OBJ_TYPE_CLASS_CHECK(obj2, ObIntervalTC); \
ObCmpRes ret = CR_FALSE;\
if (obj1.get_type() != obj2.get_type()) { \
LOG_ERROR("different interval type can not compare", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "different interval type can not compare", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else if (obj1.is_interval_ym()) { \
ret = obj1.get_interval_ym() op_str obj2.get_interval_ym() ? CR_TRUE : CR_FALSE; \
@ -1247,7 +1247,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
OBJ_TYPE_CLASS_CHECK(obj2, ObIntervalTC); \
ObCmpRes ret = CR_FALSE; \
if (obj1.get_type() != obj2.get_type()) { \
LOG_ERROR("different interval type can not compare", K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "different interval type can not compare", K(obj1), K(obj2)); \
ret = CR_OB_ERROR; \
} else if (obj1.is_interval_ym()) { \
ObIntervalYMValue v1 = obj1.get_interval_ym(); \
@ -1282,7 +1282,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -1444,7 +1444,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (OB_UNLIKELY(obj1.get_type() != obj2.get_type()) || \
OB_UNLIKELY(!obj1.is_urowid())) { \
ret = CR_OB_ERROR; \
LOG_ERROR("only support urowid for now", K(ret)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "only support urowid for now", K(ret)); \
} else { \
ret = \
static_cast<ObCmpRes>(obj1.get_urowid().compare(obj2.get_urowid())); \
@ -1463,7 +1463,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetTC, ObUIntTC>(const ObObj &obj1, \
if (OB_UNLIKELY(obj1.get_type() != obj2.get_type()) || \
OB_UNLIKELY(!obj1.is_urowid())) { \
ret = CR_OB_ERROR; \
LOG_ERROR("only support urowid for now", K(ret)); \
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "only support urowid for now", K(ret)); \
} else { \
ret = obj1.get_urowid() op_str obj2.get_urowid() ? CR_TRUE : CR_FALSE; \
} \
@ -1660,7 +1660,7 @@ int ObObjCmpFuncs::cmp_func<ObEnumSetInnerTC, real_tc>(const ObObj &obj1, \
if (CS_TYPE_INVALID == cs_type) { \
if (obj1.get_collation_type() != obj2.get_collation_type() \
|| CS_TYPE_INVALID == obj1.get_collation_type()) { \
LOG_ERROR("invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "invalid collation", K(obj1.get_collation_type()), K(obj2.get_collation_type()), K(obj1), K(obj2)); \
} else { \
cs_type = obj1.get_collation_type(); \
} \
@ -3729,7 +3729,7 @@ bool ObObjCmpFuncs::compare_oper_nullsafe(const ObObj &obj1,
if (OB_UNLIKELY(ob_is_invalid_obj_type(type1)
|| ob_is_invalid_obj_type(type2)
|| ob_is_invalid_cmp_op_bool(cmp_op))) {
LOG_ERROR("invalid obj1 or obj2 or cmp_op", K(obj1), K(obj2), K(cmp_op));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid obj1 or obj2 or cmp_op", K(obj1), K(obj2), K(cmp_op));
right_to_die_or_duty_to_live();
} else {
obj_cmp_func cmp_op_func = NULL;
@ -3737,12 +3737,12 @@ bool ObObjCmpFuncs::compare_oper_nullsafe(const ObObj &obj1,
obj2.get_meta(),
cmp_op,
cmp_op_func))) {
LOG_ERROR("obj1 and obj2 can't compare", K(obj1), K(obj2), K(cmp_op));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "obj1 and obj2 can't compare", K(obj1), K(obj2), K(cmp_op));
right_to_die_or_duty_to_live();
} else {
ObCompareCtx cmp_ctx(ObMaxType, cs_type, true, INVALID_TZ_OFF, default_null_pos());
if (OB_UNLIKELY(CR_OB_ERROR == (cmp = cmp_op_func(obj1, obj2, cmp_ctx)))) {
LOG_ERROR("failed to compare obj1 and obj2", K(obj1), K(obj2), K(cmp_op));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "failed to compare obj1 and obj2", K(obj1), K(obj2), K(cmp_op));
right_to_die_or_duty_to_live();
}
}
@ -3785,12 +3785,12 @@ int ObObjCmpFuncs::compare_nullsafe(const ObObj &obj1,
obj2.get_meta(),
CO_CMP,
cmp_func))) {
LOG_ERROR("obj1 and obj2 can't compare", K(obj1), K(obj2), K(obj1.get_meta()), K(obj2.get_meta()));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "obj1 and obj2 can't compare", K(obj1), K(obj2), K(obj1.get_meta()), K(obj2.get_meta()));
right_to_die_or_duty_to_live();
} else {
ObCompareCtx cmp_ctx(ObMaxType, cs_type, true, INVALID_TZ_OFF, lib::is_oracle_mode() ? NULL_LAST : NULL_FIRST);
if (OB_UNLIKELY(CR_OB_ERROR == (cmp = cmp_func(obj1, obj2, cmp_ctx)))) {
LOG_ERROR("failed to compare obj1 and obj2", K(obj1), K(obj2), K(obj1.get_meta()), K(obj2.get_meta()));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "failed to compare obj1 and obj2", K(obj1), K(obj2), K(obj1.get_meta()), K(obj2.get_meta()));
right_to_die_or_duty_to_live();
}
}
@ -3842,7 +3842,7 @@ int ObObjCmpFuncs::compare_nullsafe(const ObObj &obj1,
// because this function is so fundamental and performance related.
if (ob_is_invalid_obj_type(type1)
|| ob_is_invalid_obj_type(type2)) {
LOG_ERROR("invalid obj1 or obj2", K(obj1), K(obj2));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "invalid obj1 or obj2", K(obj1), K(obj2));
right_to_die_or_duty_to_live();
} else {
obj_cmp_func cmp_func = NULL;
@ -3850,10 +3850,10 @@ int ObObjCmpFuncs::compare_nullsafe(const ObObj &obj1,
obj2.get_meta(),
CO_CMP,
cmp_func))) {
LOG_ERROR("obj1 and obj2 can't compare", K(obj1), K(obj2));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "obj1 and obj2 can't compare", K(obj1), K(obj2));
right_to_die_or_duty_to_live();
} else if (OB_UNLIKELY(CR_OB_ERROR == (cmp = cmp_func(obj1, obj2, cmp_ctx)))) {
LOG_ERROR("failed to compare obj1 and obj2", K(obj1), K(obj2));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "failed to compare obj1 and obj2", K(obj1), K(obj2));
right_to_die_or_duty_to_live();
} else {
// do nothing

View File

@ -2258,10 +2258,10 @@ inline int64_t obj_val_get_serialize_size<ObExtendType>(const ObObj &obj)
int64_t len = 0;
OB_UNIS_ADD_LEN(obj.get_ext());
if (obj.is_pl_extend()) {
COMMON_LOG(ERROR, "Unexpected serialize", K(OB_NOT_SUPPORTED), K(obj), K(obj.get_meta().get_extend_type()));
COMMON_LOG_RET(ERROR, OB_NOT_SUPPORTED, "Unexpected serialize", K(OB_NOT_SUPPORTED), K(obj), K(obj.get_meta().get_extend_type()));
return len; //TODO:@ryan.ly: close this feature before composite refactor
if (NULL == composite_serialize_size_callback) {
COMMON_LOG(ERROR, "Unexpected callback", K(OB_ERR_UNEXPECTED), K(obj));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected callback", K(OB_ERR_UNEXPECTED), K(obj));
} else {
len += composite_serialize_size_callback(obj);
}

View File

@ -1303,7 +1303,7 @@ int ObObj::check_collation_free_and_compare(const ObObj &other) const
|| CS_TYPE_COLLATION_FREE != get_collation_type()
|| get_type() != other.get_type()
|| !is_character_type()) {
LOG_ERROR("unexpected error, invalid argument", K(*this), K(other));
LOG_ERROR_RET(common::OB_ERR_UNEXPECTED, "unexpected error, invalid argument", K(*this), K(other));
right_to_die_or_duty_to_live();
} else {
// 只用于sortkey转换后的Obj比较
@ -1809,7 +1809,7 @@ bool ObObj::check_collation_integrity() const
}
if (!is_ok) {
if (REACH_TIME_INTERVAL(10 * 1000 * 1000)) {
BACKTRACE(WARN, true, "unexpected collation type: %s", to_cstring(get_meta()));
BACKTRACE_RET(WARN, true, common::OB_ERR_UNEXPECTED, "unexpected collation type: %s", to_cstring(get_meta()));
}
}
#endif
@ -1866,7 +1866,7 @@ void ObObj::checksum(ObBatchChecksum &bc) const
void ObObj::dump(const int32_t log_level /*= OB_LOG_LEVEL_DEBUG*/) const
{
_OB_NUM_LEVEL_LOG(log_level, "%s", S(*this));
_OB_NUM_LEVEL_LOG(log_level, 0, "%s", S(*this));
}
int ObObj::print_varchar_literal(const ObIArray<ObString> &type_infos, char *buffer, int64_t length, int64_t &pos) const

View File

@ -678,7 +678,7 @@ struct ObMemLobCommon
&& (type_ > INVALID_LOB && type_ <= TEMP_DELTA_LOB)
&& ((is_simple_ & has_extern_) != 1);
if (!bret) {
COMMON_LOG(WARN, "Invalid lob locator v2!",
COMMON_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "Invalid lob locator v2!",
K(lob_common_), K(version_), K(type_), K(is_simple_), K(has_extern_), K(lbt()));
}
return bret;
@ -892,7 +892,7 @@ public:
bret = false;
}
if (!bret) {
COMMON_LOG(WARN, "Invalid lob locator!", KP(ptr_), K(size_));
COMMON_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "Invalid lob locator!", KP(ptr_), K(size_));
if (OB_NOT_NULL(loc) && is_assert) {
OB_ASSERT(0);
}
@ -1197,7 +1197,7 @@ public:
OB_INLINE void set_type(const ObObjType &type)
{
if (OB_UNLIKELY(ObNullType > type || ObMaxType < type)) {
COMMON_LOG(ERROR, "invalid type", K(type));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "invalid type", K(type));
meta_.set_type(ObUnknownType);
} else {
meta_.set_type(type);

View File

@ -90,13 +90,13 @@ public:
int64_t real_idx = index;
if (projector_size_ > 0) {
if (OB_ISNULL(projector_) || index >= projector_size_ || index < 0) {
COMMON_LOG(ERROR, "index is invalid", K(index), K_(projector_size), K_(projector));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "index is invalid", K(index), K_(projector_size), K_(projector));
} else {
real_idx = projector_[index];
}
}
if (real_idx >= count_) {
COMMON_LOG(ERROR, "real_idx is invalid", K_(count), K(real_idx));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "real_idx is invalid", K_(count), K(real_idx));
}
return cells_[real_idx];
}
@ -106,14 +106,14 @@ public:
int64_t real_idx = index;
if (projector_size_ > 0) {
if (OB_ISNULL(projector_) || index >= projector_size_ || index < 0) {
COMMON_LOG(ERROR, "index is invalid", K(index), K_(projector_size), K_(projector));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "index is invalid", K(index), K_(projector_size), K_(projector));
right_to_die_or_duty_to_live();
} else {
real_idx = projector_[index];
}
}
if (real_idx >= count_) {
COMMON_LOG(ERROR, "real_idx is invalid", K_(count), K(real_idx));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "real_idx is invalid", K_(count), K(real_idx));
right_to_die_or_duty_to_live();
}
return cells_[real_idx];

View File

@ -594,7 +594,7 @@ ObRowStore::BlockInfo* ObRowStore::new_block(int64_t block_size)
ObMemAttr attr(tenant_id_, label_, ctx_id_);
block = static_cast<BlockInfo *>(alloc_.alloc(block_size, attr));
if (OB_ISNULL(block)) {
OB_LOG(WARN, "no memory");
OB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "no memory");
} else {
block = new(block) BlockInfo(block_size);
if (!has_big_block_ && block_size == BIG_BLOCK_SIZE) {
@ -610,11 +610,11 @@ ObRowStore::BlockInfo *ObRowStore::new_block()
BlockInfo *blk = NULL;
if (OB_LIKELY(!has_big_block_)) { // use config BLOCK size
if (OB_ISNULL(blk = new_block(block_size_))) {
OB_LOG(WARN, "failed to new block", K_(block_size));
OB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "failed to new block", K_(block_size));
}
} else { // use BIG_BLOCK
if (OB_ISNULL(blk = new_block(BIG_BLOCK_SIZE))) {
OB_LOG(WARN, "failed to new big block", K(blk));
OB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "failed to new big block", K(blk));
}
}
return blk;
@ -900,15 +900,15 @@ ObRowStore *ObRowStore::clone(char *buffer, int64_t buffer_length) const
ObRowStore *copy = NULL;
int64_t used_length = 0;
if (OB_ISNULL(buffer)) {
OB_LOG(WARN, "buffer is NULL");
OB_LOG_RET(WARN, OB_INVALID_ARGUMENT, "buffer is NULL");
} else if (0 < reserved_columns_.count()) {
OB_LOG(ERROR, "row store with reserved columns should not be cloned");
OB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "row store with reserved columns should not be cloned");
} else if (OB_UNLIKELY(buffer_length < get_meta_size())) {
OB_LOG(WARN, "invalid buffer length", K(buffer_length), K(get_meta_size()));
OB_LOG_RET(WARN, OB_INVALID_ARGUMENT, "invalid buffer length", K(buffer_length), K(get_meta_size()));
} else {
copy = new(buffer) ObRowStore();
if (OB_ISNULL(copy)) {
OB_LOG(WARN, "fail to new ObRowStore", K(copy));
OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "fail to new ObRowStore", K(copy));
} else {
used_length += get_meta_size();
copy->is_read_only_ = true;
@ -927,20 +927,20 @@ ObRowStore *ObRowStore::clone(char *buffer, int64_t buffer_length) const
used_length += sz;
if (OB_UNLIKELY(buffer_length < used_length)) {
copy = NULL;
OB_LOG(WARN, "invalid buffer length", K(buffer_length), K(used_length));
OB_LOG_RET(WARN, OB_INVALID_ARGUMENT, "invalid buffer length", K(buffer_length), K(used_length));
break;
}
MEMCPY(buffer, bip, sz);
tmp = new(buffer) BlockInfo(sz);
if (OB_ISNULL(tmp)) {
OB_LOG(WARN, "fail to new BlockInfo");
OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "fail to new BlockInfo");
copy = NULL;
break;
} else {
tmp->set_curr_data_pos(bip->get_curr_data_pos());
int64_t tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = copy->blocks_.add_last(tmp))) {
OB_LOG(WARN, "fail to add last to block", K(tmp_ret));
OB_LOG_RET(WARN, tmp_ret, "fail to add last to block", K(tmp_ret));
copy = NULL;
break;
} else {

View File

@ -255,7 +255,7 @@ inline int64_t ObRowkey::get_deep_copy_size() const
if (OB_UNLIKELY(!is_legal())) {
tmp_ret = OB_INVALID_DATA;
COMMON_LOG(ERROR, "illegal rowkey.",
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "illegal rowkey.",
KP_(obj_ptr), K_(obj_cnt), K(tmp_ret));
} else {
for (int64_t i = 0; i < obj_cnt_; ++i) {

View File

@ -130,10 +130,10 @@ const ObRowkeyColumn *ObRowkeyInfo::get_column(const int64_t index) const
int tmp_ret = OB_SUCCESS;
if (OB_UNLIKELY(index < 0 || index >= size_)) {
tmp_ret = OB_INVALID_ARGUMENT;
COMMON_LOG(WARN, "Invalid argument.", K(index), K_(size), K(tmp_ret));
COMMON_LOG_RET(WARN, tmp_ret, "Invalid argument.", K(index), K_(size), K(tmp_ret));
} else if (!is_valid()) {
tmp_ret = OB_INVALID_DATA;
COMMON_LOG(WARN, "columns has not initialized.",
COMMON_LOG_RET(WARN, tmp_ret, "columns has not initialized.",
KP_(columns), K_(size), K(index), K(tmp_ret));
} else {
ret = &columns_[index];

View File

@ -32,7 +32,7 @@ ObStoreRowkey ObStoreRowkey::MAX_STORE_ROWKEY(&ObStoreRowkey::MAX_OBJECT, 1);
//now it is used in liboblog,which is OK as liboblog only tests equality
ObRowkey ObStoreRowkey::to_rowkey() const
{
COMMON_LOG(WARN, "converting ObStoreRowkey to ObRowkey, potentially dangerous!");
COMMON_LOG_RET(WARN, OB_SUCCESS, "converting ObStoreRowkey to ObRowkey, potentially dangerous!");
return key_;
}

View File

@ -108,7 +108,7 @@ public:
free_iocbs_.destroy();
if (OB_NOT_NULL(first_iocb_)) {
if (OB_ISNULL(allocator_)) {
STORAGE_LOG(ERROR, "allocator is nullptr!!!", K_(is_inited), KP_(allocator), KP_(first_iocb));
STORAGE_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "allocator is nullptr!!!", K_(is_inited), KP_(allocator), KP_(first_iocb));
} else {
allocator_->free(first_iocb_);
}
@ -147,7 +147,7 @@ public:
free_iocbs_.push(ptr);
} else {
if (OB_ISNULL(allocator_)) {
STORAGE_LOG(ERROR, "allocator is nullptr!!!", K_(is_inited), KP_(allocator), KP_(first_iocb), KP(ptr));
STORAGE_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "allocator is nullptr!!!", K_(is_inited), KP_(allocator), KP_(first_iocb), KP(ptr));
} else {
allocator_->free(ptr);
}

View File

@ -190,6 +190,7 @@ ob_set_subtarget(oblib_lib oblog
oblog/ob_log_time_fmt.cpp
oblog/ob_trace_log.cpp
oblog/ob_warning_buffer.cpp
oblog/ob_syslog_rate_limiter.cpp
)

View File

@ -415,7 +415,7 @@ int64_t BlockSet::sync_wash(int64_t wash_size)
result = ::madvise(data, len, MADV_DONTNEED);
} while (result == -1 && errno == EAGAIN);
if (-1 == result) {
_OB_LOG(WARN, "madvise failed, errno: %d", errno);
_OB_LOG_RET(WARN, OB_ERR_SYS, "madvise failed, errno: %d", errno);
has_ignore = true;
} else {
take_off_free_block(block, cls, chunk);

View File

@ -60,7 +60,7 @@ void do_with_segv_catch(Function &&func, bool &has_segv, decltype(func()) &ret)
} else if (1 == js) {
has_segv = true;
} else {
LOG_ERROR("unexpected error!!!", K(js));
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "unexpected error!!!", K(js));
ob_abort();
}
get_signal_handler() = handler_bak;
@ -92,7 +92,7 @@ ObMemoryDump &ObMemoryDump::get_instance()
{
static ObMemoryDump the_one;
if (OB_UNLIKELY(!the_one.is_inited()) && REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
LOG_WARN("memory dump not init");
LOG_WARN_RET(OB_NOT_INIT, "memory dump not init");
}
return the_one;
}

View File

@ -29,7 +29,7 @@ void *ObTenantCtxAllocator::alloc(const int64_t size, const ObMemAttr &attr)
SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range
abort_unless(attr.tenant_id_ == tenant_id_);
abort_unless(attr.ctx_id_ == ctx_id_);
BACKTRACE(WARN, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME ALLOC]size:%ld", size);
BACKTRACE_RET(WARN, OB_INVALID_ARGUMENT, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME ALLOC]size:%ld", size);
void *ptr = NULL;
AObject *obj = obj_mgr_.alloc_object(size, attr);
if(OB_ISNULL(obj) && g_alloc_failed_ctx().need_wash()) {
@ -43,8 +43,9 @@ void *ObTenantCtxAllocator::alloc(const int64_t size, const ObMemAttr &attr)
SANITY_POISON((void*)upper_align((int64_t)obj->data_ + obj->alloc_bytes_, 8), sizeof(AOBJECT_TAIL_MAGIC_CODE));
}
if (NULL == ptr && REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
_OB_LOG(WARN, "[OOPS] alloc failed reason: %s", alloc_failed_msg());
_OB_LOG(WARN, "oops, alloc failed, tenant_id=%ld, ctx_id=%ld, ctx_name=%s, ctx_hold=%ld, "
const char *msg = alloc_failed_msg();
LOG_DBA_WARN(OB_ALLOCATE_MEMORY_FAILED, "[OOPS]", "alloc failed reason", KCSTRING(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",
tenant_id_, ctx_id_,
common::get_global_ctx_info().get_ctx_name(ctx_id_),
@ -67,7 +68,7 @@ void* ObTenantCtxAllocator::realloc(const void *ptr, const int64_t size, const O
SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range
void *nptr = NULL;
AObject *obj = NULL;
BACKTRACE(WARN, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME REALLOC]size:%ld", size);
BACKTRACE_RET(WARN, OB_INVALID_ARGUMENT, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME REALLOC]size:%ld", size);
if (NULL != ptr) {
obj = reinterpret_cast<AObject*>((char*)ptr - AOBJECT_HEADER_SIZE);
abort_unless(obj->is_valid());
@ -87,8 +88,9 @@ void* ObTenantCtxAllocator::realloc(const void *ptr, const int64_t size, const O
SANITY_UNPOISON(obj->data_, obj->alloc_bytes_);
SANITY_POISON((void*)upper_align((int64_t)obj->data_ + obj->alloc_bytes_, 8), sizeof(AOBJECT_TAIL_MAGIC_CODE));
} else if (REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
_OB_LOG(WARN, "[OOPS] alloc failed reason: %s", alloc_failed_msg());
_OB_LOG(WARN, "oops, alloc failed, tenant_id=%ld, ctx_id=%ld, ctx_name=%s, ctx_hold=%ld, "
const char *msg = alloc_failed_msg();
LOG_DBA_WARN(OB_ALLOCATE_MEMORY_FAILED, "[OOPS]", "alloc failed reason", KCSTRING(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",
tenant_id_, ctx_id_,
common::get_global_ctx_info().get_ctx_name(ctx_id_),
@ -297,7 +299,7 @@ void ObTenantCtxAllocator::free_chunk(AChunk *chunk, const ObMemAttr &attr)
push_chunk(chunk);
} else {
if (!resource_handle_.is_valid()) {
LIB_LOG(ERROR, "resource_handle is invalid", K_(tenant_id), K_(ctx_id));
LIB_LOG_RET(ERROR, OB_INVALID_ERROR, "resource_handle is invalid", K_(tenant_id), K_(ctx_id));
} else {
resource_handle_.get_memory_mgr()->free_chunk(chunk, attr);
}
@ -308,7 +310,7 @@ bool ObTenantCtxAllocator::update_hold(const int64_t size)
{
bool update = false;
if (!resource_handle_.is_valid()) {
LIB_LOG(ERROR, "resource_handle is invalid", K_(tenant_id), K_(ctx_id));
LIB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "resource_handle is invalid", K_(tenant_id), K_(ctx_id));
} else {
bool reach_ctx_limit = false;
if (size <=0) {

View File

@ -31,7 +31,7 @@ const static int BT_BUF_LEN = 256;
void __attribute__((weak)) has_unfree_callback(char *info)
{
_OB_LOG(ERROR, "HAS UNFREE PTR!!! %s", info);
_OB_LOG_RET(ERROR, OB_ERROR, "HAS UNFREE PTR!!! %s", info);
}
ObjectSet::ObjectSet(__MemoryContext__ *mem_context, const uint32_t ablock_size)

View File

@ -52,8 +52,8 @@ void *ObAllocator::alloc(const int64_t size, const ObMemAttr &attr)
if (OB_UNLIKELY(nullptr == obj) && REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
auto ta = lib::ObMallocAllocator::get_instance()->get_tenant_ctx_allocator(attr_.tenant_id_,
attr_.ctx_id_);
_OB_LOG(WARN, "[OOPS] alloc failed reason: %s", alloc_failed_msg());
_OB_LOG(WARN, "oops, alloc failed, tenant_id=%ld, ctx_id=%ld, ctx_name=%s, ctx_hold=%ld, "
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "[OOPS] alloc failed reason: %s", alloc_failed_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_,
common::get_global_ctx_info().get_ctx_name(inner_attr.ctx_id_),

View File

@ -99,7 +99,7 @@ private:
if (OB_NOT_NULL(ta)) {
ta->get_block_mgr().free_block(block);
} else {
OB_LOG(ERROR, "tenant ctx allocator is null", K(tenant_id_), K(ctx_id_));
OB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "tenant ctx allocator is null", K(tenant_id_), K(ctx_id_));
}
}
virtual int64_t sync_wash(int64_t wash_size) override

View File

@ -37,7 +37,7 @@ public:
if (!ignore_mem_limit && used_after_alloc > limit_) {
ATOMIC_AAF(&hold_, -size);
if (REACH_TIME_INTERVAL(1000 * 1000)) {
_OB_LOG(WARN, "block alloc over limit, limit=%ld alloc_size=%ld", limit_, size);
_OB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "block alloc over limit, limit=%ld alloc_size=%ld", limit_, size);
}
} else if (NULL == (ret = (void*)ob_malloc(size, attr))) {
ATOMIC_AAF(&hold_, -size);

View File

@ -62,7 +62,7 @@ ObCachedAllocator<T>::~ObCachedAllocator()
--cached_count_;
}
if (0 != allocated_count_ || 0 != cached_count_) {
LIB_LOG(WARN, "some allocated object is not freed",
LIB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "some allocated object is not freed",
K(allocated_count_), K(cached_count_));
}
}
@ -75,7 +75,7 @@ T *ObCachedAllocator<T>::alloc()
if (OB_SUCCESS != cached_objs_.pop_back(ret)) {
void *p = pool_.alloc();
if (OB_ISNULL(p)) {
LIB_LOG(ERROR, "no memory");
LIB_LOG_RET(ERROR, OB_ALLOCATE_MEMORY_FAILED, "no memory");
} else {
ret = new(p) T();
++ allocated_count_;

View File

@ -94,7 +94,7 @@ void *ObDelayFreeAllocator::alloc(const int64_t size)
int64_t data_size = size + sizeof(DataMeta);
if (!inited_) {
LIB_ALLOC_LOG(WARN, "The ObBlockLinkMemoryAllocator has not been inited.");
LIB_ALLOC_LOG_RET(WARN, OB_NOT_INIT, "The ObBlockLinkMemoryAllocator has not been inited.");
} else {
//alloc memory
lib::ObMutexGuard guard(mutex_);
@ -105,13 +105,13 @@ void *ObDelayFreeAllocator::alloc(const int64_t size)
}
if (NULL == block) {
LIB_ALLOC_LOG(ERROR, "cannot malloc first meta memory block.");
LIB_ALLOC_LOG_RET(ERROR, OB_ERROR, "cannot malloc first meta memory block.");
} else if (data_size <= block->remain()) {
ptr_ret = block->alloc(data_size);
} else if (NULL != (block = alloc_block(data_size))) {
ptr_ret = block->alloc(data_size);
} else {
LIB_ALLOC_LOG(ERROR, "cannot malloc memory ", "size", size);
LIB_ALLOC_LOG_RET(ERROR, OB_ALLOCATE_MEMORY_FAILED, "cannot malloc memory ", "size", size);
}
// set meta value
@ -128,16 +128,16 @@ void *ObDelayFreeAllocator::alloc(const int64_t size)
void ObDelayFreeAllocator::free(void *ptr)
{
if (!inited_) {
LIB_ALLOC_LOG(WARN, "The ObBlockLinkMemoryAllocator has not been inited.");
LIB_ALLOC_LOG_RET(WARN, OB_NOT_INIT, "The ObBlockLinkMemoryAllocator has not been inited.");
} else if (NULL == ptr) {
LIB_ALLOC_LOG(WARN, "the free ptr is NULL");
LIB_ALLOC_LOG_RET(WARN, OB_ERROR, "the free ptr is NULL");
} else {
lib::ObMutexGuard guard(mutex_);
DataMeta *meta = reinterpret_cast<DataMeta *>(ptr) - 1;
ObDelayFreeMemBlock *block = meta->mem_block_;
if (NULL == block) {
LIB_ALLOC_LOG(ERROR, "the free ptr has null mem block ptr");
LIB_ALLOC_LOG_RET(ERROR, OB_ERROR, "the free ptr has null mem block ptr");
} else {
if (meta->data_len_ > 0) {
memory_fragment_size_ += meta->data_len_;
@ -192,9 +192,9 @@ ObDelayFreeMemBlock *ObDelayFreeAllocator::alloc_block(const int64_t data_size)
}
if (NULL == (ptr = static_cast<char *>(allocator_.alloc(mem_block_size)))) {
LIB_ALLOC_LOG(ERROR, "cannot malloc memory of ", "mem_block_size", mem_block_size);
LIB_ALLOC_LOG_RET(ERROR, OB_ALLOCATE_MEMORY_FAILED, "cannot malloc memory of ", "mem_block_size", mem_block_size);
} else if (NULL == (block_ret = new(ptr) ObDelayFreeMemBlock(ptr + mem_block_size))) {
LIB_ALLOC_LOG(ERROR, "placement new for MemBlock failed.");
LIB_ALLOC_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "placement new for MemBlock failed.");
} else {
total_size_ += mem_block_size;
}
@ -210,7 +210,7 @@ ObDelayFreeMemBlock *ObDelayFreeAllocator::alloc_block(const int64_t data_size)
void ObDelayFreeAllocator::free_block(ObDelayFreeMemBlock *block)
{
if (NULL == block) {
LIB_ALLOC_LOG(WARN, "The free block is NULL.");
LIB_ALLOC_LOG_RET(WARN, OB_ERR_UNEXPECTED, "The free block is NULL.");
} else {
working_list_.remove(block);
free_list_.add_last(block);

View File

@ -196,16 +196,16 @@ void ObFIFOAllocator::reset()
} else if (OB_LIKELY(1 == current_using_->ref_count_)) {
allocator_->free(current_using_);
} else {
LOG_ERROR("current_using_ is still used now",
LOG_ERROR_RET(OB_ERROR, "current_using_ is still used now",
"ref_count", current_using_->ref_count_, KP(current_using_));
}
DLIST_FOREACH_NORET(iter, using_page_list_) {
auto *page = iter->get_data();
LOG_ERROR("dump using page list: ", KP(page));
LOG_ERROR_RET(OB_ERROR, "dump using page list: ", KP(page));
}
DLIST_FOREACH_NORET(iter, special_page_list_) {
auto *page = iter->get_data();
LOG_ERROR("dump special page list: ", KP(page));
LOG_ERROR_RET(OB_ERROR, "dump special page list: ", KP(page));
}
using_page_list_.clear();
current_using_ = nullptr;
@ -220,7 +220,7 @@ ObFIFOAllocator::BasePageHeader *ObFIFOAllocator::get_page_header(void *p)
{
BasePageHeader *page_header = nullptr;
if (OB_ISNULL(p)) {
LOG_ERROR("invalid argument");
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "invalid argument");
} else {
AllocHeader *alloc_header = static_cast<AllocHeader *>(p) - 1;
page_header = alloc_header->page_header_;
@ -233,14 +233,14 @@ bool ObFIFOAllocator::check_param(const int64_t size, const int64_t align)
{
bool bool_ret = true;
if (align <= 0 || align > page_size_ / 2) {
LOG_WARN("align is negative or too big. ", K(align));
LOG_WARN_RET(OB_ERROR, "align is negative or too big. ", K(align));
bool_ret = false;
} else if (0 != (align & (align - 1))) {
LOG_WARN("align should be 2^K. ", K(align));
LOG_WARN_RET(OB_ERROR, "align should be 2^K. ", K(align));
bool_ret = false;
} else if (size <= 0 || size >= INT32_MAX) {
// size shold < 4G, bcs we store @size at 4Bytes in alloc header.
LOG_WARN("size should be positive and not to big.", K(size));
LOG_WARN_RET(OB_ERROR, "size should be positive and not to big.", K(size));
bool_ret = false;
} else {
bool_ret = true;
@ -253,7 +253,7 @@ bool ObFIFOAllocator::check_magic(void *p, int64_t &size)
{
bool bool_ret = true;
if (OB_ISNULL(p)) {
LOG_WARN("invalid argument");
LOG_WARN_RET(OB_INVALID_ARGUMENT, "invalid argument");
} else {
AllocHeader *alloc_header = static_cast<AllocHeader *>(p) - 1;
size = alloc_header->size_;
@ -261,12 +261,12 @@ bool ObFIFOAllocator::check_magic(void *p, int64_t &size)
bool_ret = true;
alloc_header->magic_num_ = ALREADY_FREE;
} else if (alloc_header->magic_num_ == ALREADY_FREE) {
LOG_ERROR("Detect double free at address ", "addr", p);
LOG_ERROR_RET(OB_ERROR, "Detect double free at address ", "addr", p);
bool_ret = false;
} else {
// This means parameter address in free(void* p) is not a pointer
// allocated by FIFOAllocator OR there is an overwrite
LOG_ERROR("check allocation magic fail", "free address", p);
LOG_ERROR_RET(OB_ERROR, "check allocation magic fail", "free address", p);
bool_ret = false;
}
}
@ -294,9 +294,9 @@ void *ObFIFOAllocator::alloc_align(const int64_t size, const int64_t align, cons
ObLockGuard<ObSpinLock> guard(lock_);
void *ptr = nullptr;
if (OB_UNLIKELY(!is_inited_)) {
LOG_WARN("ObFIFOAllocator not init");
LOG_WARN_RET(OB_NOT_INIT, "ObFIFOAllocator not init");
} else if (!check_param(size, align)) {
LOG_WARN("ObFIFOAllocator alloc(size, align) parameter Error.", K(size), K(align));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "ObFIFOAllocator alloc(size, align) parameter Error.", K(size), K(align));
} else if (is_normal_page_enough(size, align)) {
ptr = alloc_normal(size, align, attr);
} else {
@ -310,7 +310,7 @@ void *ObFIFOAllocator::alloc_align(const int64_t size, const int64_t align, cons
void ObFIFOAllocator::alloc_new_normal_page(const ObMemAttr &attr)
{
if (IS_NOT_INIT || OB_ISNULL(allocator_)) {
LOG_ERROR("ObFIFOAllocator not init");
LOG_ERROR_RET(OB_NOT_INIT, "ObFIFOAllocator not init");
} else {
NormalPageHeader *new_page = nullptr;
if (free_page_list_.get_size() > 0) {
@ -322,7 +322,7 @@ void ObFIFOAllocator::alloc_new_normal_page(const ObMemAttr &attr)
if (OB_NOT_NULL(ptr)) {
new_page = new (ptr) NormalPageHeader();
} else {
LOG_WARN("underlying allocator return nullptr");
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "underlying allocator return nullptr");
}
}
}
@ -331,7 +331,7 @@ void ObFIFOAllocator::alloc_new_normal_page(const ObMemAttr &attr)
new_page->offset_ = reinterpret_cast<char *>(new_page) + sizeof(NormalPageHeader);
current_using_->ref_count_--;
if (0 == current_using_->ref_count_) {
LOG_ERROR("current_using_->ref_count_ is 0. This could not happen.");
LOG_ERROR_RET(OB_ERROR, "current_using_->ref_count_ is 0. This could not happen.");
}
// we do NOT link current using into page_using_list.
// bcs current_using_ may be not used indeed.
@ -348,7 +348,7 @@ void *ObFIFOAllocator::try_alloc(int64_t size, int64_t align)
{
char *ptr = nullptr;
if (nullptr == current_using_) {
LOG_ERROR("current_using_ is null");
LOG_ERROR_RET(OB_ERROR, "current_using_ is null");
} else {
abort_unless(PAGE_HEADER == current_using_->magic_num_);
char *offset = current_using_->offset_;
@ -375,18 +375,18 @@ void ObFIFOAllocator::free(void *p)
{
ObLockGuard<ObSpinLock> guard(lock_);
if (OB_UNLIKELY(!is_inited_)) {
LOG_ERROR("ObFIFOAllocator not init");
LOG_ERROR_RET(OB_NOT_INIT, "ObFIFOAllocator not init");
} else {
int64_t size = 0;
if (nullptr == p) {
LOG_ERROR("user try to free nullptr Pointer");
LOG_ERROR_RET(OB_ERROR, "user try to free nullptr Pointer");
} else {
if (!check_magic(p, size)) {
LOG_ERROR("Error, check magic number error.");
LOG_ERROR_RET(OB_ERROR, "Error, check magic number error.");
} else {
BasePageHeader *page_header = get_page_header(p);
if (OB_ISNULL(page_header)) {
LOG_ERROR("page_header is null");
LOG_ERROR_RET(OB_ERROR, "page_header is null");
} else {
if (SPECIAL_FLAG == page_header->flag_) { // this is special page
SpecialPageHeader *special_page = static_cast<SpecialPageHeader *>(page_header);
@ -406,14 +406,14 @@ void *ObFIFOAllocator::alloc_normal(int64_t size, int64_t align, const ObMemAttr
void *ptr = nullptr;
void *new_space = nullptr;
if (OB_UNLIKELY(!is_inited_) || OB_UNLIKELY(nullptr == allocator_)) {
LOG_ERROR("ObFIFOAllocator not init");
LOG_ERROR_RET(OB_NOT_INIT, "ObFIFOAllocator not init");
} else {
if (nullptr == current_using_) {
if (total() + page_size_ <= max_size_) {
new_space = allocator_->alloc(page_size_, attr);
}
if (nullptr == new_space) {
LOG_WARN("can not allocate new page", K(page_size_));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "can not allocate new page", K(page_size_));
} else {
current_using_ = new (new_space) NormalPageHeader();
current_using_->offset_ = reinterpret_cast<char *>(current_using_) + sizeof(NormalPageHeader);
@ -474,9 +474,9 @@ void *ObFIFOAllocator::alloc_special(int64_t size, int64_t align, const ObMemAtt
void *ptr = NULL;
if (OB_UNLIKELY(!is_inited_) || OB_UNLIKELY(NULL == allocator_)) {
LOG_ERROR("ObFIFOAllocator not init", K(is_inited_));
LOG_ERROR_RET(OB_NOT_INIT, "ObFIFOAllocator not init", K(is_inited_));
} else if (OB_UNLIKELY(size <= 0) || OB_UNLIKELY(align <= 0)) {
LOG_ERROR("invalid argument", K(size), K(align));
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "invalid argument", K(size), K(align));
} else {
// we have to alloc up to @real_size bytes.
// these bytes may be before (align 1) AND after user data (align 2).
@ -484,7 +484,7 @@ void *ObFIFOAllocator::alloc_special(int64_t size, int64_t align, const ObMemAtt
int64_t real_size = size + sizeof(SpecialPageHeader) + sizeof(AllocHeader) + align - 1;
void *new_space = allocator_->alloc(real_size, attr);
if (NULL == new_space) {
LOG_WARN("can not alloc a page from underlying allocator", K(real_size));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "can not alloc a page from underlying allocator", K(real_size));
} else {
ptr = reinterpret_cast<void *>(upper_align(reinterpret_cast<int64_t>(static_cast<char *>
(new_space) + sizeof(SpecialPageHeader) + sizeof(AllocHeader)), align));

View File

@ -406,7 +406,7 @@ template<int64_t SIZE>
void ObFixedSizeBlockMemoryContext<SIZE>::destroy()
{
if (0 != used_block_num_) {
COMMON_LOG(ERROR, "not all block be freed, potential memory leak!", K(used_block_num_));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "not all block be freed, potential memory leak!", K(used_block_num_));
}
used_block_num_ = 0;
is_inited_ = false;

View File

@ -52,7 +52,7 @@ void HazardRef::release_ref(uint64_t *ref)
void HazardNodeList::push(HazardNode *node)
{
if (OB_ISNULL(node) || OB_ISNULL(tail_)) {
_OB_LOG(WARN, "invalid node");
_OB_LOG_RET(WARN, OB_INVALID_ARGUMENT, "invalid node");
} else {
count_++;
node->next_ = tail_->next_;
@ -75,4 +75,4 @@ void RetireList::set_retire_version(uint64_t version)
retire_list->prepare_list_.set_version(version);
retire_list->retire_list_.concat(retire_list->prepare_list_);
}
}
}

View File

@ -41,7 +41,7 @@ void *common::ob_easy_realloc(void *ptr, size_t size)
ret = ob_realloc(ptr, size, attr);
}
if (ret == NULL) {
_OB_LOG(WARN, "ob_tc_realloc failed, ptr:%p, size:%lu", ptr, size);
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "ob_tc_realloc failed, ptr:%p, size:%lu", ptr, size);
}
} else if (ptr) {
ob_free(ptr);

View File

@ -64,7 +64,7 @@ void *oceanbase::common::ob_malloc_align(const int64_t alignment, const int64_t
}
int64_t padding = align_ptr - ptr;
if (!(padding <= alignment && padding > 0)) {
_OB_LOG(ERROR, "invalid padding(padding=%ld, alignment=%ld", padding, alignment);
_OB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "invalid padding(padding=%ld, alignment=%ld", padding, alignment);
}
uint8_t *sign_ptr = reinterpret_cast<uint8_t *>(align_ptr - 1);
int64_t *header_ptr = reinterpret_cast<int64_t *>(align_ptr - 1 - sizeof(int64_t));
@ -75,7 +75,7 @@ void *oceanbase::common::ob_malloc_align(const int64_t alignment, const int64_t
*header_ptr = padding;
}
} else {
_OB_LOG(WARN, "ob_tc_malloc allocate memory failed, alignment[%ld], nbyte[%ld], label[%s].",
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "ob_tc_malloc allocate memory failed, alignment[%ld], nbyte[%ld], label[%s].",
alignment, nbyte, (const char *)label);
}
return align_ptr;
@ -94,7 +94,7 @@ void *oceanbase::common::ob_malloc_align(const int64_t alignment, const int64_t
}
int64_t padding = align_ptr - ptr;
if (!(padding <= alignment && padding > 0)) {
_OB_LOG(ERROR, "invalid padding(padding=%ld, alignment=%ld", padding, alignment);
_OB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "invalid padding(padding=%ld, alignment=%ld", padding, alignment);
}
uint8_t *sign_ptr = reinterpret_cast<uint8_t *>(align_ptr - 1);
int64_t *header_ptr = reinterpret_cast<int64_t *>(align_ptr - 1 - sizeof(int64_t));
@ -105,7 +105,7 @@ void *oceanbase::common::ob_malloc_align(const int64_t alignment, const int64_t
*header_ptr = padding;
}
} else {
_OB_LOG(WARN, "ob_tc_malloc allocate memory failed, alignment[%ld], nbyte[%ld], tenant_id[%lu], label[%s].",
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "ob_tc_malloc allocate memory failed, alignment[%ld], nbyte[%ld], tenant_id[%lu], label[%s].",
alignment, nbyte, attr.tenant_id_, (const char*)attr.label_);
}
return align_ptr;
@ -114,7 +114,7 @@ void *oceanbase::common::ob_malloc_align(const int64_t alignment, const int64_t
void oceanbase::common::ob_free_align(void *ptr)
{
if (NULL == ptr) {
_OB_LOG(WARN, "cannot free NULL pointer.");
_OB_LOG_RET(WARN, OB_INVALID_ARGUMENT, "cannot free NULL pointer.");
} else if (oceanbase::lib::ObMallocAllocator::is_inited_) {
uint8_t *sign_ptr = reinterpret_cast<uint8_t *>(static_cast<char *>(ptr) - 1);
int64_t *header_ptr = reinterpret_cast<int64_t *>(static_cast<char *>(ptr) - 1 - sizeof(int64_t));

View File

@ -37,7 +37,7 @@ inline void *ob_malloc(const int64_t nbyte, const ObMemAttr &attr = default_mema
if (!OB_ISNULL(allocator)) {
ptr = allocator->alloc(nbyte, attr);
if (OB_ISNULL(ptr)) {
LIB_LOG(WARN, "allocate memory fail", K(attr), K(nbyte));
LIB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "allocate memory fail", K(attr), K(nbyte));
}
}
return ptr;
@ -61,7 +61,7 @@ inline void *ob_realloc(void *ptr, const int64_t nbyte, const ObMemAttr &attr)
if (!OB_ISNULL(allocator)) {
nptr = allocator->realloc(ptr, nbyte, attr);
if (OB_ISNULL(nptr)) {
LIB_LOG(ERROR, "allocate memory fail", K(attr), K(nbyte));
LIB_LOG_RET(ERROR, OB_ALLOCATE_MEMORY_FAILED, "allocate memory fail", K(attr), K(nbyte));
}
}
}

View File

@ -17,7 +17,7 @@ namespace oceanbase
{
namespace common
{
lib::ObSimpleRateLimiter ObMemLeakChecker::rl_ = {INT64_MAX};
ObSimpleRateLimiter ObMemLeakChecker::rl_{INT64_MAX};
constexpr const char ObMemLeakChecker::MOD_INFO_MAP_STR[];
} // end of namespace common

View File

@ -15,7 +15,6 @@
#include "lib/utility/ob_defer.h"
#include "lib/hash/ob_hashmap.h"
#include "lib/alloc/alloc_struct.h"
#include "lib/utility/ob_simple_rate_limiter.h"
namespace oceanbase
@ -282,7 +281,7 @@ private:
int len_;
mod_alloc_info_t malloc_info_;
private:
static lib::ObSimpleRateLimiter rl_;
static ObSimpleRateLimiter rl_;
};
}; // end namespace common
}; // end namespace oceanbase

View File

@ -80,7 +80,7 @@ AChunk *ObPageManagerCenter::alloc_from_thread_local_cache(int64_t tenant_id, in
if (OB_SUCCESS == tmpret) {
ret = alloc_from_thread_local_cache_(tenant_id, ctx_id);
if (OB_SUCCESS != (tmpret = mutex_.unlock())) {
OB_LOG(ERROR, "unlock failed", K(tmpret));
OB_LOG_RET(ERROR, tmpret, "unlock failed", K(tmpret));
}
}
return ret;

View File

@ -208,7 +208,7 @@ inline ABlock *ObPageManager::alloc_block(uint64_t size, const ObMemAttr &attr)
inline void ObPageManager::free_block(ABlock *block)
{
if (OB_UNLIKELY(get_itid() != itid_)) {
_OB_LOG(ERROR, "cross thread not supported, pm_tid: %ld, cur_tid: %ld", itid_, get_itid());
_OB_LOG_RET(ERROR, OB_ERROR, "cross thread not supported, pm_tid: %ld, cur_tid: %ld", itid_, get_itid());
} else if (OB_LIKELY(block != nullptr)) {
abort_unless(block);
abort_unless(block->is_valid());

View File

@ -67,7 +67,7 @@ T *ObPooledAllocator<T, BlockAllocatorT, LockT>::alloc()
T *ret = NULL;
void *p = the_pool_.alloc();
if (OB_ISNULL(p)) {
LIB_LOG(ERROR, "no memory");
LIB_LOG_RET(ERROR, OB_ALLOCATE_MEMORY_FAILED, "no memory");
} else {
ret = new(p) T();
}

View File

@ -41,7 +41,7 @@ public:
int64_t idx = get_itid() % MAX_REF_CNT;
const int64_t new_ref = add_ref(idx, 1);
if (OB_UNLIKELY(0 >= new_ref)) {
COMMON_LOG(ERROR, "unexpected ref", K(new_ref), K(idx));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "unexpected ref", K(new_ref), K(idx));
}
return idx;
}
@ -53,7 +53,7 @@ public:
{
const int64_t new_ref = add_ref(idx, -1);
if (OB_UNLIKELY(0 > new_ref)) {
COMMON_LOG(ERROR, "unexpected ref", K(new_ref), K(idx));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "unexpected ref", K(new_ref), K(idx));
}
}
void sync()
@ -169,7 +169,7 @@ public:
int64_t idx = get_itid() % ref_num_;
const int64_t new_ref = add_ref(idx, 1);
if (OB_UNLIKELY(0 >= new_ref)) {
COMMON_LOG(ERROR, "unexpected ref", K(new_ref), K(idx));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "unexpected ref", K(new_ref), K(idx));
}
return idx;
}
@ -181,7 +181,7 @@ public:
{
const int64_t new_ref = add_ref(idx, -1);
if (OB_UNLIKELY(0 > new_ref)) {
COMMON_LOG(ERROR, "unexpected ref", K(new_ref), K(idx));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "unexpected ref", K(new_ref), K(idx));
}
}
void sync()

View File

@ -45,7 +45,7 @@ public:
slot_id = (slot_id + 1) % MAX_QCLOCK_SLOT_NUM;
if (OB_UNLIKELY(begin_id == slot_id)) {
if (REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
COMMON_LOG(ERROR, "QClock slot maybe not enough", K(begin_id), K(MAX_QCLOCK_SLOT_NUM));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "QClock slot maybe not enough", K(begin_id), K(MAX_QCLOCK_SLOT_NUM));
}
}
}

View File

@ -19,7 +19,7 @@ namespace common {
void ObBlockSlicer::print_leak_slice() {
if (OB_ISNULL(slice_alloc_)) {
LIB_LOG(WARN, "invalid slice allocator", KP(this));
LIB_LOG_RET(WARN, OB_ERR_UNEXPECTED, "invalid slice allocator", KP(this));
return;
}
@ -38,7 +38,7 @@ void ObBlockSlicer::print_leak_slice() {
if (flist_.is_in_queue(item)) {
// this item has been freed
} else {
LIB_LOG(WARN, "leak info : ", KP(item), KP(slice));
LIB_LOG_RET(WARN, OB_SUCCESS, "leak info : ", KP(item), KP(slice));
}
}
}
@ -64,8 +64,9 @@ void ObSliceAlloc::destroy()
dlink = blk_list_.top();
} else {
blk->print_leak_slice();
_LIB_LOG(
ERROR, "there was memory leak, stock=%d, total=%d, remain=%d", blk->stock(), blk->total(), blk->remain());
_LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED,
"there was memory leak, stock=%d, total=%d, remain=%d",
blk->stock(), blk->total(), blk->remain());
dlink = nullptr; // break
}
}
@ -74,4 +75,4 @@ void ObSliceAlloc::destroy()
}
} // namespace common
} // namespace oceanbase
} // namespace oceanbase

View File

@ -319,7 +319,7 @@ public:
// slice_size is larger than block_size
tmp_ret = OB_ERR_UNEXPECTED;
if (REACH_TIME_INTERVAL(100 * 1000)) {
LIB_LOG(ERROR, "slice size is larger than block size, unexpected !", K(tmp_ret), K(isize_), K(slice_limit_));
LIB_LOG_RET(ERROR, tmp_ret, "slice size is larger than block size, unexpected !", K(tmp_ret), K(isize_), K(slice_limit_));
}
}
while(NULL == ret && OB_SUCCESS == tmp_ret) {
@ -370,7 +370,7 @@ public:
abort_unless(bsize_ != 0);
#else
if (this != blk->get_slice_alloc()) {
LIB_LOG(ERROR, "blk is freed or alloced by different slice_alloc", K(this), K(blk->get_slice_alloc()));
LIB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "blk is freed or alloced by different slice_alloc", K(this), K(blk->get_slice_alloc()));
return;
}
#endif

View File

@ -111,7 +111,7 @@ public:
destroy_block(old_blk);
} else {
// can not monitor all leak !!!
LIB_LOG(ERROR, "there was memory leak", K(old_blk->ref_));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "there was memory leak", K(old_blk->ref_));
}
}
}
@ -213,7 +213,7 @@ public:
abort_unless(bsize_ != 0);
#else
if (this != blk->get_vslice_alloc()) {
LIB_LOG(ERROR, "blk is freed or alloced by different vslice_alloc", K(this), K(blk->get_vslice_alloc()));
LIB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "blk is freed or alloced by different vslice_alloc", K(this), K(blk->get_vslice_alloc()));
return;
}
#endif

View File

@ -326,8 +326,9 @@ private: // helpers
total_ += sz;
++pages_;
} else {
_OB_LOG(WARN, "cannot allocate memory.sz=%ld, pages_=%ld,total_=%ld",
sz, pages_, total_);
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED,
"cannot allocate memory.sz=%ld, pages_=%ld,total_=%ld",
sz, pages_, total_);
}
return page;
@ -351,7 +352,8 @@ private: // helpers
} else {
page = alloc_new_page(sz);
if (NULL == page) {
_OB_LOG(WARN, "extend_page sz =%ld cannot alloc new page", sz);
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED,
"extend_page sz =%ld cannot alloc new page", sz);
} else {
insert_tail(page);
}
@ -466,7 +468,7 @@ public: // API
enable_sanity_(enable_sanity)
{
if (page_size < (int64_t)sizeof(Page)) {
_OB_LOG(ERROR, "invalid page size(page_size=%ld, page=%ld)", page_size,
_OB_LOG_RET(ERROR, OB_ERROR, "invalid page size(page_size=%ld, page=%ld)", page_size,
(int64_t)sizeof(Page));
}
}
@ -586,7 +588,7 @@ public: // API
T *ret = NULL;
void *tmp = (void *)alloc_aligned(sizeof(T));
if (NULL == tmp) {
_OB_LOG(WARN, "fail to alloc mem for T");
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "fail to alloc mem for T");
} else {
ret = new(tmp)T();
}

View File

@ -555,7 +555,7 @@ size_t ObCharset::scan_str(const char *str,
ObCharsetInfo *cs = &ob_charset_bin;
size_t result = 0;
if (OB_ISNULL(str) || OB_ISNULL(end) || OB_ISNULL(cs)) {
BACKTRACE(ERROR, true, "invalid argument. str = %p, end = %p, cs = %p", str, end, cs);
BACKTRACE_RET(ERROR, OB_INVALID_ARGUMENT, true, "invalid argument. str = %p, end = %p, cs = %p", str, end, cs);
} else {
result = cs->cset->scan(cs, str, end, sq);
}
@ -1060,11 +1060,11 @@ size_t ObCharset::charpos(const ObCollationType collation_type,
if (OB_UNLIKELY(collation_type <= CS_TYPE_INVALID ||
collation_type >= CS_TYPE_MAX) ||
OB_ISNULL(ObCharset::charset_arr[collation_type])) {
LOG_ERROR("unexpected error. invalid argument(s)", K(collation_type));
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid argument(s)", K(collation_type));
} else {
ObCharsetInfo *cs = static_cast<ObCharsetInfo *>(ObCharset::charset_arr[collation_type]);
if (OB_ISNULL(cs->cset)) {
LOG_ERROR("unexpected error. invalid argument(s)", K(cs), K(cs->cset));
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid argument(s)", K(cs), K(cs->cset));
} else {
res_pos = cs->cset->charpos(cs, str, str + str_len, length);
if (res_pos > str_len) {
@ -1478,7 +1478,7 @@ ObCharsetType ObCharset::charset_type(const char *cs_name)
{
ObCharsetType ct = CHARSET_INVALID;
if (OB_ISNULL(cs_name)) {
LOG_ERROR("unexpected error. invalid argument(s)",
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid argument(s)",
K(ct), KP(cs_name), K(ct));
} else {
ObString cs_name_str = ObString::make_string(cs_name);
@ -2413,7 +2413,7 @@ bool ObCharset::case_mode_equal(const ObNameCaseMode case_mode, const ObString &
bool is_equal = false;
if (OB_UNLIKELY(OB_NAME_CASE_INVALID >= case_mode ||
case_mode >= OB_NAME_CASE_MAX)) {
LOG_ERROR("unexpected error. invalid cast_mode",
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid cast_mode",
K(case_mode));
} else {
ObCollationType collation_type = CS_TYPE_INVALID;
@ -2496,7 +2496,7 @@ const ObCharsetInfo *ObCharset::get_charset(const ObCollationType collation_type
ObCharsetInfo *ret = NULL;
if (OB_UNLIKELY(collation_type <= CS_TYPE_INVALID ||
collation_type >= CS_TYPE_MAX)) {
LOG_ERROR("unexpected error. invalid argument(s)",
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid argument(s)",
K(collation_type));
} else {
ret = static_cast<ObCharsetInfo *>(ObCharset::charset_arr[collation_type]);
@ -2610,7 +2610,7 @@ inline bool ObCharset::is_argument_valid(const ObCharsetInfo *cs, const char *st
OB_ISNULL(cs->cset)) {
is_arg_valid = false;
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
BACKTRACE(ERROR, true, "invalid argument. charset info = %p, str = %p, str_len = %ld, extra_info=(%s)", cs, str, str_len, (NULL == extra_info) ? NULL : to_cstring(*extra_info));
BACKTRACE_RET(ERROR, OB_INVALID_ARGUMENT, true, "invalid argument. charset info = %p, str = %p, str_len = %ld, extra_info=(%s)", cs, str, str_len, (NULL == extra_info) ? NULL : to_cstring(*extra_info));
}
}
return is_arg_valid;
@ -2627,7 +2627,7 @@ inline bool ObCharset::is_argument_valid(const ObCollationType collation_type, c
(OB_ISNULL(str2) && OB_UNLIKELY(0 != str_len2))) {
is_arg_valid = false;
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
BACKTRACE(ERROR, true, "invalid argument."
BACKTRACE_RET(ERROR, OB_INVALID_ARGUMENT, true, "invalid argument."
"collation_type = %d,"
"str1 = %p,"
"str1_len = %ld,"
@ -2639,7 +2639,7 @@ inline bool ObCharset::is_argument_valid(const ObCollationType collation_type, c
ObCharsetInfo *cs = static_cast<ObCharsetInfo *>(ObCharset::charset_arr[collation_type]);
if (OB_ISNULL(cs->cset) || OB_ISNULL(cs->coll)) {
is_arg_valid = false;
BACKTRACE(ERROR, true, "invalid argument."
BACKTRACE_RET(ERROR, OB_INVALID_ARGUMENT, true, "invalid argument."
"collation_type = %d,"
"str1 = %p,"
"str1_len = %ld,"
@ -2861,7 +2861,7 @@ bool ObCharset::is_cs_nonascii(ObCollationType collation_type)
if (OB_UNLIKELY(collation_type <= CS_TYPE_INVALID ||
collation_type >= CS_TYPE_MAX) ||
OB_ISNULL(ObCharset::charset_arr[collation_type])) {
LOG_ERROR("unexpected error. invalid argument(s)",
LOG_ERROR_RET(OB_INVALID_ARGUMENT, "unexpected error. invalid argument(s)",
K(collation_type));
} else {
ObCharsetInfo *cs = static_cast<ObCharsetInfo *>(ObCharset::charset_arr[collation_type]);

View File

@ -1130,15 +1130,15 @@ uint64_t crc64_sse42_dispatch(uint64_t crc, const char *buf, int64_t len)
if (strcmp((char*)vendor_info, "GenuineIntel") == 0) {
ob_crc64_sse42_func = &ob_crc64_isal;
_OB_LOG(WARN, "Use ISAL for crc64 calculate");
_OB_LOG_RET(WARN, OB_SUCCESS, "Use ISAL for crc64 calculate");
} else{
asm("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1));
if ((c & (1 << 20)) != 0) {
ob_crc64_sse42_func = &crc64_sse42;
_OB_LOG(WARN, "Use CPU crc32 instructs for crc64 calculate");
_OB_LOG_RET(WARN, OB_SUCCESS, "Use CPU crc32 instructs for crc64 calculate");
} else {
ob_crc64_sse42_func = &fast_crc64_sse42_manually;
_OB_LOG(WARN, "Use manual crc32 table lookup for crc64 calculate");
_OB_LOG_RET(WARN, OB_SUCCESS, "Use manual crc32 table lookup for crc64 calculate");
}
}

View File

@ -442,7 +442,7 @@ inline T &Ob2DArray<T, max_block_size, BlockAllocatorT, auto_free,
BlockPointerArrayT>::at(int64_t idx)
{
if (OB_UNLIKELY(0 > idx || idx >= count_)) {
LIB_LOG(ERROR, "invalid idx. Fatal!!!", K(idx), K_(count));
LIB_LOG_RET(ERROR, OB_ARRAY_OUT_OF_RANGE, "invalid idx. Fatal!!!", K(idx), K_(count));
}
return *get_obj_pos(idx);
}
@ -454,7 +454,7 @@ inline const T &Ob2DArray<T, max_block_size, BlockAllocatorT, auto_free,
BlockPointerArrayT>::at(int64_t idx) const
{
if (OB_UNLIKELY(0 > idx || idx >= count_)) {
LIB_LOG(ERROR, "invalid idx. Fatal!!!", K(idx), K_(count));
LIB_LOG_RET(ERROR, OB_ARRAY_OUT_OF_RANGE, "invalid idx. Fatal!!!", K(idx), K_(count));
}
return *get_obj_pos(idx);
}

View File

@ -50,7 +50,7 @@ struct NotImplementItemEncode
UNUSED(buf_len);
UNUSED(pos);
UNUSED(item);
_OB_LOG(WARN, "call not implemented function.");
_OB_LOG_RET(WARN, OB_NOT_IMPLEMENT, "call not implemented function.");
return OB_NOT_IMPLEMENT;
}
@ -60,7 +60,7 @@ struct NotImplementItemEncode
UNUSED(data_len);
UNUSED(pos);
UNUSED(item);
_OB_LOG(WARN, "call not implemented function.");
_OB_LOG_RET(WARN, OB_NOT_IMPLEMENT, "call not implemented function.");
return OB_NOT_IMPLEMENT;
}
@ -327,7 +327,7 @@ T *ObArrayImpl<T, BlockAllocatorT, auto_free, CallBack, ItemEncode>::alloc_place
}
count_++;
} else {
_OB_LOG(WARN, "extend buf error, "
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "extend buf error, "
"count_=%ld, data_size_=%ld, (int64_t)sizeof(T)=%ld, data_size_/(int64_t)sizeof(T)=%ld",
count_, data_size_, static_cast<int64_t>(sizeof(T)), data_size_ / static_cast<int64_t>(sizeof(T)));
}
@ -444,19 +444,19 @@ ObArrayImpl<T, BlockAllocatorT, auto_free, CallBack, ItemEncode>
this->reset();
this->reserve(other.count());
if (OB_UNLIKELY(static_cast<uint64_t>(data_size_) < (sizeof(T)*other.count_))) {
_OB_LOG(ERROR, "no memory");
error_ = OB_ALLOCATE_MEMORY_FAILED;
_OB_LOG_RET(ERROR, error_, "no memory");
} else {
const int64_t assign = std::min(valid_count_, other.count_);
for (int64_t i = 0; OB_LIKELY(OB_SUCCESS == error_) && i < assign; ++i) {
if (OB_UNLIKELY(OB_SUCCESS != (error_ = copy_assign(data_[i], other.data_[i])))) {
LIB_LOG(WARN, "failed to copy data", K(error_));
LIB_LOG_RET(WARN, error_, "failed to copy data", K(error_));
count_ = i;
}
}
for (int64_t i = assign; OB_LIKELY(OB_SUCCESS == error_) && i < other.count_; ++i) {
if (OB_UNLIKELY(OB_SUCCESS != (error_ = construct_assign(data_[i], other.data_[i])))) {
LIB_LOG(WARN, "failed to copy data", K(error_));
LIB_LOG_RET(WARN, error_, "failed to copy data", K(error_));
count_ = i;
}
}

View File

@ -50,10 +50,10 @@ public:
OB_INLINE T &at(const int64_t array_idx, const int64_t idx)
{
if (OB_UNLIKELY(0 > array_idx || array_idx >= count_)) {
LIB_LOG(ERROR, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
right_to_die_or_duty_to_live();
} else if (OB_ISNULL(array_ptrs_) || OB_ISNULL(array_ptrs_[array_idx])) {
LIB_LOG(ERROR, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
KP_(array_ptrs));
right_to_die_or_duty_to_live();
}
@ -62,10 +62,10 @@ public:
OB_INLINE ObIArray<T> &at(const int64_t array_idx)
{
if (OB_UNLIKELY(0 > array_idx || array_idx >= count_)) {
LIB_LOG(ERROR, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
right_to_die_or_duty_to_live();
} else if (OB_ISNULL(array_ptrs_) || OB_ISNULL(array_ptrs_[array_idx])) {
LIB_LOG(ERROR, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
KP_(array_ptrs));
right_to_die_or_duty_to_live();
}
@ -77,10 +77,10 @@ public:
OB_INLINE int64_t count(const int64_t array_idx) const
{
if (OB_UNLIKELY(0 > array_idx || array_idx >= count_)) {
LIB_LOG(ERROR, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "Unexpected array idx", K_(count), K_(capacity), K(array_idx));
right_to_die_or_duty_to_live();
} else if (OB_ISNULL(array_ptrs_) || OB_ISNULL(array_ptrs_[array_idx])) {
LIB_LOG(ERROR, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K_(count), K_(capacity), K(array_idx),
KP_(array_ptrs));
right_to_die_or_duty_to_live();
}
@ -140,7 +140,7 @@ template<typename T, int64_t LOCAL_ARRAY_SIZE, int64_t ARRAY_ARRAY_SIZE, typenam
void ObArrayArray<T, LOCAL_ARRAY_SIZE, ARRAY_ARRAY_SIZE, BlockAllocatorT>::reset()
{
if (OB_ISNULL(array_ptrs_)) {
LIB_LOG(ERROR, "Unexpected null array array ptr", K_(count), K_(capacity), KP_(array_ptrs));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "Unexpected null array array ptr", K_(count), K_(capacity), KP_(array_ptrs));
array_ptrs_ = local_array_buf_;
capacity_ = ARRAY_ARRAY_SIZE;
}
@ -151,7 +151,7 @@ void ObArrayArray<T, LOCAL_ARRAY_SIZE, ARRAY_ARRAY_SIZE, BlockAllocatorT>::reset
alloc_.free(array_ptrs_[i]);
array_ptrs_[i] = nullptr;
} else {
LIB_LOG(ERROR, "Unexpected null array array ptr", K(i), K_(count), K_(capacity));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K(i), K_(count), K_(capacity));
}
}
if (array_ptrs_ != local_array_buf_) {
@ -168,7 +168,7 @@ template<typename T, int64_t LOCAL_ARRAY_SIZE, int64_t ARRAY_ARRAY_SIZE, typenam
void ObArrayArray<T, LOCAL_ARRAY_SIZE, ARRAY_ARRAY_SIZE, BlockAllocatorT>::reuse()
{
if (OB_ISNULL(array_ptrs_)) {
LIB_LOG(ERROR, "Unexpected null array array ptr", K_(count), K_(capacity), KP_(array_ptrs));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K_(count), K_(capacity), KP_(array_ptrs));
reset();
}
@ -176,7 +176,7 @@ void ObArrayArray<T, LOCAL_ARRAY_SIZE, ARRAY_ARRAY_SIZE, BlockAllocatorT>::reuse
if (OB_NOT_NULL(array_ptrs_[i])) {
array_ptrs_[i]->reuse();
} else {
LIB_LOG(ERROR, "Unexpected null array array ptr", K(i), K_(count), K_(capacity));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "Unexpected null array array ptr", K(i), K_(count), K_(capacity));
}
}
count_ = 0;

View File

@ -140,7 +140,7 @@ inline bool ObSegmentBitSet<N, BlockAllocatorT>::has_member(int64_t index) const
{
bool bool_ret = false;
if (OB_UNLIKELY(index < 0)) {
LIB_LOG(WARN, "negative bitmapset member not allowed", K(index));
LIB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "negative bitmapset member not allowed", K(index));
//just return false
} else if (OB_UNLIKELY(index >= bit_count())) {
//the bit is not set
@ -271,7 +271,7 @@ inline bool ObFixedBitSet<N>::has_member(int64_t index) const
{
bool bool_ret = false;
if (OB_UNLIKELY(index < 0)) {
LIB_LOG(WARN, "negative bitmapset member not allowed", K(index));
LIB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "negative bitmapset member not allowed", K(index));
//just return false
} else if (OB_UNLIKELY(index >= bit_count())) {
//the bit is not set
@ -747,7 +747,7 @@ inline bool ObBitSet<N, BlockAllocatorT, auto_free>::has_member(int64_t index) c
{
bool bool_ret = false;
if (OB_UNLIKELY(index < 0)) {
LIB_LOG(WARN, "negative bitmapset member not allowed", K(index));
LIB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "negative bitmapset member not allowed", K(index));
//just return false
} else if (OB_UNLIKELY(index >= bit_count())) {
//the bit is not set

View File

@ -466,12 +466,12 @@ ObBitmap::get_block(const size_type pos) const
{
ObBitmap::size_type result = 0;
if (OB_UNLIKELY(valid_bits_ < pos)) {
LIB_LOG(WARN, "Index out of range when getting block from bitmap", K_(valid_bits), K(pos));
LIB_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "Index out of range when getting block from bitmap", K_(valid_bits), K(pos));
} else {
size_type inner_pos = pos;
MemBlock *mem_block = find_block(pos, inner_pos);
if (OB_ISNULL(mem_block)) {
LIB_LOG(WARN, "Null pointer error when finding memblock", K(pos));
LIB_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "Null pointer error when finding memblock", K(pos));
} else {
result = mem_block->bits_[block_index(inner_pos)];
}

View File

@ -37,7 +37,7 @@ namespace erb
static inline void on_fatal_error()
{
while(true) {
LIB_LOG(ERROR, "on_fatal_error");
LIB_LOG_RET(ERROR, common::OB_ERROR, "on_fatal_error");
sleep(1);
}
}
@ -362,10 +362,10 @@ private:
{
Segment *pret = NULL;
if (NULL == allocator_) {
LIB_LOG(ERROR, "err alloc");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err alloc");
}
else if (NULL == (pret = static_cast<Segment*>(allocator_->alloc(seg_size_)))) {
LIB_LOG(WARN, "failed to alloc Segment", K(seg_size_));
LIB_LOG_RET(WARN, common::OB_ALLOCATE_MEMORY_FAILED, "failed to alloc Segment", K(seg_size_));
} else {
new(pret)Segment();
pret->reset(seg_capacity_, allocator_);
@ -408,9 +408,9 @@ private:
Dir *pret = NULL;
int64_t size = static_cast<int64_t>(sizeof(Dir) + (seg_cnt * sizeof(Segment*)));
if (NULL == allocator_) {
LIB_LOG(ERROR, "err alloc");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err alloc");
} else if (NULL == (pret = static_cast<Dir*>(allocator_->alloc(size)))) {
LIB_LOG(WARN, "failed to alloc Dir", K(size));
LIB_LOG_RET(WARN, common::OB_ALLOCATE_MEMORY_FAILED, "failed to alloc Dir", K(size));
} else {
new(pret)Dir();
pret->reset(seg_cnt, seg_capacity_, allocator_);
@ -511,7 +511,7 @@ private:
void expand_rearrange_(const int64_t ctrl_sn, Dir *dir, Dir *new_dir)
{
if (NULL == dir || NULL == new_dir) {
LIB_LOG(ERROR, "err dir", K(dir), K(new_dir));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err dir", K(dir), K(new_dir));
}
else {
SlotIdx slot_idx = calc_slot_idx_(ctrl_sn, dir);
@ -578,7 +578,7 @@ private:
void shrink_rearrange_(const int64_t ctrl_sn, Dir *dir, Dir *new_dir)
{
if (NULL == dir || NULL == new_dir) {
LIB_LOG(ERROR, "err dir", K(dir), K(new_dir));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err dir", K(dir), K(new_dir));
}
else {
SlotIdx slot_idx = calc_slot_idx_(ctrl_sn + 1, dir); // Slot index of the next begin slot.

View File

@ -64,7 +64,7 @@ public:
{
T* buffer = get_buffer();
if (OB_UNLIKELY(0 > idx || idx >= count_ || buffer == NULL)) {
LIB_LOG(ERROR, "invalid argument", K(idx), K_(count), K(buffer));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "invalid argument", K(idx), K_(count), K(buffer));
common::right_to_die_or_duty_to_live();
}
return buffer[idx];
@ -73,7 +73,7 @@ public:
{
const T* buffer = get_buffer();
if (OB_UNLIKELY(0 > idx || idx >= count_ || buffer == NULL)) {
LIB_LOG(ERROR, "invalid argument", K(idx), K_(count), K(buffer));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "invalid argument", K(idx), K_(count), K(buffer));
common::right_to_die_or_duty_to_live();
}
return buffer[idx];

View File

@ -47,7 +47,7 @@ public:
virtual int assign(const ObIArray &other) = 0;
virtual int prepare_allocate(int64_t capacity) = 0;
virtual T *alloc_place_holder()
{ OB_LOG(WARN, "Not supported"); return NULL; }
{ OB_LOG_RET(WARN, OB_NOT_SUPPORTED, "Not supported"); return NULL; }
virtual int64_t to_string(char* buf, int64_t buf_len) const
{

View File

@ -250,7 +250,7 @@ void ObIDMap<T, ID_TYPE, TSI_HOLD_NUM>::revert(const ID_TYPE id, const bool eras
array_[pos].data = NULL;
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = free_list_.push(&(array_[pos])))) {
_OB_LOG(ERROR, "push to free list fail ret=%d free list size=%ld", tmp_ret,
_OB_LOG_RET(ERROR, tmp_ret, "push to free list fail ret=%d free list size=%ld", tmp_ret,
free_list_.get_total());
}
}
@ -275,7 +275,7 @@ void ObIDMap<T, ID_TYPE, TSI_HOLD_NUM>::erase(const ID_TYPE id)
array_[pos].data = NULL;
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = free_list_.push(&(array_[pos])))) {
_OB_LOG(ERROR, "push to free list fail ret=%d free list size=%ld", tmp_ret,
_OB_LOG_RET(ERROR, tmp_ret, "push to free list fail ret=%d free list size=%ld", tmp_ret,
free_list_.get_total());
}
}

View File

@ -291,14 +291,14 @@ public:
inline T &operator[](int64_t idx) // dangerous
{
if (OB_UNLIKELY(0 > idx || idx >= count_)) {
LIB_LOG(ERROR, "idx out of range", K(idx), K(count_));
LIB_LOG_RET(ERROR, OB_ARRAY_OUT_OF_RANGE, "idx out of range", K(idx), K(count_));
}
return data_[idx];
}
inline const T &operator[](int64_t idx) const // dangerous
{
if (OB_UNLIKELY(0 > idx || idx >= count_)) {
LIB_LOG(ERROR, "idx out of range", K(idx), K(count_));
LIB_LOG_RET(ERROR, OB_ARRAY_OUT_OF_RANGE, "idx out of range", K(idx), K(count_));
}
return data_[idx];
}

View File

@ -397,7 +397,7 @@ Seg<T, SIZE>::Seg(const SegCreationType type)
end_idx_ = 0;
} else {
// only used in this file, caller guarantee valid args
LIB_LOG(ERROR, "unkown SegCreationType", K(type), K(lbt()));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "unkown SegCreationType", K(type), K(lbt()));
}
}
@ -405,7 +405,7 @@ template<typename T, int64_t SIZE>
Seg<T, SIZE>::Seg(const T &item)
{
if (SIZE <= 0) {
LIB_LOG(ERROR, "SIZE invalid", K(SIZE));
LIB_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "SIZE invalid", K(SIZE));
} else {
start_idx_ = 0;
end_idx_ = 0;
@ -636,7 +636,7 @@ private:
{
bool bret = false;
if (OB_UNLIKELY(0 == x->get_count())) {
LIB_LOG(ERROR, "invalid argument", "x.count", x->get_count());
LIB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "invalid argument", "x.count", x->get_count());
} else {
bret = (x->get_delegate() <= *y_);
}

View File

@ -121,7 +121,7 @@ public:
inline value_type &at(const int64_t index) const
{
if (OB_UNLIKELY(index < 0 || index >= size())) {
COMMON_LOG(ERROR, "invalid index", K(index));
COMMON_LOG_RET(ERROR, OB_ARRAY_OUT_OF_RANGE, "invalid index", K(index));
}
return *(mem_begin_ + index);
}

View File

@ -75,7 +75,7 @@ void IFileReader::close()
{
if (-1 != fd_) {
if(0 != ::close(fd_)) {
OB_LOG(WARN, "fail to close file ", K_(fd), K(errno), KERRMSG);
OB_LOG_RET(WARN, OB_ERR_SYS, "fail to close file ", K_(fd), K(errno), KERRMSG);
}
fd_ = -1;
}
@ -90,7 +90,7 @@ void IFileReader::revise(int64_t pos)
{
if (-1 != fd_) {
if(0 != ::ftruncate(fd_, pos)) {
_OB_LOG(WARN, "ftruncate fail fd=%d file_pos=%ld errno=%u", fd_, pos, errno);
_OB_LOG_RET(WARN, OB_ERR_SYS, "ftruncate fail fd=%d file_pos=%ld errno=%u", fd_, pos, errno);
}
}
}
@ -784,9 +784,9 @@ int64_t unintr_pwrite(const int fd, const void *buf, const int64_t count, const
if (errno == EINTR) { // Blocking IO does not need to judge EAGAIN
continue;
}
_OB_LOG(ERROR,
"pwrite fail ret=%ld errno=%u fd=%d buf=%p size2write=%ld offset2write=%ld retry_num=%ld",
write_ret, errno, fd, (char *)buf + offset2write, length2write, offset + offset2write, retry);
_OB_LOG_RET(ERROR, OB_ERR_SYS,
"pwrite fail ret=%ld errno=%u fd=%d buf=%p size2write=%ld offset2write=%ld retry_num=%ld",
write_ret, errno, fd, (char *)buf + offset2write, length2write, offset + offset2write, retry);
retry++;
} else {
break;
@ -816,7 +816,7 @@ int64_t unintr_write(const int fd, const void *buf, const int64_t count)
if (errno == EINTR) { // Blocking IO does not need to judge EAGAIN
continue;
}
_OB_LOG(ERROR,
_OB_LOG_RET(ERROR, OB_ERR_SYS,
"pwrite fail ret=%ld errno=%u fd=%d buf=%p size2write=%ld offset2write=%ld retry_num=%ld",
write_ret, errno, fd, (char *)buf + offset2write, length2write, offset2write, retry);
retry++;
@ -848,7 +848,7 @@ int64_t unintr_pread(const int fd, void *buf, const int64_t count, const int64_t
if (errno == EINTR) { // Blocking IO does not need to judge EAGAIN
continue;
}
_OB_LOG(ERROR,
_OB_LOG_RET(ERROR, OB_ERR_SYS,
"pread fail ret=%ld errno=%u fd=%d buf=%p size2read=%ld offset2read=%ld retry_num=%ld",
read_ret, errno, fd, (char *)buf + offset2read, length2read, offset + offset2read, retry);
retry++;
@ -1011,7 +1011,7 @@ int64_t ObFileBuffer::get_base_pos()
void ObFileBuffer::set_base_pos(const int64_t pos)
{
if (pos > buffer_size_) {
_OB_LOG(WARN, "base_pos=%ld will be greater than buffer_size=%ld", pos, buffer_size_);
_OB_LOG_RET(WARN, OB_ERR_UNEXPECTED, "base_pos=%ld will be greater than buffer_size=%ld", pos, buffer_size_);
}
base_pos_ = pos;
}
@ -1363,7 +1363,7 @@ ObFileAsyncAppender::ObFileAsyncAppender() : pool_(),
memset(&ctx_, 0, sizeof(ctx_));
int tmp_ret = 0;
if (0 != (tmp_ret = io_setup(AIO_MAXEVENTS, &ctx_))) {
_OB_LOG(ERROR, "io_setup fail ret=%d", tmp_ret);
_OB_LOG_RET(ERROR, OB_ERR_SYS, "io_setup fail ret=%d", tmp_ret);
}
}
@ -1437,13 +1437,13 @@ void ObFileAsyncAppender::close()
if (-1 != fd_) {
if (OB_SUCCESS != fsync()) {
// Fatal error
_OB_LOG(ERROR, "fsync fail fd=%d, will set fd=-1, and the fd will leek", fd_);
_OB_LOG_RET(ERROR, OB_ERR_SYS, "fsync fail fd=%d, will set fd=-1, and the fd will leek", fd_);
} else {
if (0 != ftruncate(fd_, file_pos_)) {
OB_LOG(WARN, "fail to truncate file ", K_(fd), K(errno), KERRMSG);
OB_LOG_RET(WARN, OB_ERR_SYS, "fail to truncate file ", K_(fd), K(errno), KERRMSG);
}
if (0 != ::close(fd_)) {
OB_LOG(WARN, "fail to close file ", K_(fd), K(errno), KERRMSG);
OB_LOG_RET(WARN, OB_ERR_SYS, "fail to close file ", K_(fd), K(errno), KERRMSG);
}
@ -1562,7 +1562,7 @@ ObFileAsyncAppender::AIOCB *ObFileAsyncAppender::get_iocb_()
if (NULL != ret
&& NULL == ret->buffer) {
if (NULL == (ret->buffer = (char *)memalign(align_size_, AIO_BUFFER_SIZE))) {
_OB_LOG(WARN, "alloc async buffer fail");
_OB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "alloc async buffer fail");
pool_.free_obj(ret);
cur_iocb_ = NULL;
ret = NULL;
@ -1589,7 +1589,7 @@ void ObFileAsyncAppender::wait()
pool_.free_obj(iocb);
} else {
// Fatal error
_OB_LOG(ERROR, "iocb return fail iocb=%p res=%ld res2=%ld, will set fd=-1, and the fd will leek",
_OB_LOG_RET(ERROR, OB_ERR_SYS, "iocb return fail iocb=%p res=%ld res2=%ld, will set fd=-1, and the fd will leek",
ioe[i].data, ioe[i].res, ioe[i].res2);
fd_ = -1;
cur_iocb_ = NULL;

View File

@ -417,7 +417,7 @@ ObWaitablePool<T, SIZE>::ObWaitablePool() : list_(NULL),
ObMemAttr memattr;
memattr.label_ = ObModIds::OB_WAITABLE_POOL;
if (NULL == (objs_ = (Node *)ob_malloc(sizeof(Node) * SIZE, memattr))) {
_OB_LOG(ERROR, "alloc obj array fail");
_OB_LOG_RET(ERROR, common::OB_ALLOCATE_MEMORY_FAILED, "alloc obj array fail");
} else {
for (int64_t i = 0; i < SIZE; i++) {
new(&objs_[i].data) T();
@ -440,7 +440,7 @@ ObWaitablePool<T, SIZE>::~ObWaitablePool()
}
if (NULL != objs_) {
if (SIZE != counter) {
_OB_LOG(ERROR, "still have %ld node not been free, memory=%p will leek", SIZE - counter, objs_);
_OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "still have %ld node not been free, memory=%p will leek", SIZE - counter, objs_);
} else {
ob_free(objs_);
}

View File

@ -193,7 +193,7 @@ class ObFunction<Ret(Args...)> {
} else {
const char* class_name = typeid(Fn).name();
int class_size = sizeof(Derived<Fn>);
OCCAM_LOG(ERROR, "ptr is nullptr",
OCCAM_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "ptr is nullptr",
K(class_name), K(class_size),
K(function::SMALL_OBJ_MAX_SIZE), KP(local_buffer));
}

View File

@ -92,7 +92,7 @@
#define CHECK_INITED() \
do {\
if (OB_UNLIKELY(!is_valid())) {\
OCCAM_LOG(WARN, "not init", K(lbt()));\
OCCAM_LOG_RET(WARN, common::OB_NOT_INIT, "not init", K(lbt()));\
return OB_NOT_INIT;\
}\
} while (0)

View File

@ -422,7 +422,7 @@ ObWkbGeomCollection::size_type ObWkbGeomCollection::get_sub_size(const_pointer d
break;
}
default: {
LOG_WARN("Invalid geo type.", K(type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "Invalid geo type.", K(type));
}
}
return s;
@ -835,7 +835,7 @@ ObWkbGeogCollection::size_type ObWkbGeogCollection::get_sub_size(const_pointer d
break;
}
default: {
LOG_WARN("Invalid geo type.", K(type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "Invalid geo type.", K(type));
}
}
return s;
@ -850,4 +850,4 @@ ObGeoType ObWkbGeogCollection::get_sub_type(const_pointer data) const
}
} // namespace common
} // namespace oceanbase
} // namespace oceanbase

View File

@ -27,7 +27,7 @@ bool ObIWkbGeometry::is_empty() const
if (OB_NOT_NULL(ptr)) {
empty = this->is_empty_inner();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return empty;
}
@ -39,7 +39,7 @@ uint64_t ObIWkbGeometry::length() const
if (OB_NOT_NULL(ptr)) {
s = this->length_inner();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return s;
}
@ -51,7 +51,7 @@ double ObIWkbGeomPoint::x() const
if (OB_NOT_NULL(ptr)) {
val = ptr->get<0>();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return val;
}
@ -63,7 +63,7 @@ double ObIWkbGeomPoint::y() const
if (OB_NOT_NULL(ptr)) {
val = ptr->get<1>();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return val;
}
@ -74,7 +74,7 @@ void ObIWkbGeomPoint::x(double d)
if (OB_NOT_NULL(ptr)) {
ptr->set<0>(d);
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
}
@ -84,7 +84,7 @@ void ObIWkbGeomPoint::y(double d)
if (OB_NOT_NULL(ptr)) {
ptr->set<1>(d);
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
}
@ -147,7 +147,7 @@ double ObIWkbGeogPoint::x() const
if (OB_NOT_NULL(ptr)) {
val = ptr->get<0>();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return val;
}
@ -159,7 +159,7 @@ double ObIWkbGeogPoint::y() const
if (OB_NOT_NULL(ptr)) {
val = ptr->get<1>();
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
return val;
}
@ -170,7 +170,7 @@ void ObIWkbGeogPoint::x(double d)
if (OB_NOT_NULL(ptr)) {
ptr->set<0>(d);
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
}
@ -180,7 +180,7 @@ void ObIWkbGeogPoint::y(double d)
if (OB_NOT_NULL(ptr)) {
ptr->set<1>(d);
} else {
LOG_WARN("Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
LOG_WARN_RET(OB_ERR_NULL_VALUE, "Try to access NULL pointer.", K(OB_ERR_NULL_VALUE));
}
}

View File

@ -137,7 +137,7 @@ ObGeoType ObGeoTypeUtil::get_geo_type_by_name(ObString &name)
} else if (0 == name.case_compare("geometrycollection")) {
geo_type = ObGeoType::GEOMETRYCOLLECTION;
} else {
LOG_WARN("get type by name failed", K(geo_type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "get type by name failed", K(geo_type));
}
return geo_type;
@ -176,7 +176,7 @@ const char *ObGeoTypeUtil::get_geo_name_by_type(ObGeoType type)
break;
}
default:{
LOG_WARN("unknown geometry type", K(type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "unknown geometry type", K(type));
break;
}
}

View File

@ -65,7 +65,7 @@ const char *ObGeometryTypeCastUtil::get_cast_name(ObGeoType type)
break;
}
default:{
LOG_WARN("unknown geometry type", K(type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "unknown geometry type", K(type));
break;
}
}
@ -168,7 +168,7 @@ bool ObGeometryTypeCastUtil::is_point_equal(const P &p_left, const P &p_right)
if ((p_left.template get<0>() != p_right.template get<0>()) ||
(p_left.template get<1>() != p_right.template get<1>())) {
is_equal = false;
LOG_WARN("the back and front of the linestring are not the same point",
LOG_WARN_RET(OB_ERR_UNEXPECTED, "the back and front of the linestring are not the same point",
K(p_left.template get<0>()), K(p_right.template get<0>()),
K(p_left.template get<1>()), K(p_right.template get<1>()));
}
@ -1064,4 +1064,4 @@ int ObGeomcollectionTypeCast::cast(const ObGeometry &src,
}
} // namespace common
} // namespace oceanbase
} // namespace oceanbase

View File

@ -224,9 +224,9 @@ public:
allocator_->free(data_);
}
} else if (!OB_ISNULL(data_)) {
OCCAM_LOG(ERROR, "should never go here", K(*this));
OCCAM_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "should never go here", K(*this));
} else if (!OB_ISNULL(allocator_)) {
OCCAM_LOG(ERROR, "should never go here", K(*this));
OCCAM_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "should never go here", K(*this));
} else {}// it'ok that both data_ and allocator_ are nullptr, ObUniqueGuard has been reset
data_ = nullptr;
deleter_ = nullptr;

View File

@ -113,7 +113,7 @@ public:
if (NULL != (bucket_ = BucketChain::next(bucket_))) { // found non-empty next bucket.
value_ = bucket_->chain_.head_;
if (OB_ISNULL(value_)) {
OB_LOG(ERROR, "NULL value", KP_(value)); // if bucket is in chain, must be non-empty.
OB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "NULL value", KP_(value)); // if bucket is in chain, must be non-empty.
}
}
}

View File

@ -82,7 +82,7 @@ void *ArrayAlloc::alloc(const int64_t sz)
{
void *ptr = NULL;
if (sz <= 0) {
COMMON_LOG(WARN, "invalid argument", K(sz));
COMMON_LOG_RET(WARN, OB_INVALID_ARGUMENT, "invalid argument", K(sz));
} else {
ObMemAttr attr(tenant_id_, label_);
ptr = ob_malloc(sz, attr);

View File

@ -279,7 +279,7 @@ bool ObConcurrentHashMap<Key, Value>::RemoveIf<Function>::operator()(Key &key, V
if (OB_SUCCESS != (tmp_ret = hash_.remove_refactored(key))) {
//if remove failed, stop traversing.
bool_ret = false;
COMMON_LOG(WARN, "hash remove error", K(tmp_ret), K(key), K(value));
COMMON_LOG_RET(WARN, tmp_ret, "hash remove error", K(tmp_ret), K(key), K(value));
}
}
return bool_ret;

View File

@ -217,7 +217,7 @@ template<typename Key, typename Value>
void ObConcurrentHashMapWithHazardValue<Key, Value *>::DefaultValueReclaimCallback::reclaim_value(Value *value)
{
if (OB_ISNULL(alloc_)) {
COMMON_LOG(WARN, "DefaultValueReclaimCallback wrong status", KP(alloc_));
COMMON_LOG_RET(WARN, common::OB_ERR_UNEXPECTED, "DefaultValueReclaimCallback wrong status", KP(alloc_));
} else {
alloc_->free(value);
value = NULL;
@ -241,7 +241,7 @@ template<typename Key, typename Value>
void ObConcurrentHashMapWithHazardValue<Key, Value *>::HazardPtrReclaimCallback::reclaim_ptr(uintptr_t ptr)
{
if (OB_ISNULL(value_reclaim_callback_)) {
COMMON_LOG(ERROR, "HazardPtrReclaimCallback wrong status", K(value_reclaim_callback_));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "HazardPtrReclaimCallback wrong status", K(value_reclaim_callback_));
} else {
value_reclaim_callback_->reclaim_value(reinterpret_cast<Value *>(ptr));
}
@ -266,11 +266,11 @@ void ObConcurrentHashMapWithHazardValue<Key, Value *>::HashReclaimCallback::recl
{
UNUSED(key);
if (OB_ISNULL(hazard_ptr_)) {
COMMON_LOG(ERROR, "HashReclaimCallback status error", KP(hazard_ptr_));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "HashReclaimCallback status error", KP(hazard_ptr_));
} else {
int tmp_ret = hazard_ptr_->retire(reinterpret_cast<uintptr_t>(value));
if (OB_SUCCESS != tmp_ret) {
COMMON_LOG(ERROR, "retire ptr error", K(value), K(tmp_ret));
int ret = hazard_ptr_->retire(reinterpret_cast<uintptr_t>(value));
if (OB_SUCCESS != ret) {
COMMON_LOG(ERROR, "retire ptr error", K(value), K(ret));
}
}
}

View File

@ -69,7 +69,7 @@ public:
HashMapIterator &operator ++()
{
if (OB_ISNULL(map_)) {
OB_LOG(ERROR, "hash map must not be NULL", K(lbt()));
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "hash map must not be NULL", K(lbt()));
} else if (bucket_pos_ == map_->bucket_num_ && slot_pos_ >= map_->overflow_count_) {
// do nothing
} else {
@ -155,7 +155,7 @@ public:
HashMapConstIterator &operator ++()
{
if (OB_ISNULL(map_)) {
OB_LOG(ERROR, "hash map must not be NULL", K(lbt()));
OB_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "hash map must not be NULL", K(lbt()));
} else if (bucket_pos_ == map_->bucket_num_ && slot_pos_ >= map_->overflow_count_) {
// do nothing
} else {

View File

@ -192,7 +192,7 @@ private:
{
int64_t tid = get_itid();
if (tid >= MAX_THREAD_NUM) {
COMMON_LOG(ERROR, "set_ref error", K(tid));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "set_ref error", K(tid));
} else {
ATOMIC_STORE(&read_ref_[tid].value_, x);
}
@ -302,7 +302,7 @@ public:
{
bool bool_ret = false;
if (OB_ISNULL(lock)) {
COMMON_LOG(ERROR, "ArrayHeadHandler try_wrlock error, null lock addr");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "ArrayHeadHandler try_wrlock error, null lock addr");
} else {
bool_ret = LockHandler::try_wrlock_hard(read_ref_, lock);
}
@ -316,7 +316,7 @@ public:
void wrunlock(uint32_t *lock)
{
if (OB_ISNULL(lock)) {
COMMON_LOG(ERROR, "ArrayHeadHandler wrunlock error, null lock addr");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "ArrayHeadHandler wrunlock error, null lock addr");
} else {
LockHandler::wrunlock(read_ref_, lock);
}
@ -355,7 +355,7 @@ public:
void print(FILE *fp, int64_t slot_idx = 0, int indent = 0)
{
if (OB_ISNULL(this) || OB_ISNULL(fp)) {
COMMON_LOG(ERROR, "print error, invalid argument or null this", KP(this), KP(fp));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "print error, invalid argument or null this", KP(this), KP(fp));
} else {
fprintf(fp, "%*s%ldL%d: ", indent * 4, "C", slot_idx, level_);
if (level_ != 1) {
@ -496,7 +496,7 @@ public:
path_size_++;
if (OB_UNLIKELY(path_size_ >= MAX_LEVEL)) {
err = -EOVERFLOW;
COMMON_LOG(ERROR, "path size over flow, idx is too large",
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "path size over flow, idx is too large",
K(err), K(idx), K(path_size_));
}
} while ((idx > 0 || path_size_ < root_level_) && OB_LIKELY(0 == err));
@ -747,7 +747,7 @@ public:
Node *old_root = NULL;
if (OB_ISNULL(root)) {
err = -EINVAL;
COMMON_LOG(ERROR, "root is null");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "root is null");
} else if (0 != (err = handle.acquire_ref())) {
} else if (0 != (err = handle.search(old_root = ATOMIC_LOAD(root), idx))) {
} else if (0 != (err = handle.get(val))) {
@ -761,7 +761,7 @@ public:
Node *new_root = NULL;
if (OB_ISNULL(root) || OB_ISNULL(val)) {
err = -EINVAL;
COMMON_LOG(ERROR, "root is null");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "root is null");
} else if (0 != (err = handle.acquire_ref())) {
} else if (0 != (err = handle.search(old_root = ATOMIC_LOAD(root), idx))) {
} else if (0 != (err = handle.insert(val, new_root))) {
@ -780,7 +780,7 @@ public:
Node *old_root = NULL;
if (OB_ISNULL(root)) {
err = -EINVAL;
COMMON_LOG(ERROR, "root is null");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "root is null");
} else if (0 != (err = handle.acquire_ref())) {
} else if (0 != (err = handle.search(old_root = ATOMIC_LOAD(root), idx))) {
} else if (0 != (err = handle.del(val, need_reclaim_root))) {

View File

@ -250,11 +250,11 @@ public:
min_size_(min_size), max_size_(max_size), target_size_(min_size)
{
if (OB_UNLIKELY(min_size_ < BATCH_SIZE)) {
_OB_LOG(ERROR, "min_size(%ld) is smaller than BATCH_SIZE(%u)", min_size_, BATCH_SIZE);
_OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "min_size(%ld) is smaller than BATCH_SIZE(%u)", min_size_, BATCH_SIZE);
min_size_ = BATCH_SIZE;
}
if (OB_UNLIKELY(min_size_ > max_size_)) {
OB_LOG(ERROR, "bad min/max size", K(min_size_), K(max_size_));
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "bad min/max size", K(min_size_), K(max_size_));
}
}
~DCHash() { destroy(); }

View File

@ -369,7 +369,7 @@ public:
void print_list(FILE *fp)
{
if (OB_UNLIKELY(NULL == fp)) {
COMMON_LOG(ERROR, "print list error, fp is null", K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "print list error, fp is null", K(lbt()));
} else {
Node *head = get_head();
fprintf(fp, "Hash: ");
@ -617,7 +617,7 @@ public:
bool is_deleted = false;
if (OB_ISNULL(start) || OB_ISNULL(target)) {
err = -EINVAL;
COMMON_LOG(ERROR, "search in list error, start is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "search in list error, start is null", K(err), K(lbt()));
} else {
pre = start;
next = NULL;
@ -638,7 +638,7 @@ public:
Node *next = NULL;
if (OB_ISNULL(target)) {
err = -EINVAL;
COMMON_LOG(ERROR, "get from list error, target is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "get from list error, target is null", K(err), K(lbt()));
} else if (0 != (err = search_in_list(start, target, pre, next))) {
} else if (NULL == next || 0 != target->compare(next)) {
err = -ENOENT;
@ -654,13 +654,13 @@ public:
Node *next = NULL;
if (OB_ISNULL(target)) {
err = -EINVAL;
COMMON_LOG(ERROR, "get from list error, target is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "get from list error, target is null", K(err), K(lbt()));
} else if (0 != (err = search_in_list(start, target, pre, next))) {
} else if (NULL != next && 0 == target->compare(next)) {
err = -EEXIST;
} else if (OB_ISNULL(pre)) {
err = -EINVAL;
COMMON_LOG(ERROR, "pre is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "pre is null", K(err), K(lbt()));
} else if (!pre->cas_next(target->next_ = next, target)) {
err = -EAGAIN;
}
@ -673,7 +673,7 @@ public:
Node *next = NULL;
if (OB_ISNULL(target)) {
err = -EINVAL;
COMMON_LOG(ERROR, "get from list error, target is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "get from list error, target is null", K(err), K(lbt()));
} else if (0 != (err = search_in_list(start, target, pre, next))) {
} else if (NULL == next || 0 != target->compare(next)) {
err = -ENOENT;
@ -681,7 +681,7 @@ public:
err = -EAGAIN;
} else if (OB_ISNULL(pre)) {
err = -EINVAL;
COMMON_LOG(ERROR, "pre is null", K(err), K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "pre is null", K(err), K(lbt()));
} else if (!pre->cas_next(next, next->get_next())) {
err = -EAGAIN;
next->clear_delete_mark();
@ -709,7 +709,7 @@ public:
{
//fprintf(fp, "%s\n", repr(root));
if (OB_ISNULL(root.root_)) {
COMMON_LOG(ERROR, "hash root is null", K(lbt()));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "hash root is null", K(lbt()));
} else {
root.root_->print(fp);
}

View File

@ -121,7 +121,7 @@ public:
{
_value_type *p = NULL;
if (OB_ISNULL(node_)) {
HASH_WRITE_LOG(HASH_FATAL, "node is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "node is null, backtrace=%s", lbt());
} else {
p = &(node_->data);
}
@ -201,7 +201,7 @@ public:
{
_value_type *p = NULL;
if (OB_ISNULL(node_)) {
HASH_WRITE_LOG(HASH_FATAL, "node is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "node is null, backtrace=%s", lbt());
} else {
p = &(node_->data);
}
@ -389,7 +389,7 @@ public:
iterator &operator ++()
{
if (OB_ISNULL(ht_)) {
HASH_WRITE_LOG(HASH_FATAL, "node is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "node is null, backtrace=%s", lbt());
} else if (++bucket_pos_ >= ht_->bucket_num_) {
bucket_ = nullptr;
} else {
@ -492,7 +492,7 @@ public:
{
_value_type *p = NULL;
if (OB_ISNULL(node_)) {
HASH_WRITE_LOG(HASH_FATAL, "node is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "node is null, backtrace=%s", lbt());
} else {
p = &(node_->data);
}
@ -512,7 +512,7 @@ public:
iterator &operator ++()
{
if (OB_ISNULL(ht_)) {
HASH_WRITE_LOG(HASH_FATAL, "node is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "node is null, backtrace=%s", lbt());
} else if (NULL != node_ && NULL != (node_ = node_->next)) {
// do nothing
} else {
@ -643,7 +643,7 @@ public:
const_iterator &operator ++()
{
if (OB_ISNULL(ht_)) {
HASH_WRITE_LOG(HASH_FATAL, "ht_ is null, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "ht_ is null, backtrace=%s", lbt());
} else if (NULL != node_ && NULL != (node_ = node_->next)) {
// do nothing
} else {
@ -894,7 +894,7 @@ public:
int64_t bucket_pos = 0;
//if (NULL == buckets_ || NULL == allocer_)
if (OB_UNLIKELY(!inited(buckets_)) || OB_UNLIKELY(NULL == allocer_)) {
HASH_WRITE_LOG(HASH_WARNING, "hashtable not init, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_WARNING, OB_NOT_INIT, "hashtable not init, backtrace=%s", lbt());
} else {
bucket = &buckets_[bucket_pos];
}
@ -912,7 +912,7 @@ public:
int64_t bucket_pos = 0;
//if (NULL == buckets_ || NULL == allocer_)
if (OB_UNLIKELY(!inited(buckets_)) || OB_UNLIKELY(NULL == allocer_)) {
HASH_WRITE_LOG(HASH_WARNING, "hashtable not init, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_WARNING, OB_NOT_INIT, "hashtable not init, backtrace=%s", lbt());
} else {
while (NULL == node && bucket_pos < bucket_num_) {
node = buckets_[bucket_pos].node;
@ -934,7 +934,7 @@ public:
hashnode *node = NULL;
int64_t bucket_pos = 0;
if (OB_UNLIKELY(!inited(buckets_)) || OB_UNLIKELY(NULL == allocer_)) {
HASH_WRITE_LOG(HASH_WARNING, "hashtable not init, backtrace=%s", lbt());
HASH_WRITE_LOG_RET(HASH_WARNING, OB_NOT_INIT, "hashtable not init, backtrace=%s", lbt());
} else {
while (NULL == node && bucket_pos < bucket_num_) {
node = buckets_[bucket_pos].node;

View File

@ -40,8 +40,12 @@
#define HASH_WRITE_LOG(_loglevel_, _fmt_, args...) { \
_OB_LOG(_loglevel_, _fmt_, ##args); \
}
#define HASH_WRITE_LOG_RET(_loglevel_, errcode, _fmt_, args...) { \
_OB_LOG_RET(_loglevel_, errcode, _fmt_, ##args); \
}
#else
#define HASH_WRITE_LOG(_loglevel_, _fmt_, args...) { \
#define HASH_WRITE_LOG_RET(_loglevel_, errcode, _fmt_, args...) { \
}
#endif
@ -89,7 +93,7 @@ public:
explicit SpinLocker(pthread_spinlock_t &spin) : succ_(false), spin_(NULL)
{
if (0 != pthread_spin_lock(&spin)) {
HASH_WRITE_LOG(HASH_WARNING, "lock spin fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "lock spin fail errno=%u", errno);
} else {
//HASH_WRITE_LOG(HASH_DEBUG, "lock spin succ spin=%p", &spin);
spin_ = &spin;
@ -120,7 +124,7 @@ public:
explicit MutexLocker(pthread_mutex_t &mutex) : succ_(false), mutex_(NULL)
{
if (0 != pthread_mutex_lock(&mutex)) {
HASH_WRITE_LOG(HASH_WARNING, "lock mutex fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "lock mutex fail errno=%u", errno);
} else {
//HASH_WRITE_LOG(HASH_DEBUG, "lock mutex succ mutex=%p", &mutex);
mutex_ = &mutex;
@ -173,7 +177,7 @@ public:
explicit ReadLocker(pthread_rwlock_t &rwlock) : succ_(false), rwlock_(NULL)
{
if (0 != pthread_rwlock_rdlock(&rwlock)) {
HASH_WRITE_LOG(HASH_WARNING, "rdlock rwlock fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "rdlock rwlock fail errno=%u", errno);
} else {
//HASH_WRITE_LOG(HASH_DEBUG, "rdlock rwlock succ rwlock=%p", &rwlock);
rwlock_ = &rwlock;
@ -204,7 +208,7 @@ public:
explicit WriteLocker(pthread_rwlock_t &rwlock) : succ_(false), rwlock_(NULL)
{
if (0 != pthread_rwlock_wrlock(&rwlock)) {
HASH_WRITE_LOG(HASH_WARNING, "wrlock wrlock fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "wrlock wrlock fail errno=%u", errno);
} else {
//HASH_WRITE_LOG(HASH_DEBUG, "wrlock rwlock succ rwlock=%p", &rwlock);
rwlock_ = &rwlock;
@ -235,7 +239,7 @@ public:
explicit RWLockIniter(pthread_rwlock_t &rwlock) : succ_(false)
{
if (0 != pthread_rwlock_init(&rwlock, NULL)) {
HASH_WRITE_LOG(HASH_WARNING, "init rwlock fail errno=%u rwlock=%p", errno, &rwlock);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "init rwlock fail errno=%u rwlock=%p", errno, &rwlock);
} else {
succ_ = true;
}
@ -320,7 +324,7 @@ public:
explicit SpinReadLocker(SpinRWLock &rwlock) : succ_(false), rwlock_(NULL)
{
if (0 != rwlock.rdlock()) {
HASH_WRITE_LOG(HASH_WARNING, "rdlock rwlock fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "rdlock rwlock fail errno=%u", errno);
} else {
rwlock_ = &rwlock;
succ_ = true;
@ -349,7 +353,7 @@ public:
explicit SpinWriteLocker(SpinRWLock &rwlock) : succ_(false), rwlock_(NULL)
{
if (0 != rwlock.wrlock()) {
HASH_WRITE_LOG(HASH_WARNING, "wrlock wrlock fail errno=%u", errno);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "wrlock wrlock fail errno=%u", errno);
} else {
rwlock_ = &rwlock;
succ_ = true;
@ -378,7 +382,7 @@ public:
explicit SpinIniter(pthread_spinlock_t &spin) : succ_(false)
{
if (0 != pthread_spin_init(&spin, PTHREAD_PROCESS_PRIVATE)) {
HASH_WRITE_LOG(HASH_WARNING, "init mutex fail errno=%u spin=%p", errno, &spin);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "init mutex fail errno=%u spin=%p", errno, &spin);
} else {
succ_ = true;
}
@ -399,7 +403,7 @@ public:
explicit MutexIniter(pthread_mutex_t &mutex) : succ_(false)
{
if (0 != pthread_mutex_init(&mutex, NULL)) {
HASH_WRITE_LOG(HASH_WARNING, "init mutex fail errno=%u mutex=%p", errno, &mutex);
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_SYS, "init mutex fail errno=%u mutex=%p", errno, &mutex);
} else {
succ_ = true;
}
@ -1117,8 +1121,8 @@ int do_create(Array &array, const int64_t total_size, const int64_t array_size,
if (total_size <= 0 || item_size <= 0) {
ret = -1;
} else if (NULL == (array = (Array)alloc.alloc(total_size * item_size))) {
_OB_LOG(WARN, "alloc memory failed,size:%ld", total_size * item_size);
ret = -1;
_OB_LOG(WARN, "alloc memory failed,size:%ld", total_size * item_size);
} else {
//BACKTRACE(WARN, total_size * item_size > 65536, "hashutil create init size=%ld", total_size * item_size);
memset(array, 0, total_size * item_size);
@ -1278,7 +1282,7 @@ public:
while (NULL != iter) {
Block *next = iter->next;
if (0 != iter->ref_cnt) {
HASH_WRITE_LOG(HASH_FATAL, "there is still node has not been free, ref_cnt=%d block=%p cur_pos=%d",
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "there is still node has not been free, ref_cnt=%d block=%p cur_pos=%d",
iter->ref_cnt, iter, iter->cur_pos);
} else {
//delete iter;
@ -1297,7 +1301,7 @@ public:
if (NULL != free_list_head_) {
Node *node = free_list_head_;
if (NODE_MAGIC1 != node->magic1 || NODE_MAGIC2 != node->magic2 || NULL == node->block) {
HASH_WRITE_LOG(HASH_FATAL, "magic broken magic1=%x magic2=%x", node->magic1, node->magic2);
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "magic broken magic1=%x magic2=%x", node->magic1, node->magic2);
} else {
free_list_head_ = node->next;
node->block->ref_cnt++;
@ -1308,7 +1312,7 @@ public:
if (NULL == block || block->cur_pos >= (int32_t)NODE_NUM) {
//if (NULL == (block = new(std::nothrow) Block()))
if (NULL == (block = (Block *)allocer_.alloc(sizeof(Block)))) {
HASH_WRITE_LOG(HASH_WARNING, "new block fail");
HASH_WRITE_LOG_RET(HASH_WARNING, OB_ERR_UNEXPECTED, "new block fail");
} else {
// BACKTRACE(WARN, ((int64_t)sizeof(Block))>DEFAULT_BLOCK_SIZE,
// "hashutil alloc block=%ld node=%ld T=%ld N=%d",
@ -1341,11 +1345,11 @@ public:
{
mutexlocker locker(lock_);
if (NULL == data) {
HASH_WRITE_LOG(HASH_WARNING, "invalid param null pointer");
HASH_WRITE_LOG_RET(HASH_WARNING, OB_INVALID_ARGUMENT, "invalid param null pointer");
} else {
Node *node = (Node *)data;
if (NODE_MAGIC1 != node->magic1 || NODE_MAGIC2 != node->magic2) {
HASH_WRITE_LOG(HASH_FATAL, "magic broken magic1=%x magic2=%x", node->magic1, node->magic2);
HASH_WRITE_LOG_RET(HASH_FATAL, OB_ERR_UNEXPECTED, "magic broken magic1=%x magic2=%x", node->magic1, node->magic2);
} else {
data->~T();
node->block->ref_cnt--;

View File

@ -142,7 +142,7 @@ public:
it != other.end();
++it) {
if (OB_SUCCESS != (tmp_ret = set_refactored(*it))) {
_OB_LOG(ERROR, "fail set value. tmp_ret=%d", tmp_ret);
_OB_LOG_RET(ERROR, tmp_ret, "fail set value. tmp_ret=%d", tmp_ret);
break;
}
}

View File

@ -789,7 +789,7 @@ void ObLinearHashMap<Key, Value, MemMgrTag>::Cnter::add(const int64_t cnt,
const int64_t th_id)
{
if (NULL == cnter_) {
LIB_LOG(ERROR, "invalid cnter, not init", K(cnter_));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "invalid cnter, not init", K(cnter_));
} else {
// Use thread id mod counter cnt to assign counter.
// get cpu id may be used in the future.
@ -1175,7 +1175,7 @@ ObLinearHashMap<Key, Value, MemMgrTag>::cons_seg_(uint64_t seg_sz)
{
Bucket *ret = NULL;
if (NULL == (ret = static_cast<Bucket*>(ob_malloc(seg_sz, memattr_)))) {
LIB_LOG(WARN, "failed to alloc segment", K(seg_sz));
LIB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "failed to alloc segment", K(seg_sz));
} else {
DISABLE_WARNING_GCC_PUSH
#ifdef __clang__
@ -1212,10 +1212,10 @@ ObLinearHashMap<Key, Value, MemMgrTag>::cons_dir_(uint64_t dir_sz, Bucket **old_
uint64_t old_seg_n = (old_dir == NULL) ? 0 : (old_dir_sz / sizeof(Bucket*));
uint64_t dir_seg_n_lmt = dir_sz / sizeof(Bucket*);
if (dir_seg_n_lmt <= old_seg_n) {
LIB_LOG(WARN, "err seg n", K(dir_seg_n_lmt), K(old_seg_n));
LIB_LOG_RET(WARN, OB_ERR_UNEXPECTED, "err seg n", K(dir_seg_n_lmt), K(old_seg_n));
}
else if (NULL == (ret = static_cast<Bucket**>(mem_mgr_.get_dir_alloc().alloc(dir_sz)))) {
LIB_LOG(WARN, "failed to alloc directory", K(dir_sz));
LIB_LOG_RET(WARN, OB_ALLOCATE_MEMORY_FAILED, "failed to alloc directory", K(dir_sz));
} else {
for (uint64_t idx = 0; idx < old_seg_n; ++idx) {
ret[idx] = old_dir[idx];
@ -1255,7 +1255,7 @@ template <typename Key, typename Value, typename MemMgrTag>
void ObLinearHashMap<Key, Value, MemMgrTag>::set_bkt_lock_(Bucket *bkt, bool to_lock)
{
if (NULL == bkt) {
LIB_LOG(ERROR, "err set bkt lock");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err set bkt lock");
} else {
if (to_lock) {
bool locked = false;
@ -1285,7 +1285,7 @@ template <typename Key, typename Value, typename MemMgrTag>
void ObLinearHashMap<Key, Value, MemMgrTag>::set_bkt_active_(Bucket *bkt, bool to_activate)
{
if (NULL == bkt) {
LIB_LOG(ERROR, "err set bkt active");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err set bkt active");
} else {
bkt->flag_ = static_cast<uint8_t>(to_activate ? (bkt->flag_ | BKT_ACTIVE_MASK) : (bkt->flag_ & ~BKT_ACTIVE_MASK));
}
@ -1296,7 +1296,7 @@ bool ObLinearHashMap<Key, Value, MemMgrTag>::is_bkt_active_(const Bucket *bkt)
{
bool bret = false;
if (NULL == bkt) {
LIB_LOG(ERROR, "err set bkt nonempty");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err set bkt nonempty");
} else {
bret = (bkt->flag_ & BKT_ACTIVE_MASK) != 0;
}
@ -1307,7 +1307,7 @@ template <typename Key, typename Value, typename MemMgrTag>
void ObLinearHashMap<Key, Value, MemMgrTag>::set_bkt_nonempty_(Bucket *bkt, bool to_nonempty)
{
if (NULL == bkt) {
LIB_LOG(ERROR, "err set bkt nonempty");
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err set bkt nonempty");
} else {
bkt->flag_ = static_cast<uint8_t>(to_nonempty ? (bkt->flag_ | BKT_NONEMPTY_MASK) : (bkt->flag_ & ~BKT_NONEMPTY_MASK));
}
@ -1444,12 +1444,12 @@ void ObLinearHashMap<Key, Value, MemMgrTag>::load_expand_d_seg_bkts_(uint64_t L,
Bucket* &dst_bkt)
{
if (NULL == dir_) {
LIB_LOG(ERROR, "err dir", K(dir_));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err dir", K(dir_));
} else {
Bucket *src_seg = dir_[seg_idx_(p)];
Bucket *dst_seg = dir_[seg_idx_((L0_bkt_n_ << L) + p)];
if (NULL == src_seg || NULL == dst_seg) {
LIB_LOG(ERROR, "err seg", K(src_seg), K(dst_seg));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err seg", K(src_seg), K(dst_seg));
} else {
src_bkt = &src_seg[seg_bkt_idx_(p)];
dst_bkt = &dst_seg[seg_bkt_idx_((L0_bkt_n_ << L) + p)];
@ -1465,7 +1465,7 @@ void ObLinearHashMap<Key, Value, MemMgrTag>::split_expand_d_seg_bkts_(uint64_t L
Bucket *src_bkt, Bucket *dst_bkt)
{
if (NULL == src_bkt || NULL == dst_bkt) {
LIB_LOG(ERROR, "err bkt ptr", K(src_bkt), K(dst_bkt));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err bkt ptr", K(src_bkt), K(dst_bkt));
}
else if (is_bkt_nonempty_(src_bkt)) {
Node *split_nodes[2] = { NULL, NULL };
@ -1514,7 +1514,7 @@ template <typename Key, typename Value, typename MemMgrTag>
void ObLinearHashMap<Key, Value, MemMgrTag>::unload_expand_d_seg_bkts_(Bucket *src_bkt, Bucket *dst_bkt)
{
if (NULL == src_bkt || NULL == dst_bkt) {
LIB_LOG(ERROR, "err bkt ptr", K(src_bkt), K(dst_bkt));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err bkt ptr", K(src_bkt), K(dst_bkt));
} else {
src_bkt->bkt_L_ = (uint8_t) (src_bkt->bkt_L_ + 1);
dst_bkt->bkt_L_ = src_bkt->bkt_L_;
@ -1528,12 +1528,12 @@ void ObLinearHashMap<Key, Value, MemMgrTag>::load_shrink_d_seg_bkts_(uint64_t L,
Bucket* &dst_bkt)
{
if (NULL == dir_) {
LIB_LOG(ERROR, "err dir", K(dir_));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err dir", K(dir_));
} else {
Bucket *src_seg = dir_[seg_idx_((L0_bkt_n_ << L) + p)];
Bucket *dst_seg = dir_[seg_idx_(p)];
if (NULL == src_seg || NULL == dst_seg) {
LIB_LOG(ERROR, "err seg", K(src_seg), K(dst_seg));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err seg", K(src_seg), K(dst_seg));
} else {
src_bkt = &src_seg[seg_bkt_idx_((L0_bkt_n_ << L) + p)];
dst_bkt = &dst_seg[seg_bkt_idx_(p)];
@ -1584,7 +1584,7 @@ void ObLinearHashMap<Key, Value, MemMgrTag>::unload_shrink_d_seg_bkts_(Bucket *s
bool succ)
{
if (NULL == src_bkt || NULL == dst_bkt) {
LIB_LOG(ERROR, "err bkt ptr", K(src_bkt), K(dst_bkt));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err bkt ptr", K(src_bkt), K(dst_bkt));
} else {
if (succ) {
dst_bkt->bkt_L_ = (uint8_t) (dst_bkt->bkt_L_ - 1);
@ -1755,7 +1755,7 @@ template <typename Key, typename Value, typename MemMgrTag>
void ObLinearHashMap<Key, Value, MemMgrTag>::unload_access_bkt_(Bucket *bkt, Bucket* bkt_seg)
{
if (NULL == bkt) {
LIB_LOG(ERROR, "err bkt", K(bkt));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err bkt", K(bkt));
} else {
set_bkt_lock_(bkt, false);
unload_haz_seg_(bkt_seg);
@ -1788,7 +1788,7 @@ uint64_t ObLinearHashMap<Key, Value, MemMgrTag>::do_clear_seg_(Bucket *seg, uint
{
uint64_t cnt = 0;
if (NULL == seg) {
LIB_LOG(ERROR, "err seg", K(seg));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err seg", K(seg));
} else {
for (uint64_t idx = 0; idx < bkt_n; ++idx) {
Bucket *bkt = &seg[idx];
@ -2331,7 +2331,7 @@ template <typename Function>
bool ObLinearHashMap<Key, Value, MemMgrTag>::DoRemoveIfOnBkt<Function>::operator()(ObLinearHashMap<Key, Value, MemMgrTag> &host, Bucket *bkt, Function &fn)
{
if (NULL == bkt) {
LIB_LOG(ERROR, "err bkt", K(bkt));
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "err bkt", K(bkt));
} else {
Node *remove_list = NULL;
Node **next_ptr = NULL;

View File

@ -324,7 +324,7 @@ public:
abort_unless(magic_code_ == MAGIC_CODE);
#else
if (OB_UNLIKELY(node->host_ != this || magic_code_ != MAGIC_CODE)) {
COMMON_LOG(ERROR, "unexpected error", K(node->host_), K(this), K(magic_code_));
COMMON_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "unexpected error", K(node->host_), K(this), K(magic_code_));
}
#endif
if (OB_NOT_NULL(node)) {

View File

@ -43,7 +43,7 @@ public:
{
void *ptr = nullptr;
if (sz <= 0) {
COMMON_LOG(WARN, "invalid argument", K(sz));
COMMON_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "invalid argument", K(sz));
} else {
ObMemAttr attr(tenant_id_, label_);
ptr = ob_malloc(sz, attr);

View File

@ -86,7 +86,7 @@ public:
bool can_release = false;
const int mod = static_cast<int>(t);
if (mod < 0 || mod >= static_cast<int>(T::TOTAL_MAX_MOD)) {
COMMON_LOG(WARN, "dec ref", "type", typeid(T).name(), K(this), K(mod));
COMMON_LOG_RET(WARN, common::OB_INVALID_ARGUMENT, "dec ref", "type", typeid(T).name(), K(this), K(mod));
} else {
int32_t idx = (int32_t)(get_itid() % MAX_CPU_NUM);
// lock one slot

View File

@ -52,7 +52,7 @@ public:
Iterator &operator++()
{
if (pos_ == end_) {
COMMON_LOG(ERROR, "pos is equal to end, unexpected error!");
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "pos is equal to end, unexpected error!");
} else {
++pos_;
advance_past_empty_and_deleted();
@ -259,7 +259,7 @@ public:
int64_t pos = 0;
if (OB_SUCCESS == placement_hash_search(key, pos)) {
if (pos < 0 || pos >= capacity_) {
COMMON_LOG(ERROR, "unexpected error", K(pos), K_(capacity));
COMMON_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "unexpected error", K(pos), K_(capacity));
} else {
ret = &cells_[pos];
}
@ -591,8 +591,8 @@ public:
int hash_ret = OB_HASH_NOT_EXIST;
if (OB_UNLIKELY(NULL == sub_maps_[0])) {
COMMON_LOG(WARN, "not initialize pointer hash map");
hash_ret = OB_NOT_INIT;
COMMON_LOG_RET(WARN, hash_ret, "not initialize pointer hash map");
} else {
for (int64_t i = 0; i < sub_map_count_; ++i) {
if (OB_HASH_NOT_EXIST != (hash_ret = sub_maps_[i]->get_refactored(key, value))) {
@ -613,7 +613,7 @@ public:
const V *ret = NULL;
if (OB_UNLIKELY(NULL == sub_maps_[0])) {
COMMON_LOG(WARN, "not initialize pointer hash map");
COMMON_LOG_RET(WARN, common::OB_NOT_INIT, "not initialize pointer hash map");
} else {
for (int64_t i = 0; i < sub_map_count_; ++i) {
if (NULL != (ret = sub_maps_[i]->get(key))) {
@ -630,7 +630,7 @@ public:
V *ret = NULL;
if (OB_UNLIKELY(NULL == sub_maps_[0])) {
COMMON_LOG(WARN, "not initialize pointer hash map");
COMMON_LOG_RET(WARN, common::OB_NOT_INIT, "not initialize pointer hash map");
} else {
for (int64_t i = 0; i < sub_map_count_; ++i) {
if (NULL != (ret = sub_maps_[i]->get(key))) {
@ -647,7 +647,7 @@ public:
void dump_keys(void) const
{
if (OB_UNLIKELY(NULL == sub_maps_[0])) {
COMMON_LOG(WARN, "not initialize pointer hash map");
COMMON_LOG_RET(WARN, common::OB_NOT_INIT, "not initialize pointer hash map");
} else {
for (int64_t i = 0; i < sub_map_count_; ++i) {
sub_maps_[i]->dump_keys();
@ -743,7 +743,7 @@ public:
if (OB_UNLIKELY(sub_map_id >= 0) && OB_UNLIKELY(sub_map_id < sub_map_count_)) {
iter = sub_maps_[sub_map_id]->begin();
} else {
COMMON_LOG(ERROR, "invalid sub map id", K(sub_map_id), K(sub_map_count_));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "invalid sub map id", K(sub_map_id), K(sub_map_count_));
}
return iter;
}
@ -754,7 +754,7 @@ public:
if (OB_UNLIKELY(sub_map_id >= 0) && OB_UNLIKELY(sub_map_id < sub_map_count_)) {
iter = sub_maps_[sub_map_id]->end();
} else {
COMMON_LOG(ERROR, "invalid sub map id", K(sub_map_id), K(sub_map_count_));
COMMON_LOG_RET(ERROR, common::OB_INVALID_ARGUMENT, "invalid sub map id", K(sub_map_id), K(sub_map_count_));
}
return iter;
}
@ -776,7 +776,7 @@ private:
void *sub_map_mem = NULL;
if (NULL == (sub_map_mem = allocator_.alloc(sub_map_mem_size_))) {
COMMON_LOG(ERROR, "failed to allocate memory for sub map", K_(sub_map_mem_size));
COMMON_LOG_RET(ERROR, common::OB_ALLOCATE_MEMORY_FAILED, "failed to allocate memory for sub map", K_(sub_map_mem_size));
} else if (NULL != sub_map_in) {
sub_map = new(sub_map_mem) SubMap(*sub_map_in);
} else {
@ -870,7 +870,7 @@ private:
if (OB_MALLOC_NORMAL_BLOCK_SIZE == sub_map_mem_size_) {
resize_to = sub_map_count_ * extend_size;
if (resize_to > OB_MALLOC_BIG_BLOCK_SIZE) {
COMMON_LOG(ERROR, "unexpected error", K(resize_to));
COMMON_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "unexpected error", K(resize_to));
}
} else if (OB_MALLOC_BIG_BLOCK_SIZE == sub_map_mem_size_) {
resize_to = sub_map_count_ * extend_size;
@ -889,7 +889,7 @@ private:
}
} else {
// overfollow, return NULL
COMMON_LOG(ERROR, "can't add more sub map", K_(sub_map_count));
COMMON_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "can't add more sub map", K_(sub_map_count));
}
} else {
ObPointerHashMap tmp(*this, resize_to);

View File

@ -67,7 +67,7 @@ public:
void destroy()
{
if (-1 == fd_) {
HASH_WRITE_LOG(HASH_WARNING, "have not inited");
HASH_WRITE_LOG_RET(HASH_WARNING, OB_NOT_INIT, "have not inited");
} else {
close(fd_);
}

View File

@ -35,7 +35,7 @@ struct ObJsonBaseCmp {
} else if (a->is_bin() && b->is_bin()) {
is_eq = (a->get_data() == b->get_data());
} else {
LOG_WARN("unexpected type", K(OB_ERR_UNEXPECTED), K(*a), K(*b));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected type", K(OB_ERR_UNEXPECTED), K(*a), K(*b));
}
return is_eq;
}
@ -6023,7 +6023,7 @@ ObObjType ObJsonBaseUtil::get_time_type(ObJsonNodeType json_type)
break;
}
default:
LOG_WARN("undefined datetime json type", K(json_type));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "undefined datetime json type", K(json_type));
break;
}
return type;

View File

@ -4604,7 +4604,7 @@ uint64_t ObJsonVar::get_var_size(uint8_t type)
break;
}
default: {
LOG_WARN("invalid var type.", K(OB_NOT_SUPPORTED), K(size));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "invalid var type.", K(OB_NOT_SUPPORTED), K(size));
break;
}
}
@ -4681,7 +4681,7 @@ uint64_t ObJsonVar::var_int2uint(int64_t var)
break;
}
default: {
LOG_WARN("invalid var type.", K(size));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "invalid var type.", K(size));
break;
}
}
@ -4718,7 +4718,7 @@ int64_t ObJsonVar::var_uint2int(uint64_t var)
break;
}
default: {
LOG_WARN("invalid var type.", K(size));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "invalid var type.", K(size));
break;
}
}

View File

@ -267,7 +267,7 @@ bool ObRapidJsonHandler::seeing_value(ObJsonNode *value)
}
default: {
LOG_WARN("unexpected json value", K(next_state_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected json value", K(next_state_));
is_continue = false;
break;
}
@ -282,7 +282,7 @@ bool ObRapidJsonHandler::is_start_object_or_array(ObJsonNode *value, ObJsonExpec
bool is_continue = false;
if (ObJsonParser::is_json_doc_over_depth(depth_)) {
LOG_WARN("current json doc is over depth", K(OB_ERR_JSON_OUT_OF_DEPTH));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "current json doc is over depth", K(OB_ERR_JSON_OUT_OF_DEPTH));
} else {
depth_++;
is_continue = seeing_value(value);
@ -302,7 +302,7 @@ bool ObRapidJsonHandler::is_end_object_or_array()
if (OB_ISNULL(parent)) { // current is root
if (depth_ != 0) {
is_continue = false;
LOG_WARN("unexpected tree depth", K(depth_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected tree depth", K(depth_));
} else {
next_state_ = ObJsonExpectNextState::EXPECT_EOF;
}
@ -333,7 +333,7 @@ bool ObRapidJsonHandler::Null()
void *buf = alloc(sizeof(ObJsonNull));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for null json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for null json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonNull *node = new (buf) ObJsonNull();
is_continue = seeing_value(node);
@ -348,7 +348,7 @@ bool ObRapidJsonHandler::Bool(bool value)
void *buf = alloc(sizeof(ObJsonBoolean));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for boolean json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for boolean json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonBoolean *node = new (buf) ObJsonBoolean(value);
is_continue = seeing_value(node);
@ -363,7 +363,7 @@ bool ObRapidJsonHandler::Int(int value)
void *buf = alloc(sizeof(ObJsonInt));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for int json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for int json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonInt *node = new (buf) ObJsonInt(value);
is_continue = seeing_value(node);
@ -378,7 +378,7 @@ bool ObRapidJsonHandler::Uint(unsigned value)
void *buf = alloc(sizeof(ObJsonInt)); // adapt mysql, use ObJsonInt
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for uint json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for uint json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonInt *node = new (buf) ObJsonInt(value);
is_continue = seeing_value(node);
@ -393,7 +393,7 @@ bool ObRapidJsonHandler::Int64(int64_t value)
void *buf = alloc(sizeof(ObJsonInt));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for int64 json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for int64 json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonInt *node = new (buf) ObJsonInt(value);
is_continue = seeing_value(node);
@ -408,7 +408,7 @@ bool ObRapidJsonHandler::Uint64(uint64_t value)
void *buf = alloc(sizeof(ObJsonUint));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for uint64 json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for uint64 json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonUint *node = new (buf) ObJsonUint(value);
is_continue = seeing_value(node);
@ -422,11 +422,11 @@ bool ObRapidJsonHandler::Double(double value)
bool is_continue = false;
if (!std::isfinite(value)) {
LOG_WARN("value is not finite", K(value));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "value is not finite", K(value));
} else {
void *buf = alloc(sizeof(ObJsonDouble));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for double json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for double json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonDouble *node = new (buf) ObJsonDouble(value);
is_continue = seeing_value(node);
@ -450,14 +450,14 @@ bool ObRapidJsonHandler::String(const char *str, rapidjson::SizeType length, boo
void *buf = alloc(sizeof(ObJsonString));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for string json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for string json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
if (copy) {
void *dst_buf = NULL;
ObString src_str(length, str);
if (length > 0) {
if (OB_ISNULL(dst_buf = allocator_->alloc(length))) {
LOG_WARN("allocate memory fail", K(length));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "allocate memory fail", K(length));
} else {
MEMCPY(dst_buf, src_str.ptr(), src_str.length());
ObJsonString *node = new (buf) ObJsonString(static_cast<char *>(dst_buf), length);
@ -483,7 +483,7 @@ bool ObRapidJsonHandler::StartObject()
void *buf = alloc(sizeof(ObJsonObject));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for object json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for object json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonObject *node= new (buf) ObJsonObject(allocator_);
is_continue = is_start_object_or_array(node, ObJsonExpectNextState::EXPECT_OBJECT_KEY);
@ -499,7 +499,7 @@ bool ObRapidJsonHandler::EndObject(rapidjson::SizeType length)
if (next_state_ != ObJsonExpectNextState::EXPECT_OBJECT_KEY) {
is_continue = false;
LOG_WARN("unexpected next json state", K(next_state_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected next json state", K(next_state_));
} else {
is_continue = is_end_object_or_array();
}
@ -513,7 +513,7 @@ bool ObRapidJsonHandler::StartArray()
void *buf = alloc(sizeof(ObJsonArray));
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for array json node", K(OB_ALLOCATE_MEMORY_FAILED));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for array json node", K(OB_ALLOCATE_MEMORY_FAILED));
} else {
ObJsonArray *node = new (buf) ObJsonArray(allocator_);
is_continue = is_start_object_or_array(node, ObJsonExpectNextState::EXPECT_ARRAY_VALUE);
@ -529,7 +529,7 @@ bool ObRapidJsonHandler::EndArray(rapidjson::SizeType length)
if (next_state_ != ObJsonExpectNextState::EXPECT_ARRAY_VALUE) {
is_continue = false;
LOG_WARN("unexpected next json state", K(next_state_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected next json state", K(next_state_));
} else {
is_continue = is_end_object_or_array();
}
@ -542,7 +542,7 @@ bool ObRapidJsonHandler::Key(const char *str, rapidjson::SizeType length, bool c
bool is_continue = false;
if (next_state_ != ObJsonExpectNextState::EXPECT_OBJECT_KEY) {
LOG_WARN("unexpected next json state", K(next_state_));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "unexpected next json state", K(next_state_));
} else {
// need deep-copy
if (copy) {
@ -550,7 +550,7 @@ bool ObRapidJsonHandler::Key(const char *str, rapidjson::SizeType length, bool c
ObString src_str(length, str);
if (length > 0) {
if (OB_ISNULL(dst_buf = allocator_->alloc(length))) {
LOG_WARN("allocate memory fail", K(length));
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "allocate memory fail", K(length));
} else {
MEMCPY(dst_buf, src_str.ptr(), src_str.length());
key_.assign_ptr(static_cast<char *>(dst_buf), length);

View File

@ -221,7 +221,7 @@ bool ObJsonPathBasicNode::is_autowrap() const
}
default:{
LOG_WARN("invalid node type", K(node_type_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "invalid node type", K(node_type_));
break;
}
}
@ -252,7 +252,7 @@ bool ObJsonPathBasicNode::is_multi_array_autowrap() const
}
default:{
LOG_WARN("invalid node type", K(node_type_));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "invalid node type", K(node_type_));
break;
}
}
@ -2662,7 +2662,7 @@ bool ObJsonPathUtil::is_ecmascript_identifier(const char* name, uint64_t length)
bool first_codepoint = (last_pos == 0);
if (!rapidjson::UTF8<char>::Decode(input_stream, &codepoint)) {
ret_bool = false;
LOG_WARN("fail to decode.",
LOG_WARN_RET(OB_ERR_UNEXPECTED, "fail to decode.",
K(ret_bool), K(codepoint), K(input_stream.Tell()), KCSTRING(name));
}
@ -2677,7 +2677,7 @@ bool ObJsonPathUtil::is_ecmascript_identifier(const char* name, uint64_t length)
more possibilities are available for subsequent characters.
*/
ret_bool = false;
LOG_WARN("first character must be $, _ or letter.",
LOG_WARN_RET(OB_ERR_UNEXPECTED, "first character must be $, _ or letter.",
K(ret_bool), K(codepoint), K(input_stream.Tell()), KCSTRING(name));
} else if (unicode_combining_mark(codepoint) || isdigit(codepoint)
|| is_connector_punctuation(codepoint)
@ -2689,7 +2689,7 @@ bool ObJsonPathUtil::is_ecmascript_identifier(const char* name, uint64_t length)
} else {
// nope
ret_bool = false;
LOG_WARN("not ecmascript identifier.",
LOG_WARN_RET(OB_ERR_UNEXPECTED, "not ecmascript identifier.",
K(ret_bool), K(codepoint), K(input_stream.Tell()), KCSTRING(name));
}
}
@ -4678,4 +4678,4 @@ int ObJsonPath::parse_filter_node()
}
} // namespace common
} // namespace oceanbase
} // namespace oceanbase

View File

@ -905,9 +905,9 @@ ObJsonNode *ObJsonArray::operator[](uint64_t index) const
ObJsonNode *node = NULL;
if (index >= element_count()) {
LOG_WARN("index is out of range", K(index));
LOG_WARN_RET(OB_INVALID_ARGUMENT, "index is out of range", K(index));
} else if (node_vector_[index]->get_parent() != this) {
LOG_WARN("unexpected parent json node", K(index));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected parent json node", K(index));
} else {
node = node_vector_[index];
}
@ -1043,7 +1043,7 @@ ObJsonNode *ObJsonTreeUtil::clone_new_node(ObIAllocator* allocator, Args &&... a
T *new_node = NULL;
if (OB_ISNULL(buf)) {
LOG_WARN("fail to alloc memory for ObJsonNode");
LOG_WARN_RET(OB_ALLOCATE_MEMORY_FAILED, "fail to alloc memory for ObJsonNode");
} else {
new_node = new(buf)T(std::forward<Args>(args)...);
}

View File

@ -165,10 +165,10 @@ inline void *ObAtomicList::push(void *item)
#ifdef DOUBLE_FREE_CHECK
if (TO_PTR(h) == item) {
OB_LOG(ERROR, "atomic list push: trying to free item twice");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list push: trying to free item twice");
}
if (((reinterpret_cast<uint64_t>(TO_PTR(h))) & 3) != 0) {
OB_LOG(ERROR, "atomic list push: bad list");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list push: bad list");
}
#endif
@ -199,10 +199,10 @@ inline void *ObAtomicList::batch_push(void *head_item, void *tail_item)
#ifdef DOUBLE_FREE_CHECK
if (TO_PTR(h) == tail_item) {
OB_LOG(ERROR, "atomic list push: trying to free item twice");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list push: trying to free item twice");
}
if ((reinterpret_cast<uint64_t>(TO_PTR(h))) & 3) {
OB_LOG(ERROR, "atomic list push: bad list");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list push: bad list");
}
#endif
@ -242,10 +242,10 @@ inline void *ObAtomicList::pop()
#ifdef DOUBLE_FREE_CHECK
if (result) {
if (FREELIST_POINTER(item) == TO_PTR(FREELIST_POINTER(next))) {
OB_LOG(ERROR, "atomic list pop: loop detected");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list pop: loop detected");
}
if (((reinterpret_cast<uint64_t>(TO_PTR(FREELIST_POINTER(next)))) & 3) != 0) {
OB_LOG(ERROR, "atomic list pop: bad list");
OB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "atomic list pop: bad list");
}
}
#endif

View File

@ -81,7 +81,7 @@ public:
err = OB_INIT_TWICE;
} else if (0 != (syserr = pthread_key_create(&key_, (void (*)(void *))do_destroy_free_list))) {
err = OB_ERR_UNEXPECTED;
_OB_LOG(ERROR, "pthread_key_create()=>%d", syserr);
_OB_LOG_RET(ERROR, err, "pthread_key_create()=>%d", syserr);
} else {
free_handler_ = free_handler;
allocator_ = allocator;
@ -94,7 +94,7 @@ public:
else if (NULL == (global_free_list_ = create_free_list(glimit))) {
err = OB_ERR_UNEXPECTED;
destroy();
_OB_LOG(ERROR, "create_free_list(%ld)=>%d", glimit, err);
_OB_LOG_RET(ERROR, err, "create_free_list(%ld)=>%d", glimit, err);
}
return err;
}
@ -188,7 +188,7 @@ protected:
if (NULL != free_list) {
LockGuard guard(lock_);
if (!free_list_set_.add_last(free_list)) {
_OB_LOG(ERROR, "add_last fail, this should not happen");
_OB_LOG_RET(ERROR, OB_ERROR, "add_last fail, this should not happen");
}
}
return free_list;

View File

@ -13,21 +13,24 @@
#include <sys/time.h>
#include "lib/lock/cond.h"
#include "lib/oblog/ob_log.h"
using namespace oceanbase::common;
namespace obutil
{
Cond::Cond()
{
int rt = pthread_cond_init(&_cond, NULL);
if (0 != rt) {
_OB_LOG(WARN, "Failed to init cond, err=%d", rt);
_OB_LOG_RET(WARN, OB_ERR_SYS, "Failed to init cond, err=%d", rt);
}
}
Cond::~Cond()
{
int ret = pthread_cond_destroy(&_cond);
if (0 != ret) {
_OB_LOG(WARN, "Failed to destroy cond, err=%d", ret);
int rt = pthread_cond_destroy(&_cond);
if (0 != rt) {
_OB_LOG_RET(WARN, OB_ERR_SYS, "Failed to destroy cond, err=%d", rt);
}
}
@ -35,7 +38,7 @@ void Cond::signal()
{
const int rt = pthread_cond_signal(&_cond);
if (0 != rt) {
_OB_LOG(WARN, "Failed to signal condition, err=%d", rt);
_OB_LOG_RET(WARN, OB_ERR_SYS, "Failed to signal condition, err=%d", rt);
}
}
@ -43,7 +46,7 @@ void Cond::broadcast()
{
const int rt = pthread_cond_broadcast(&_cond);
if (0 != rt) {
_OB_LOG(WARN, "Failed to broadcast condition, err=%d", rt);
_OB_LOG_RET(WARN, OB_ERR_SYS, "Failed to broadcast condition, err=%d", rt);
}
}
}//end namespace obutil

View File

@ -12,6 +12,7 @@
#include "lib/lock/mutex.h"
#include "lib/oblog/ob_log.h"
using namespace oceanbase::common;
namespace obutil
{
ObUtilMutex::ObUtilMutex()
@ -20,7 +21,7 @@ ObUtilMutex::ObUtilMutex()
#ifdef _NO_EXCEPTION
assert( rt == 0 );
if ( rt != 0 ) {
_OB_LOG(ERROR,"%s","ThreadSyscallException");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadSyscallException");
}
#else
if ( rt != 0 ) {
@ -34,7 +35,7 @@ ObUtilMutex::~ObUtilMutex()
const int rt = pthread_mutex_destroy(&_mutex);
assert(rt == 0);
if ( rt != 0 ) {
_OB_LOG(ERROR,"%s","ThreadSyscallException");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadSyscallException");
}
}
@ -44,9 +45,9 @@ bool ObUtilMutex::trylock() const
#ifdef _NO_EXCEPTION
if ( rt != 0 && rt !=EBUSY ) {
if ( rt == EDEADLK ) {
_OB_LOG(ERROR,"%s","ThreadLockedException ");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadLockedException ");
} else {
_OB_LOG(ERROR,"%s","ThreadSyscallException");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadSyscallException");
}
return false;
}
@ -69,9 +70,9 @@ void ObUtilMutex::lock() const
assert( rt == 0 );
if ( rt != 0 ) {
if ( rt == EDEADLK ) {
_OB_LOG(ERROR,"%s","ThreadLockedException ");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadLockedException ");
} else {
_OB_LOG(ERROR,"%s","ThreadSyscallException");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadSyscallException");
}
}
#else
@ -95,7 +96,7 @@ void ObUtilMutex::unlock() const
#ifdef _NO_EXCEPTION
assert( rt == 0 );
if ( rt != 0 ) {
_OB_LOG(ERROR,"%s","ThreadSyscallException");
_OB_LOG_RET(ERROR,OB_ERR_SYS, "%s","ThreadSyscallException");
}
#else
if ( rt != 0 ) {

View File

@ -326,7 +326,7 @@ ObMultiBucketLockGuard::~ObMultiBucketLockGuard()
int tmp_ret = OB_SUCCESS;
for (int64_t i = 0; i < latch_array_.count(); ++i) {
if (OB_UNLIKELY(OB_SUCCESS != (tmp_ret = lock_.unlock_latch_idx(latch_array_.at(i))))) {
COMMON_LOG(ERROR, "Fail to unlock bucket, ", K(tmp_ret), "latch_idx", latch_array_.at(i));
COMMON_LOG_RET(ERROR, tmp_ret, "Fail to unlock bucket, ", K(tmp_ret), "latch_idx", latch_array_.at(i));
}
}
};

View File

@ -75,7 +75,7 @@ public:
lock_start_ts_(0)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.rdlock(index_)))) {
COMMON_LOG(WARN, "Fail to read lock bucket, ", K_(index), K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to read lock bucket, ", K_(index), K_(ret));
} else {
lock_start_ts_ = ObTimeUtility::fast_current_time();
}
@ -84,7 +84,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.unlock(index_)))) {
COMMON_LOG(WARN, "Fail to unlock bucket, ", K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to unlock bucket, ", K_(ret));
} else {
const int64_t lock_end_ts = ObTimeUtility::fast_current_time();
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -116,7 +116,7 @@ public:
lock_start_ts_(0)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrlock(index_)))) {
COMMON_LOG(WARN, "Fail to write lock bucket, ", K_(index), K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to write lock bucket, ", K_(index), K_(ret));
} else {
lock_start_ts_ = ObTimeUtility::current_time();
}
@ -125,7 +125,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.unlock(index_)))) {
COMMON_LOG(WARN, "Fail to unlock bucket, ", K_(index), K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to unlock bucket, ", K_(index), K_(ret));
} else {
const int64_t lock_end_ts = ObTimeUtility::current_time();
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -156,7 +156,7 @@ public:
lock_start_ts_(0)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrlock_all()))) {
COMMON_LOG(WARN, "Fail to try write lock all buckets", K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to try write lock all buckets", K_(ret));
} else {
lock_start_ts_ = ObTimeUtility::current_time();
}
@ -165,7 +165,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.unlock_all()))) {
COMMON_LOG(WARN, "Fail to unlock all buckets, ", K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to unlock all buckets, ", K_(ret));
} else {
const int64_t lock_end_ts = ObTimeUtility::current_time();
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -196,10 +196,10 @@ public:
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.try_wrlock_all()))) {
if (OB_EAGAIN != ret_) {
COMMON_LOG(WARN, "Fail to try read lock all buckets", K_(ret), K(lbt()));
COMMON_LOG_RET(WARN, ret_, "Fail to try read lock all buckets", K_(ret), K(lbt()));
} else {
if (REACH_COUNT_INTERVAL(1000)) {// print one log per 1000 times.
COMMON_LOG(WARN, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
COMMON_LOG_RET(WARN, ret_, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
}
}
} else {
@ -210,7 +210,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.unlock_all()))) {
COMMON_LOG(WARN, "Fail to unlock all buckets, ", K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to unlock all buckets, ", K_(ret));
} else {
const int64_t lock_end_ts = ObTimeUtility::current_time();
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -241,10 +241,10 @@ public:
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.try_rdlock_all()))) {
if (OB_EAGAIN != ret_) {
COMMON_LOG(WARN, "Fail to try read lock all buckets", K_(ret), K(lbt()));
COMMON_LOG_RET(WARN, ret_, "Fail to try read lock all buckets", K_(ret), K(lbt()));
} else {
if (REACH_COUNT_INTERVAL(1000)) {// print one log per 1000 times.
COMMON_LOG(WARN, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
COMMON_LOG_RET(WARN, ret_, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
}
}
} else {
@ -255,7 +255,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.unlock_all()))) {
COMMON_LOG(WARN, "Fail to unlock all buckets, ", K_(ret));
COMMON_LOG_RET(WARN, ret_, "Fail to unlock all buckets, ", K_(ret));
} else {
const int64_t lock_end_ts = ObTimeUtility::current_time();
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {

View File

@ -76,7 +76,7 @@ public:
ret_(OB_SUCCESS)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.rdlock(index_)))) {
SHARE_LOG(WARN, "Fail to read lock bucket, ", K_(index), K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to read lock bucket, ", K_(index), K_(ret));
} else {
lock_start_ts_ = ObClockGenerator::getClock();;
}
@ -85,7 +85,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.rdunlock(index_)))) {
SHARE_LOG(WARN, "Fail to unlock bucket, ", K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to unlock bucket, ", K_(ret));
} else {
const int64_t lock_end_ts = ObClockGenerator::getClock();;
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -117,7 +117,7 @@ public:
ret_(OB_SUCCESS)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrlock(index_)))) {
SHARE_LOG(WARN, "Fail to write lock bucket, ", K_(index), K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to write lock bucket, ", K_(index), K_(ret));
} else {
lock_start_ts_ = ObClockGenerator::getClock();;
}
@ -126,7 +126,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrunlock(index_)))) {
SHARE_LOG(WARN, "Fail to unlock bucket, ", K_(index), K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to unlock bucket, ", K_(index), K_(ret));
} else {
const int64_t lock_end_ts = ObClockGenerator::getClock();;
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -185,7 +185,7 @@ public:
ret_(OB_SUCCESS)
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrlock_all()))) {
SHARE_LOG(WARN, "Fail to try write lock all buckets", K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to try write lock all buckets", K_(ret));
} else {
lock_start_ts_ = ObClockGenerator::getClock();;
}
@ -194,7 +194,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.wrunlock_all()))) {
SHARE_LOG(WARN, "Fail to unlock all buckets, ", K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to unlock all buckets, ", K_(ret));
} else {
const int64_t lock_end_ts = ObClockGenerator::getClock();;
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {
@ -225,10 +225,10 @@ public:
{
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.try_rdlock_all()))) {
if (OB_EAGAIN != ret_) {
SHARE_LOG(WARN, "Fail to try read lock all buckets", K_(ret), K(lbt()));
SHARE_LOG_RET(WARN, ret_, "Fail to try read lock all buckets", K_(ret), K(lbt()));
} else {
if (REACH_COUNT_INTERVAL(1000)) {// print one log per 1000 times.
SHARE_LOG(WARN, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
SHARE_LOG_RET(WARN, ret_, "fail to lock all buckets, need to try again", K_(ret), K(lbt()));
}
}
} else {
@ -239,7 +239,7 @@ public:
{
if (OB_LIKELY(OB_SUCCESS == ret_)) {
if (OB_UNLIKELY(OB_SUCCESS != (ret_ = lock_.rdunlock_all()))) {
SHARE_LOG(WARN, "Fail to unlock all buckets, ", K_(ret));
SHARE_LOG_RET(WARN, ret_, "Fail to unlock all buckets, ", K_(ret));
} else {
const int64_t lock_end_ts = ObClockGenerator::getClock();;
if (lock_end_ts - lock_start_ts_ > 5 * 1000 * 1000) {

Some files were not shown because too many files have changed in this diff Show More