fix log service_type core
This commit is contained in:
@ -286,6 +286,10 @@ int log_base_type_to_string(const ObLogBaseType log_type,
|
||||
} else {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (str_len > 0) {
|
||||
str[str_len - 1] = '\0';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -194,7 +194,6 @@ int ObAllVirtualCheckpointInfo::process_curr_tenant(ObNewRow *&row)
|
||||
sizeof(service_type_buf_)))) {
|
||||
SERVER_LOG(WARN, "get service type buf failed", K(ret), K(checkpoint));
|
||||
} else {
|
||||
service_type_buf_[MAX_SERVICE_TYPE_BUF_LENGTH - 1] = '\0';
|
||||
cur_row_.cells_[i].set_varchar(service_type_buf_);
|
||||
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
|
||||
}
|
||||
|
||||
@ -130,16 +130,17 @@ void ObCheckpointExecutor::get_min_rec_scn(int &log_type, SCN &min_rec_scn) cons
|
||||
}
|
||||
}
|
||||
|
||||
inline void get_min_rec_scn_service_type_by_index_(int index, char* service_type)
|
||||
inline void get_min_rec_scn_service_type_by_index_(int index, char* service_type, const int64_t str_len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (index == 0) {
|
||||
strncpy(service_type ,"MAX_DECIDED_SCN", common::MAX_SERVICE_TYPE_BUF_LENGTH);
|
||||
} else if (OB_FAIL(log_base_type_to_string(ObLogBaseType(index),
|
||||
service_type,
|
||||
common::MAX_SERVICE_TYPE_BUF_LENGTH))) {
|
||||
strncpy(service_type ,"MAX_DECIDED_SCN", str_len);
|
||||
} else if (OB_FAIL(log_base_type_to_string(ObLogBaseType(index), service_type, str_len))) {
|
||||
STORAGE_LOG(WARN, "log_base_type_to_string failed", K(ret), K(index));
|
||||
strncpy(service_type ,"UNKNOWN_SERVICE_TYPE", common::MAX_SERVICE_TYPE_BUF_LENGTH);
|
||||
strncpy(service_type ,"UNKNOWN_SERVICE_TYPE", str_len);
|
||||
}
|
||||
if (str_len > 0) {
|
||||
service_type[str_len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,9 +176,10 @@ int ObCheckpointExecutor::update_clog_checkpoint()
|
||||
} else {
|
||||
// used to record which handler provide the smallest rec_scn
|
||||
int min_rec_scn_service_type_index = 0;
|
||||
char service_type[common::MAX_SERVICE_TYPE_BUF_LENGTH];
|
||||
const int64_t buf_len = common::MAX_SERVICE_TYPE_BUF_LENGTH;
|
||||
char service_type[buf_len];
|
||||
get_min_rec_scn(min_rec_scn_service_type_index, checkpoint_scn);
|
||||
get_min_rec_scn_service_type_by_index_(min_rec_scn_service_type_index, service_type);
|
||||
get_min_rec_scn_service_type_by_index_(min_rec_scn_service_type_index, service_type, buf_len);
|
||||
|
||||
const SCN checkpoint_scn_in_ls_meta = ls_->get_clog_checkpoint_scn();
|
||||
const share::ObLSID ls_id = ls_->get_ls_id();
|
||||
|
||||
Reference in New Issue
Block a user