提交 d475941c 编写于 作者: W WenJinyu 提交者: LINGuanRen

add event backup_dest and add backup clean log

上级 643214fe
......@@ -2325,7 +2325,7 @@ int ObBackupDataClean::get_need_delete_backup_set_ids(
}
}
if (OB_SUCC(ret)) {
FLOG_WARN("succ get need delete backup set ids", K(backup_set_ids));
FLOG_INFO("[BACKUP_CLEAN]succ get need delete backup set ids", K(backup_set_ids));
}
}
return ret;
......@@ -2466,6 +2466,8 @@ int ObBackupDataClean::get_sys_tenant_prepare_clog_round_and_piece(const share::
"backup_piece",
"tenant_id",
clean_info.tenant_id_,
"round_id",
simple_piece_key.round_id_,
"backup_piece_id",
simple_piece_key.backup_piece_id_,
"copy_id",
......@@ -5132,6 +5134,8 @@ int ObBackupDataClean::set_current_backup_dest()
LOG_WARN("failed to set backup dest", K(ret), K(backup_dest_buf));
} else if (OB_FAIL(backup_dest_option_.init(false /*is_backup_backup*/))) {
LOG_WARN("failed to init backup dest option", K(ret));
} else {
LOG_INFO("[BACKUP_CLEAN]succ set current backup dest", K(backup_dest_buf));
}
if (OB_FAIL(ret)) {
......@@ -5143,6 +5147,8 @@ int ObBackupDataClean::set_current_backup_dest()
LOG_WARN("failed to set backup dest", K(ret), K(backup_dest_buf));
} else if (OB_FAIL(backup_backup_dest_option_.init(true /*is_backup_backup*/))) {
LOG_WARN("failed to init backup dest option", K(ret));
} else {
LOG_INFO("[BACKUP_CLEAN]succ set current backup backup dest", K(backup_backup_dest_buf));
}
return ret;
......@@ -6115,6 +6121,8 @@ int ObBackupDataClean::get_tenant_delete_piece(const share::ObBackupCleanInfo &c
"backup_piece",
"tenant_id",
clean_info.tenant_id_,
"round_id",
simple_piece_key.round_id_,
"backup_piece_id",
simple_piece_key.backup_piece_id_,
"copy_id",
......@@ -6303,6 +6311,8 @@ int ObBackupDataClean::prepare_delete_backup_piece_and_round(const ObBackupClean
"backup_piece",
"tenant_id",
sys_clean_info.tenant_id_,
"round_id",
simple_piece_key.round_id_,
"backup_piece_id",
simple_piece_key.backup_piece_id_,
"copy_id",
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册