fix typos from open github issue

This commit is contained in:
xy0
2022-03-04 19:48:51 +08:00
committed by LINxiansheng
parent 42fcd3dd80
commit 25bd25175f
4 changed files with 1320 additions and 1325 deletions

View File

@ -582,7 +582,7 @@ int ObElection::process_devote_success_(const ObElectionMsgDESuccess& msg)
(void)update_info_from_eg_(); (void)update_info_from_eg_();
} }
ret = OB_ELECTION_WARN_PROTOCOL_ERROR; ret = OB_ELECTION_WARN_PROTOCOL_ERROR;
FORCE_ELECT_LOG(WARN, "leader available but recevive devote_success message", K(ret), K(*this), K(msg)); FORCE_ELECT_LOG(WARN, "leader available but receive devote_success message", K(ret), K(*this), K(msg));
} }
} else if (NULL != election_group_) { } else if (NULL != election_group_) {
// current leader is invalid, need move out from election group // current leader is invalid, need move out from election group
@ -633,7 +633,7 @@ int ObElection::local_handle_devote_success_(const ObElectionMsgDESuccess& msg)
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
ELECT_ASYNC_LOG_(WARN, "invalid argument", K(ret), K_(partition), K(msg)); ELECT_ASYNC_LOG_(WARN, "invalid argument", K(ret), K_(partition), K(msg));
} else if (OB_FAIL(process_devote_success_(msg))) { } else if (OB_FAIL(process_devote_success_(msg))) {
ELECT_ASYNC_LOG_(WARN, "process_devote_success_ faield", K(ret), K_(partition), K(msg)); ELECT_ASYNC_LOG_(WARN, "process_devote_success_ failed", K(ret), K_(partition), K(msg));
} else { } else {
} }
@ -987,7 +987,7 @@ int ObElection::process_vote_success_(const ObElectionMsgSuccess& msg)
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (msg.get_last_leader_epoch() != OB_INVALID_TIMESTAMP && if (msg.get_last_leader_epoch() != OB_INVALID_TIMESTAMP &&
(max_leader_epoch_ever_seen_ == OB_INVALID_TIMESTAMP || // avoid OB_INVALID_TIMESTAMP definded too large (max_leader_epoch_ever_seen_ == OB_INVALID_TIMESTAMP || // avoid OB_INVALID_TIMESTAMP defined too large
msg.get_last_leader_epoch() > max_leader_epoch_ever_seen_)) { msg.get_last_leader_epoch() > max_leader_epoch_ever_seen_)) {
max_leader_epoch_ever_seen_ = msg.get_last_leader_epoch(); max_leader_epoch_ever_seen_ = msg.get_last_leader_epoch();
} }
@ -1215,7 +1215,7 @@ int ObElection::handle_query_leader(const ObElectionQueryLeader& msg, ObElection
ELECT_ASYNC_LOG_(WARN, "election is not running", K(ret), K_(partition), K(msg)); ELECT_ASYNC_LOG_(WARN, "election is not running", K(ret), K_(partition), K(msg));
} else if (!msg.is_valid()) { } else if (!msg.is_valid()) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
ELECT_ASYNC_LOG_(WARN, "invalid argumenet", K(ret), K_(partition), K(msg)); ELECT_ASYNC_LOG_(WARN, "invalid argument", K(ret), K_(partition), K(msg));
} else { } else {
const int64_t cur_ts = get_current_ts(); const int64_t cur_ts = get_current_ts();
const ObAddr &sender = msg.get_sender(); const ObAddr &sender = msg.get_sender();
@ -1810,7 +1810,7 @@ int ObElection::update_info_from_eg_()
const int64_t cur_ts = get_current_ts(); const int64_t cur_ts = get_current_ts();
if (OB_FAIL(election_group_->get_leader_lease_info( if (OB_FAIL(election_group_->get_leader_lease_info(
partition_, eg_part_array_idx_, cur_ts, eg_lease_end, eg_takeover_t1_ts))) { partition_, eg_part_array_idx_, cur_ts, eg_lease_end, eg_takeover_t1_ts))) {
FORCE_ELECT_LOG(WARN, "get_leader_lease_info failed", K(ret), K_(partition), "eleciton", *this); FORCE_ELECT_LOG(WARN, "get_leader_lease_info failed", K(ret), K_(partition), "election", *this);
} else if (eg_lease_end < 0) { } else if (eg_lease_end < 0) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
FORCE_ELECT_LOG(ERROR, "eg_lease_end is invalid", K(ret), K(eg_lease_end), "election", *this); FORCE_ELECT_LOG(ERROR, "eg_lease_end is invalid", K(ret), K(eg_lease_end), "election", *this);
@ -2292,7 +2292,7 @@ int ObElection::move_into_election_group_unlock_(const ObElectionGroupId& eg_id)
} }
} else if (!current_leader_.is_valid() || current_leader_ != eg_id.get_server() || } else if (!current_leader_.is_valid() || current_leader_ != eg_id.get_server() ||
!is_real_leader_(current_leader_)) { !is_real_leader_(current_leader_)) {
// allow follower moive in only if leader is valid and match group's leader // allow follower move in only if leader is valid and match group's leader
ret = OB_STATE_NOT_MATCH; ret = OB_STATE_NOT_MATCH;
if (REACH_TIME_INTERVAL(100 * 1000)) { if (REACH_TIME_INTERVAL(100 * 1000)) {
FORCE_ELECT_LOG(WARN, "current_leader_ not match with eg_id", K(ret), K(eg_id), "election", *this); FORCE_ELECT_LOG(WARN, "current_leader_ not match with eg_id", K(ret), K(eg_id), "election", *this);
@ -2502,7 +2502,7 @@ bool ObElection::can_elect_new_leader_() const
bool_ret = false; bool_ret = false;
} else if (common::PRIMARY_CLUSTER == cluster_type || } else if (common::PRIMARY_CLUSTER == cluster_type ||
ObMultiClusterUtil::is_cluster_private_table(partition_.get_table_id())) { ObMultiClusterUtil::is_cluster_private_table(partition_.get_table_id())) {
// main datebase or private table allow elect // main database or private table allow elect
bool_ret = true; bool_ret = true;
} else if (share::OBSERVER_INVALID_STATUS == server_status) { } else if (share::OBSERVER_INVALID_STATUS == server_status) {
// server status unknown, non-private table not allow to elect // server status unknown, non-private table not allow to elect
@ -2538,7 +2538,7 @@ void ObElection::run_gt1_task(const int64_t real_T1_timestamp)
election_time_offset_ = new_election_time_offset_; election_time_offset_ = new_election_time_offset_;
temp_election_time_offset_ = election_time_offset_; temp_election_time_offset_ = election_time_offset_;
takeover_t1_timestamp_ = 0; takeover_t1_timestamp_ = 0;
ELECT_ASYNC_LOG(INFO, "be dead, parameters conversion is compeleted", "election", *this); ELECT_ASYNC_LOG(INFO, "be dead, parameters conversion is completed", "election", *this);
} else { } else {
} }
/*********************************************************************************************/ /*********************************************************************************************/
@ -3281,7 +3281,7 @@ int ObElection::check_centralized_majority_()
} else if (is_candidate_(self_) && is_real_leader_(self_) && cur_leader == current_leader_) { } else if (is_candidate_(self_) && is_real_leader_(self_) && cur_leader == current_leader_) {
bool change_leader = false; bool change_leader = false;
if (cur_leader != new_leader) { // change leader if (cur_leader != new_leader) { // change leader
// need new leader's message and its prioeity // need new leader's message and its priority
if (!new_leader_priority.is_valid()) { if (!new_leader_priority.is_valid()) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
FORCE_ELECT_LOG(WARN, "change leader but new leader priority is invalid", K(ret), K(new_leader_priority)); FORCE_ELECT_LOG(WARN, "change leader but new leader priority is invalid", K(ret), K(new_leader_priority));

View File

@ -101,7 +101,7 @@ int ObElectionGroup::init(const ObElectionGroupId& eg_id, const ObAddr& self, co
ObIElectionRpc *rpc, ObTimeWheel *tw, ObIElectionMgr *election_mgr, ObElectionGroupCache *election_group_cache, ObIElectionRpc *rpc, ObTimeWheel *tw, ObIElectionMgr *election_mgr, ObElectionGroupCache *election_group_cache,
ObIElectionGroupPriorityGetter *eg_cb, ObIElectionGroupMgr *eg_mgr) ObIElectionGroupPriorityGetter *eg_cb, ObIElectionGroupMgr *eg_mgr)
{ {
// init for follower elction group // init for follower election group
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (is_inited_) { if (is_inited_) {
@ -360,7 +360,7 @@ bool ObElectionGroup::is_need_check_eg_version(const int64_t msg_eg_version) con
int ObElectionGroup::check_eg_version(const int64_t msg_eg_version, const ObPartitionArray &partition_array, int ObElectionGroup::check_eg_version(const int64_t msg_eg_version, const ObPartitionArray &partition_array,
ObPartitionArray &pending_move_out_array, ObPartitionArray &pending_move_in_array) ObPartitionArray &pending_move_out_array, ObPartitionArray &pending_move_in_array)
{ {
// check version before follower group process messsages // check version before follower group process messages
// is_running may be false for follower group // is_running may be false for follower group
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
@ -1174,7 +1174,7 @@ int ObElectionGroup::check_centralized_majority_()
new_leader, new_leader,
is_all_part_merged_in_, is_all_part_merged_in_,
is_eg_majority, is_eg_majority,
part_state_array_, // for counting every singal partition's tick part_state_array_, // for counting every single partition's tick
partition_array_, partition_array_,
eg_version_, eg_version_,
replica_num_, replica_num_,
@ -1580,7 +1580,7 @@ int ObElectionGroup::leader_reappoint_(const bool need_update_eg_lease, const Ob
ObElectionRole::ROLE_LEADER == role_ && // need check lease only if I'm leader ObElectionRole::ROLE_LEADER == role_ && // need check lease only if I'm leader
cur_ts > leader_lease_.second) { // check if lease has been expired cur_ts > leader_lease_.second) { // check if lease has been expired
// maybe lease expired event has been exposed to others, leader epoch should pushed // maybe lease expired event has been exposed to others, leader epoch should pushed
// give up renew lease, group will be destoryed // give up renew lease, group will be destroyed
ret = OB_ELECTION_WARN_LEADER_LEASE_EXPIRED; ret = OB_ELECTION_WARN_LEADER_LEASE_EXPIRED;
FORCE_ELECT_LOG(WARN, FORCE_ELECT_LOG(WARN,
"group leader lease expired, give up reappointing", "group leader lease expired, give up reappointing",

View File

@ -276,7 +276,7 @@ int ObEGVoteMsgPool::get_eg_centralized_majority_(common::ObAddr& cur_leader, co
ELECT_ASYNC_LOG(WARN, "message t1 timestamp not match", K(i), K(hash), K(t1), K(msg), K(msg_cnt)); ELECT_ASYNC_LOG(WARN, "message t1 timestamp not match", K(i), K(hash), K(t1), K(msg), K(msg_cnt));
// yes, continue // yes, continue
} else { } else {
int64_t ticket = 0; // totle ticket int64_t ticket = 0; // total ticket
int64_t eg_vote_cnt = 0; // the ticket in same version int64_t eg_vote_cnt = 0; // the ticket in same version
bool is_leader_sender = false; bool is_leader_sender = false;
tmp_cur_leader = msg.get_cur_leader(); tmp_cur_leader = msg.get_cur_leader();
@ -313,7 +313,7 @@ int ObEGVoteMsgPool::get_eg_centralized_majority_(common::ObAddr& cur_leader, co
if (eg_vote_cnt > replica_num / 2) { if (eg_vote_cnt > replica_num / 2) {
if (false == is_all_part_merged_in) { // first merge-in, need check lease of every election if (false == is_all_part_merged_in) { // first merge-in, need check lease of every election
process_vote_cnt_(eg_vote_cnt, replica_num, part_state_array, is_eg_majority, cur_ts); process_vote_cnt_(eg_vote_cnt, replica_num, part_state_array, is_eg_majority, cur_ts);
} else { // already in merge-in state, no need to check lease of singal election, cause that lease is not } else { // already in merge-in state, no need to check lease of single election, cause that lease is not
// maintained anymore // maintained anymore
is_eg_majority = true; is_eg_majority = true;
} }

View File

@ -7835,7 +7835,7 @@ int ObDDLService::truncate_table(const ObTruncateTableArg& arg, const int64_t fr
LOG_WARN("fail to check table has materialized view", K(ret), K(*orig_table_schema)); LOG_WARN("fail to check table has materialized view", K(ret), K(*orig_table_schema));
} else if (has_mv) { } else if (has_mv) {
ret = OB_NOT_SUPPORTED; ret = OB_NOT_SUPPORTED;
LOG_WARN("not support trunate table has materialized view", K(ret)); LOG_WARN("not support truncate table has materialized view", K(ret));
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
// When truncate table, check whether the table being truncate is the parent table // When truncate table, check whether the table being truncate is the parent table
@ -7882,8 +7882,8 @@ int ObDDLService::truncate_table(const ObTruncateTableArg& arg, const int64_t fr
FOREACH_CNT_X(foreign_key_info, foreign_key_infos, OB_SUCC(ret)) FOREACH_CNT_X(foreign_key_info, foreign_key_infos, OB_SUCC(ret))
{ {
if (orig_table_schema->get_table_id() == foreign_key_info->parent_table_id_) { if (orig_table_schema->get_table_id() == foreign_key_info->parent_table_id_) {
if (OB_UNLIKELY( if (OB_UNLIKELY(NULL == (err_desciption_buf =
NULL == (err_desciption_buf = static_cast<char*>(allocator.alloc(err_desciption_buf_len))))) { static_cast<char *>(allocator.alloc(err_desciption_buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(ERROR, "fail to alloc table_def_buf", K(ret)); SERVER_LOG(ERROR, "fail to alloc table_def_buf", K(ret));
} else if (OB_FAIL(fill_truncate_table_fk_err_msg(*foreign_key_info, } else if (OB_FAIL(fill_truncate_table_fk_err_msg(*foreign_key_info,
@ -17277,12 +17277,11 @@ int ObDDLService::set_passwd(const ObSetPasswdArg& arg)
} else if (share::schema::ObSSLType::SSL_TYPE_NOT_SPECIFIED == ssl_type) { } else if (share::schema::ObSSLType::SSL_TYPE_NOT_SPECIFIED == ssl_type) {
if (modify_max_connections) { if (modify_max_connections) {
if (OB_FAIL(ObDDLSqlGenerator::gen_set_max_connections_sql( if (OB_FAIL(ObDDLSqlGenerator::gen_set_max_connections_sql(
ObAccountArg(user_name, host_name), max_connections_per_hour, max_user_connections, ObAccountArg(user_name, host_name), max_connections_per_hour, max_user_connections, ddl_stmt_str))) {
ddl_stmt_str))) {
LOG_WARN("gen_set_passwd_sql failed", K(ret), K(arg)); LOG_WARN("gen_set_passwd_sql failed", K(ret), K(arg));
} else if (FALSE_IT(ddl_sql = ddl_stmt_str.string())) { } else if (FALSE_IT(ddl_sql = ddl_stmt_str.string())) {
} else if (OB_FAIL(set_max_connection_in_trans(tenant_id, user_id, } else if (OB_FAIL(set_max_connection_in_trans(
max_connections_per_hour, max_user_connections, &ddl_sql))) { tenant_id, user_id, max_connections_per_hour, max_user_connections, &ddl_sql))) {
LOG_WARN("Set passwd failed", K(tenant_id), K(user_id), K(passwd), K(ret)); LOG_WARN("Set passwd failed", K(tenant_id), K(user_id), K(passwd), K(ret));
} }
} else { } else {
@ -17344,12 +17343,8 @@ int ObDDLService::set_passwd_in_trans(
return ret; return ret;
} }
int ObDDLService::set_max_connection_in_trans( int ObDDLService::set_max_connection_in_trans(const uint64_t tenant_id, const uint64_t user_id,
const uint64_t tenant_id, const uint64_t max_connections_per_hour, const uint64_t max_user_connections, const ObString *ddl_stmt_str)
const uint64_t user_id,
const uint64_t max_connections_per_hour,
const uint64_t max_user_connections,
const ObString *ddl_stmt_str)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObDDLSQLTransaction trans(schema_service_); ObDDLSQLTransaction trans(schema_service_);
@ -17363,8 +17358,8 @@ int ObDDLService::set_max_connection_in_trans(
LOG_WARN("Start transaction failed", K(ret)); LOG_WARN("Start transaction failed", K(ret));
} else { } else {
ObDDLOperator ddl_operator(*schema_service_, *sql_proxy_); ObDDLOperator ddl_operator(*schema_service_, *sql_proxy_);
if (OB_FAIL(ddl_operator.set_max_connections(tenant_id, user_id, max_connections_per_hour, if (OB_FAIL(ddl_operator.set_max_connections(
max_user_connections, ddl_stmt_str, trans))) { tenant_id, user_id, max_connections_per_hour, max_user_connections, ddl_stmt_str, trans))) {
LOG_WARN("fail to set password", K(ret), K(tenant_id), K(user_id)); LOG_WARN("fail to set password", K(ret), K(tenant_id), K(user_id));
} }
if (trans.is_started()) { if (trans.is_started()) {