fix error code and log level

This commit is contained in:
obdev
2023-07-28 03:48:41 +00:00
committed by ob-robot
parent 17fdb8b002
commit c80c7a2b95
2 changed files with 16 additions and 11 deletions

View File

@ -94,12 +94,12 @@ int ObInfoSchemaColumnsTable::inner_get_next_row(common::ObNewRow *&row)
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc( } else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc(
OB_MAX_SYS_PARAM_NAME_LENGTH))))) { OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); SERVER_LOG(WARN, "fail to alloc memory", K(ret));
} else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) { } else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) {
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc( } else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->alloc(
OB_MAX_SYS_PARAM_NAME_LENGTH))))) { OB_MAX_SYS_PARAM_NAME_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); SERVER_LOG(WARN, "fail to alloc memory", K(ret));
} else { } else {
column_type_str_ = static_cast<char *>(tmp_ptr); column_type_str_ = static_cast<char *>(tmp_ptr);
column_type_str_len_ = OB_MAX_SYS_PARAM_NAME_LENGTH; column_type_str_len_ = OB_MAX_SYS_PARAM_NAME_LENGTH;
@ -288,7 +288,7 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array(const bool is_filter_ta
last_db_schema_idx, last_db_schema_idx,
i, i,
is_filter_table_schema))) { is_filter_table_schema))) {
SERVER_LOG(ERROR, "fail to iterate all table columns. ", K(ret)); SERVER_LOG(WARN, "fail to iterate all table columns. ", K(ret));
} }
} }
} }
@ -446,14 +446,14 @@ int ObInfoSchemaColumnsTable::get_type_str(
OB_MAX_SYS_PARAM_NAME_LENGTH, OB_MAX_SYS_PARAM_NAME_LENGTH,
OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) { OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); SERVER_LOG(WARN, "fail to alloc memory", K(ret));
} else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) { } else if (FALSE_IT(data_type_str_ = static_cast<char *>(tmp_ptr))) {
} else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->realloc( } else if (OB_UNLIKELY(NULL == (tmp_ptr = static_cast<char *>(allocator_->realloc(
column_type_str_, column_type_str_,
OB_MAX_SYS_PARAM_NAME_LENGTH, OB_MAX_SYS_PARAM_NAME_LENGTH,
OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) { OB_MAX_EXTENDED_TYPE_INFO_LENGTH))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc memory", K(ret)); SERVER_LOG(WARN, "fail to alloc memory", K(ret));
} else { } else {
pos = 0; pos = 0;
column_type_str_ = static_cast<char *>(tmp_ptr); column_type_str_ = static_cast<char *>(tmp_ptr);
@ -548,7 +548,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString &database_name,
int64_t pos = 0; int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) { if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to allocate memory", K(ret)); SERVER_LOG(WARN, "fail to allocate memory", K(ret));
} else if (def_obj.is_bit()) { } else if (def_obj.is_bit()) {
if (OB_FAIL(def_obj.print_varchar_literal(buf, buf_len, pos, TZ_INFO(session_)))) { if (OB_FAIL(def_obj.print_varchar_literal(buf, buf_len, pos, TZ_INFO(session_)))) {
SERVER_LOG(WARN, "fail to print varchar literal", K(ret), K(def_obj), K(buf_len), K(pos), K(buf)); SERVER_LOG(WARN, "fail to print varchar literal", K(ret), K(def_obj), K(buf_len), K(pos), K(buf));
@ -570,7 +570,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString &database_name,
K(ret), K(def_obj)); K(ret), K(def_obj));
} else if (OB_ISNULL(res_cell)) { } else if (OB_ISNULL(res_cell)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
SERVER_LOG(ERROR, "succ to cast to ObVarcharType, but res_cell is NULL", SERVER_LOG(WARN, "succ to cast to ObVarcharType, but res_cell is NULL",
K(ret), K(def_obj)); K(ret), K(def_obj));
} else { } else {
cells[cell_idx] = *res_cell; cells[cell_idx] = *res_cell;
@ -954,7 +954,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const common::ObString &database_na
int64_t pos = 0; int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) { if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to allocate memory", K(ret)); SERVER_LOG(WARN, "fail to allocate memory", K(ret));
} else if (column_item.default_value_.is_bit()) { } else if (column_item.default_value_.is_bit()) {
if (OB_FAIL(column_item.default_value_.print_varchar_literal(buf, buf_len, pos, TZ_INFO(session_)))) { if (OB_FAIL(column_item.default_value_.print_varchar_literal(buf, buf_len, pos, TZ_INFO(session_)))) {
SERVER_LOG(WARN, "fail to print varchar literal", K(ret), K(column_item.default_value_), K(buf_len), K(pos), K(buf)); SERVER_LOG(WARN, "fail to print varchar literal", K(ret), K(column_item.default_value_), K(buf_len), K(pos), K(buf));
@ -980,7 +980,7 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const common::ObString &database_na
K(ret), K(column_item.default_value_)); K(ret), K(column_item.default_value_));
} else if (OB_ISNULL(res_cell)) { } else if (OB_ISNULL(res_cell)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
SERVER_LOG(ERROR, "succ to cast to ObVarcharType, but res_cell is NULL", SERVER_LOG(WARN, "succ to cast to ObVarcharType, but res_cell is NULL",
K(ret), K(column_item.default_value_)); K(ret), K(column_item.default_value_));
} else { } else {
cells[cell_idx] = *res_cell; cells[cell_idx] = *res_cell;

View File

@ -3376,7 +3376,7 @@ int ObSchemaGetterGuard::check_single_table_priv(const ObSessionPrivInfo &sessio
if (OB_FAIL(get_user_info(tenant_id, session_priv.user_id_, user_info))) { if (OB_FAIL(get_user_info(tenant_id, session_priv.user_id_, user_info))) {
LOG_WARN("failed to get user info", KR(ret), K(tenant_id), K(session_priv.user_id_)); LOG_WARN("failed to get user info", KR(ret), K(tenant_id), K(session_priv.user_id_));
} else if (NULL == user_info) { } else if (NULL == user_info) {
ret = OB_ERR_UNEXPECTED; ret = OB_USER_NOT_EXIST;
LOG_WARN("user info is null", KR(ret), K(session_priv.user_id_)); LOG_WARN("user info is null", KR(ret), K(session_priv.user_id_));
} else { } else {
const ObSEArray<uint64_t, 8> &role_id_array = user_info->get_role_id_array(); const ObSEArray<uint64_t, 8> &role_id_array = user_info->get_role_id_array();
@ -3473,7 +3473,12 @@ int ObSchemaGetterGuard::check_db_priv(const ObSessionPrivInfo &session_priv,
const ObUserInfo *user_info = NULL; const ObUserInfo *user_info = NULL;
//bool is_grant_role = false; //bool is_grant_role = false;
OZ (get_user_info(tenant_id, session_priv.user_id_, user_info), session_priv.user_id_); OZ (get_user_info(tenant_id, session_priv.user_id_, user_info), session_priv.user_id_);
CK (OB_NOT_NULL(user_info)); if (OB_SUCC(ret)) {
if (NULL == user_info) {
ret = OB_USER_NOT_EXIST;
LOG_WARN("user info is null", KR(ret), K(session_priv.user_id_));
}
}
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
const ObSEArray<uint64_t, 8> &role_id_array = user_info->get_role_id_array(); const ObSEArray<uint64_t, 8> &role_id_array = user_info->get_role_id_array();
for (int i = 0; OB_SUCC(ret) && i < role_id_array.count(); ++i) { for (int i = 0; OB_SUCC(ret) && i < role_id_array.count(); ++i) {