add event backup_dest and add backup clean log

This commit is contained in:
WenJinyu
2022-03-15 12:01:39 +08:00
committed by LINxiansheng
parent 643214fe3a
commit d475941c8d
2 changed files with 54 additions and 1 deletions

View File

@ -36,6 +36,7 @@
#include "common/sql_mode/ob_sql_mode_utils.h"
#include "sql/resolver/cmd/ob_variable_set_stmt.h"
#include "observer/ob_server.h"
#include "rootserver/ob_rs_event_history_table_operator.h"
namespace oceanbase {
using namespace common;
@ -1547,6 +1548,23 @@ int check_backup_dest(const ObString& backup_dest)
}
}
if (OB_SUCC(ret)) {
share::ObBackupDest old_dest;
if (OB_FAIL(GCONF.backup_dest.copy(backup_dest_buf, sizeof(backup_dest_buf)))) {
LOG_WARN("failed to set backup dest buf", K(ret));
} else if (0 == strlen(backup_dest_buf)) {
LOG_INFO("[BACKUP_DEST]set new backup dest", K(dest));
ROOTSERVICE_EVENT_ADD(
"backup_dest", "backup_dest", "old_backup_dest", "null", "new_backup_dest", dest.root_path_);
} else if (OB_FAIL(old_dest.set(backup_dest_buf))) {
LOG_WARN("failed to set conf backup dest", K(ret), K(backup_dest_buf));
} else {
LOG_INFO("[BACKUP_DEST]set new backup dest", K(old_dest), K(dest));
ROOTSERVICE_EVENT_ADD(
"backup_dest", "backup_dest", "old_backup_dest", old_dest.root_path_, "new_backup_dest", dest.root_path_);
}
}
return ret;
}
@ -1727,6 +1745,31 @@ int check_backup_backup_dest(const ObString& backup_backup_dest)
ret = OB_INVALID_BACKUP_DEST;
LOG_ERROR("cannot use backup backup dest with non empty directory", K(ret));
}
if (OB_SUCC(ret)) {
share::ObBackupDest old_dest;
if (OB_FAIL(GCONF.backup_backup_dest.copy(backup_backup_dest_buf, sizeof(backup_backup_dest_buf)))) {
LOG_WARN("failed to set backup backup dest buf", K(ret));
} else if (0 == strlen(backup_backup_dest_buf)) {
LOG_INFO("[BACKUP_DEST]set new backup backup dest", K(dst_dest));
ROOTSERVICE_EVENT_ADD("backup_dest",
"backup_backup_dest",
"old_backup_backup_dest",
"null",
"new_backup_backup_dest",
dst_dest.root_path_);
} else if (OB_FAIL(old_dest.set(backup_backup_dest_buf))) {
LOG_WARN("failed to set conf backup backup dest", K(ret), K(backup_backup_dest_buf));
} else {
LOG_INFO("[BACKUP_DEST]set new backup backup dest", K(old_dest), K(dst_dest));
ROOTSERVICE_EVENT_ADD("backup_dest",
"backup_backup_dest",
"old_backup_backup_dest",
old_dest.root_path_,
"new_backup_backup_dest",
dst_dest.root_path_);
}
}
return ret;
}