fix comment is not cleaned after interruped.

This commit is contained in:
wxhwang 2023-05-09 17:48:45 +00:00 committed by ob-robot
parent f575a69ef8
commit daeaa9b5d7
3 changed files with 25 additions and 0 deletions

View File

@ -1400,3 +1400,23 @@ int ObArchivePersistHelper::do_parse_dest_pair_(sqlclient::ObMySQLResult &result
return ret;
}
int ObArchivePersistHelper::clean_round_comment(common::ObISQLClient &proxy, const int64_t dest_no) const
{
int ret = OB_SUCCESS;
ObInnerTableOperator round_table_operator;
ObTenantArchiveRoundAttr::Key key = {tenant_id_, dest_no};
int64_t affected_rows = 0;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ObArchivePersistHelper not init", K(ret));
} else if (OB_FAIL(round_table_operator.init(OB_ALL_LOG_ARCHIVE_PROGRESS_TNAME, *this))) {
LOG_WARN("failed to init round progress table", K(ret));
} else if (OB_FAIL(round_table_operator.update_string_column(proxy, key, "comment"/* column name */, "", affected_rows))) {
LOG_WARN("failed to clean round comment", K(ret), K(key));
}
return ret;
}

View File

@ -112,6 +112,7 @@ public:
// dest round operation
int get_round(common::ObISQLClient &proxy, const int64_t dest_no,
const bool need_lock, ObTenantArchiveRoundAttr &round) const;
int clean_round_comment(common::ObISQLClient &proxy, const int64_t dest_no) const;
int get_round_by_dest_id(common::ObISQLClient &proxy, const int64_t dest_id,
const bool need_lock, ObTenantArchiveRoundAttr &round) const;
int del_round(common::ObISQLClient &proxy, const int64_t dest_no) const;

View File

@ -266,6 +266,8 @@ int ObArchiveRoundHandler::disable_archive(const int64_t dest_no, ObTenantArchiv
LOG_WARN("cannot stop log archive", K(ret), K(round));
} else if (OB_FAIL(archive_table_op_.switch_round_state_to(trans, round, next_state))) {
LOG_WARN("failed to switch state", K(ret), K(round), K(next_state));
} else if (OB_FAIL(archive_table_op_.clean_round_comment(trans, dest_no))) {
LOG_WARN("failed to clean comment", K(ret), K(round));
} else if (OB_FAIL(trans.end(true))) {
LOG_WARN("failed to commit trans", K(ret), K(round));
} else {
@ -302,6 +304,8 @@ int ObArchiveRoundHandler::defer_archive(const int64_t dest_no, ObTenantArchiveR
LOG_WARN("cannot defer log archive", K(ret), K(round));
} else if (OB_FAIL(archive_table_op_.switch_round_state_to(trans, round, next_state))) {
LOG_WARN("failed to switch state", K(ret), K(round), K(next_state));
} else if (OB_FAIL(archive_table_op_.clean_round_comment(trans, dest_no))) {
LOG_WARN("failed to clean comment", K(ret), K(round));
} else if (OB_FAIL(trans.end(true))) {
LOG_WARN("failed to commit trans", K(ret), K(round));
} else {