Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
oceanbase
提交
1bb97602
O
oceanbase
项目概览
野花太放肆
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1bb97602
编写于
3月 09, 2023
作者:
W
WenJinyu
提交者:
ob-robot
3月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix when delete specified backup_set, the round task is deleted
上级
4036f512
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
154 addition
and
110 deletion
+154
-110
src/rootserver/ob_backup_data_clean.cpp
src/rootserver/ob_backup_data_clean.cpp
+142
-110
src/rootserver/ob_backup_data_clean.h
src/rootserver/ob_backup_data_clean.h
+12
-0
未找到文件。
src/rootserver/ob_backup_data_clean.cpp
浏览文件 @
1bb97602
...
...
@@ -2416,6 +2416,142 @@ int ObBackupDataClean::get_sys_tenant_delete_clog_round_and_piece(const share::O
return
ret
;
}
int
ObBackupDataClean
::
get_sys_tenant_prepare_clog_piece
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObLogArchiveRound
&
log_archive_round
,
const
ObBackupDataCleanElement
&
clean_element
,
bool
&
is_delete_inorder
,
common
::
ObIArray
<
ObBackupPieceInfoKey
>
&
backup_piece_keys
)
{
int
ret
=
OB_SUCCESS
;
const
int64_t
backup_copies
=
clean_element
.
backup_dest_option_
.
backup_copies_
;
const
bool
overwrite_key
=
true
;
ObSimplePieceKey
simple_piece_key
;
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"backup data clean do not init"
,
K
(
ret
));
}
else
if
(
!
clean_info
.
is_valid
()
||
!
log_archive_round
.
is_valid
()
||
!
clean_element
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"argument is invalid"
,
K
(
ret
),
K
(
clean_info
),
K
(
log_archive_round
),
K
(
clean_element
));
}
else
{
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
is_delete_inorder
&&
j
<
log_archive_round
.
piece_infos_
.
count
();
++
j
)
{
const
ObSimplePieceInfo
&
simple_piece_info
=
log_archive_round
.
piece_infos_
.
at
(
j
);
if
(
simple_piece_info
.
max_ts_
>
clean_info
.
clog_gc_snapshot_
||
ObBackupPieceStatus
::
BACKUP_PIECE_FROZEN
!=
simple_piece_info
.
status_
||
ObBackupFileStatus
::
BACKUP_FILE_COPYING
==
simple_piece_info
.
file_status_
||
simple_piece_info
.
copies_num_
<
backup_copies
)
{
is_delete_inorder
=
false
;
}
else
if
(
ObBackupFileStatus
::
BACKUP_FILE_DELETED
==
simple_piece_info
.
file_status_
)
{
// do nothing
}
else
{
ObBackupPieceInfoKey
piece_info_key
;
piece_info_key
.
backup_piece_id_
=
simple_piece_info
.
backup_piece_id_
;
piece_info_key
.
copy_id_
=
log_archive_round
.
copy_id_
;
piece_info_key
.
incarnation_
=
clean_element
.
incarnation_
;
piece_info_key
.
round_id_
=
log_archive_round
.
log_archive_round_
;
piece_info_key
.
tenant_id_
=
clean_info
.
tenant_id_
;
simple_piece_key
.
reset
();
simple_piece_key
.
incarnation_
=
piece_info_key
.
incarnation_
;
simple_piece_key
.
round_id_
=
piece_info_key
.
round_id_
;
simple_piece_key
.
backup_piece_id_
=
piece_info_key
.
backup_piece_id_
;
simple_piece_key
.
copy_id_
=
piece_info_key
.
copy_id_
;
char
trace_id
[
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
]
=
""
;
int
trace_length
=
0
;
if
(
OB_FAIL
(
backup_piece_keys
.
push_back
(
piece_info_key
)))
{
LOG_WARN
(
"failed to push piece info key into array"
,
K
(
ret
),
K
(
simple_piece_info
),
K
(
piece_info_key
));
}
else
if
(
OB_FAIL
(
sys_tenant_deleted_backup_piece_
.
set_refactored_1
(
simple_piece_key
,
overwrite_key
)))
{
LOG_WARN
(
"failed to set simple piece key"
,
K
(
ret
),
K
(
simple_piece_key
));
}
else
if
(
FALSE_IT
(
trace_length
=
ObCurTraceId
::
get_trace_id
()
->
to_string
(
trace_id
,
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
)))
{
}
else
if
(
trace_length
>
OB_MAX_TRACE_ID_BUFFER_SIZE
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"failed to get trace id"
,
K
(
ret
),
K
(
*
ObCurTraceId
::
get_trace_id
()));
}
else
{
FLOG_INFO
(
"[BACKUP_CLEAN]succ add backup clean piece"
,
K
(
simple_piece_key
),
K
(
clean_info
));
ROOTSERVICE_EVENT_ADD
(
"backup_clean"
,
"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"
,
simple_piece_key
.
copy_id_
,
"trace_id"
,
trace_id
);
}
}
}
}
return
ret
;
}
int
ObBackupDataClean
::
get_sys_tenant_prepare_clog_round
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObLogArchiveRound
&
log_archive_round
,
const
ObBackupDataCleanElement
&
clean_element
,
bool
&
is_delete_inorder
,
common
::
ObIArray
<
ObLogArchiveRound
>
&
log_archive_rounds
)
{
int
ret
=
OB_SUCCESS
;
const
int64_t
backup_copies
=
clean_element
.
backup_dest_option_
.
backup_copies_
;
const
bool
overwrite_key
=
true
;
ObSimpleArchiveRound
simple_archive_round
;
int
piece_num
=
log_archive_round
.
piece_infos_
.
count
();
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"backup data clean do not init"
,
K
(
ret
));
}
else
if
(
!
clean_info
.
is_valid
()
||
!
log_archive_round
.
is_valid
()
||
!
clean_element
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"argument is invalid"
,
K
(
ret
),
K
(
clean_info
),
K
(
log_archive_round
),
K
(
clean_element
));
}
else
if
(
ObLogArchiveStatus
::
STOP
!=
log_archive_round
.
log_archive_status_
)
{
// do nothing
}
else
if
(
log_archive_round
.
checkpoint_ts_
>
clean_info
.
clog_gc_snapshot_
||
log_archive_round
.
copies_num_
<
backup_copies
)
{
is_delete_inorder
=
false
;
}
else
if
(
piece_num
<
0
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"piece num is less than 0"
,
K
(
piece_num
),
K
(
log_archive_round
));
}
else
{
if
(
0
==
piece_num
)
{
is_delete_inorder
=
true
;
}
else
{
const
ObSimplePieceInfo
&
simple_piece_info
=
log_archive_round
.
piece_infos_
.
at
(
piece_num
-
1
);
if
(
simple_piece_info
.
max_ts_
>
clean_info
.
clog_gc_snapshot_
)
{
is_delete_inorder
=
false
;
}
}
if
(
!
is_delete_inorder
)
{
}
else
if
(
OB_FAIL
(
log_archive_rounds
.
push_back
(
log_archive_round
)))
{
LOG_WARN
(
"failed to push log archive round into array"
,
K
(
ret
),
K
(
log_archive_round
));
}
else
{
char
trace_id
[
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
]
=
""
;
int
trace_length
=
0
;
simple_archive_round
.
reset
();
simple_archive_round
.
incarnation_
=
clean_element
.
incarnation_
;
simple_archive_round
.
round_id_
=
log_archive_round
.
log_archive_round_
;
simple_archive_round
.
copy_id_
=
log_archive_round
.
copy_id_
;
if
(
OB_FAIL
(
sys_tenant_deleted_backup_round_
.
set_refactored_1
(
simple_archive_round
,
overwrite_key
)))
{
LOG_WARN
(
"failed to set sys tenant deleted backup round"
,
K
(
ret
),
K
(
simple_archive_round
));
}
else
if
(
FALSE_IT
(
trace_length
=
ObCurTraceId
::
get_trace_id
()
->
to_string
(
trace_id
,
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
)))
{
}
else
if
(
trace_length
>
OB_MAX_TRACE_ID_BUFFER_SIZE
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"failed to get trace id"
,
K
(
ret
),
K
(
*
ObCurTraceId
::
get_trace_id
()));
}
else
{
FLOG_INFO
(
"[BACKUP_CLEAN]succ add backup clean round"
,
K
(
simple_archive_round
),
K
(
clean_info
));
ROOTSERVICE_EVENT_ADD
(
"backup_clean"
,
"backup_round"
,
"tenant_id"
,
clean_info
.
tenant_id_
,
"round_id"
,
simple_archive_round
.
round_id_
,
"copy_id"
,
simple_archive_round
.
copy_id_
,
"trace_id"
,
trace_id
);
}
}
}
return
ret
;
}
int
ObBackupDataClean
::
get_sys_tenant_prepare_clog_round_and_piece
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObBackupDataCleanElement
&
clean_element
,
common
::
ObIArray
<
ObLogArchiveRound
>
&
log_archive_rounds
,
common
::
ObIArray
<
ObBackupPieceInfoKey
>
&
backup_piece_keys
)
...
...
@@ -2423,16 +2559,8 @@ int ObBackupDataClean::get_sys_tenant_prepare_clog_round_and_piece(const share::
int
ret
=
OB_SUCCESS
;
log_archive_rounds
.
reset
();
backup_piece_keys
.
reset
();
const
int64_t
clog_gc_snapshot
=
clean_info
.
clog_gc_snapshot_
;
ObLogArchiveBackupInfoMgr
log_info_mgr
;
const
uint64_t
tenant_id
=
clean_info
.
tenant_id_
;
const
int64_t
incarnation
=
clean_element
.
incarnation_
;
const
int64_t
backup_copies
=
clean_element
.
backup_dest_option_
.
backup_copies_
;
ObSimpleArchiveRound
simple_archive_round
;
ObSimplePieceKey
simple_piece_key
;
const
bool
overwrite_key
=
true
;
bool
is_delete_inorder
=
true
;
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"backup data clean do not init"
,
K
(
ret
));
...
...
@@ -2447,108 +2575,12 @@ int ObBackupDataClean::get_sys_tenant_prepare_clog_round_and_piece(const share::
break
;
}
else
if
(
clean_info
.
is_delete_backup_set
()
&&
0
!=
log_archive_round
.
start_piece_id_
)
{
// do nothing
}
else
{
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
is_delete_inorder
&&
j
<
log_archive_round
.
piece_infos_
.
count
();
++
j
)
{
const
ObSimplePieceInfo
&
simple_piece_info
=
log_archive_round
.
piece_infos_
.
at
(
j
);
if
(
simple_piece_info
.
max_ts_
>
clog_gc_snapshot
||
ObBackupPieceStatus
::
BACKUP_PIECE_FROZEN
!=
simple_piece_info
.
status_
||
ObBackupFileStatus
::
BACKUP_FILE_COPYING
==
simple_piece_info
.
file_status_
||
simple_piece_info
.
copies_num_
<
backup_copies
)
{
is_delete_inorder
=
false
;
}
else
if
(
ObBackupFileStatus
::
BACKUP_FILE_DELETED
==
simple_piece_info
.
file_status_
)
{
// do nothing
}
else
{
ObBackupPieceInfoKey
piece_info_key
;
piece_info_key
.
backup_piece_id_
=
simple_piece_info
.
backup_piece_id_
;
piece_info_key
.
copy_id_
=
log_archive_round
.
copy_id_
;
piece_info_key
.
incarnation_
=
incarnation
;
piece_info_key
.
round_id_
=
log_archive_round
.
log_archive_round_
;
piece_info_key
.
tenant_id_
=
tenant_id
;
simple_piece_key
.
reset
();
simple_piece_key
.
incarnation_
=
piece_info_key
.
incarnation_
;
simple_piece_key
.
round_id_
=
piece_info_key
.
round_id_
;
simple_piece_key
.
backup_piece_id_
=
piece_info_key
.
backup_piece_id_
;
simple_piece_key
.
copy_id_
=
piece_info_key
.
copy_id_
;
char
trace_id
[
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
]
=
""
;
int
trace_length
=
0
;
if
(
OB_FAIL
(
backup_piece_keys
.
push_back
(
piece_info_key
)))
{
LOG_WARN
(
"failed to push piece info key into array"
,
K
(
ret
),
K
(
simple_piece_info
),
K
(
piece_info_key
));
}
else
if
(
OB_FAIL
(
sys_tenant_deleted_backup_piece_
.
set_refactored_1
(
simple_piece_key
,
overwrite_key
)))
{
LOG_WARN
(
"failed to set simple piece key"
,
K
(
ret
),
K
(
simple_piece_key
));
}
else
if
(
FALSE_IT
(
trace_length
=
ObCurTraceId
::
get_trace_id
()
->
to_string
(
trace_id
,
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
)))
{
}
else
if
(
trace_length
>
OB_MAX_TRACE_ID_BUFFER_SIZE
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"failed to get trace id"
,
K
(
ret
),
K
(
*
ObCurTraceId
::
get_trace_id
()));
}
else
{
FLOG_INFO
(
"[BACKUP_CLEAN]succ add backup clean piece"
,
K
(
simple_piece_key
),
K
(
clean_info
));
ROOTSERVICE_EVENT_ADD
(
"backup_clean"
,
"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"
,
simple_piece_key
.
copy_id_
,
"trace_id"
,
trace_id
);
}
}
}
}
int
piece_num
=
log_archive_round
.
piece_infos_
.
count
();
if
(
OB_FAIL
(
ret
))
{
}
else
if
(
ObLogArchiveStatus
::
STOP
!=
log_archive_round
.
log_archive_status_
)
{
// do nothing
}
else
if
(
log_archive_round
.
checkpoint_ts_
>
clog_gc_snapshot
||
log_archive_round
.
copies_num_
<
backup_copies
)
{
is_delete_inorder
=
false
;
}
else
if
(
piece_num
<
0
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"piece num is less than 0"
,
K
(
piece_num
),
K
(
log_archive_round
));
}
else
{
if
(
0
==
piece_num
)
{
is_delete_inorder
=
true
;
}
else
{
const
ObSimplePieceInfo
&
simple_piece_info
=
log_archive_round
.
piece_infos_
.
at
(
piece_num
-
1
);
if
(
simple_piece_info
.
max_ts_
>
clog_gc_snapshot
)
{
is_delete_inorder
=
false
;
}
}
if
(
!
is_delete_inorder
)
{
}
else
if
(
OB_FAIL
(
log_archive_rounds
.
push_back
(
log_archive_round
)))
{
LOG_WARN
(
"failed to push log archive round into array"
,
K
(
ret
),
K
(
log_archive_round
));
}
else
{
char
trace_id
[
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
]
=
""
;
int
trace_length
=
0
;
simple_archive_round
.
reset
();
simple_archive_round
.
incarnation_
=
clean_element
.
incarnation_
;
simple_archive_round
.
round_id_
=
log_archive_round
.
log_archive_round_
;
simple_archive_round
.
copy_id_
=
log_archive_round
.
copy_id_
;
if
(
OB_FAIL
(
sys_tenant_deleted_backup_round_
.
set_refactored_1
(
simple_archive_round
,
overwrite_key
)))
{
LOG_WARN
(
"failed to set sys tenant deleted backup round"
,
K
(
ret
),
K
(
simple_archive_round
));
}
else
if
(
FALSE_IT
(
trace_length
=
ObCurTraceId
::
get_trace_id
()
->
to_string
(
trace_id
,
common
::
OB_MAX_TRACE_ID_BUFFER_SIZE
)))
{
}
else
if
(
trace_length
>
OB_MAX_TRACE_ID_BUFFER_SIZE
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"failed to get trace id"
,
K
(
ret
),
K
(
*
ObCurTraceId
::
get_trace_id
()));
}
else
{
FLOG_INFO
(
"[BACKUP_CLEAN]succ add backup clean round"
,
K
(
simple_archive_round
),
K
(
clean_info
));
ROOTSERVICE_EVENT_ADD
(
"backup_clean"
,
"backup_round"
,
"tenant_id"
,
clean_info
.
tenant_id_
,
"round_id"
,
simple_archive_round
.
round_id_
,
"copy_id"
,
simple_archive_round
.
copy_id_
,
"trace_id"
,
trace_id
);
}
}
}
else
if
(
OB_FAIL
(
get_sys_tenant_prepare_clog_piece
(
clean_info
,
log_archive_round
,
clean_element
,
is_delete_inorder
,
backup_piece_keys
)))
{
LOG_WARN
(
"get sys tenant delete clog piece"
,
K
(
ret
),
K
(
clean_info
),
K
(
log_archive_round
));
}
else
if
(
OB_FAIL
(
get_sys_tenant_prepare_clog_round
(
clean_info
,
log_archive_round
,
clean_element
,
is_delete_inorder
,
log_archive_rounds
)))
{
LOG_WARN
(
"get sys tenant delete clog round"
,
K
(
ret
),
K
(
clean_info
),
K
(
log_archive_round
),
K
(
backup_piece_keys
));
}
}
}
...
...
src/rootserver/ob_backup_data_clean.h
浏览文件 @
1bb97602
...
...
@@ -172,6 +172,18 @@ private:
const
ObBackupDataCleanElement
&
clean_element
,
common
::
ObIArray
<
ObLogArchiveRound
>
&
log_archive_rounds
,
common
::
ObIArray
<
ObBackupPieceInfoKey
>
&
backup_piece_keys
);
int
get_sys_tenant_prepare_clog_round
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObLogArchiveRound
&
log_archive_round
,
const
ObBackupDataCleanElement
&
clean_element
,
bool
&
is_delete_inorder
,
common
::
ObIArray
<
ObLogArchiveRound
>
&
log_archive_rounds
);
int
get_sys_tenant_prepare_clog_piece
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObLogArchiveRound
&
log_archive_round
,
const
ObBackupDataCleanElement
&
clean_element
,
bool
&
is_delete_inorder
,
common
::
ObIArray
<
ObBackupPieceInfoKey
>
&
backup_piece_keys
);
int
get_sys_tenant_doing_clog_round_and_piece
(
const
share
::
ObBackupCleanInfo
&
clean_info
,
const
ObBackupDataCleanElement
&
clean_element
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录