Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
7205374e
O
oceanbase
项目概览
大炮V587
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
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,发现更多精彩内容 >>
提交
7205374e
编写于
10月 25, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
10月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix backup delete switch tenant resource
上级
d87eec46
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
29 deletion
+65
-29
src/rootserver/backup/ob_backup_schedule_task.cpp
src/rootserver/backup/ob_backup_schedule_task.cpp
+49
-2
src/rootserver/backup/ob_backup_schedule_task.h
src/rootserver/backup/ob_backup_schedule_task.h
+1
-0
src/share/backup/ob_backup_struct.cpp
src/share/backup/ob_backup_struct.cpp
+0
-4
src/share/backup/ob_backup_struct.h
src/share/backup/ob_backup_struct.h
+0
-10
src/storage/backup/ob_ls_backup_clean_mgr.cpp
src/storage/backup/ob_ls_backup_clean_mgr.cpp
+15
-13
未找到文件。
src/rootserver/backup/ob_backup_schedule_task.cpp
浏览文件 @
7205374e
...
...
@@ -13,6 +13,7 @@
#define USING_LOG_PREFIX RS
#include "ob_backup_task_scheduler.h"
#include "share/location_cache/ob_location_service.h"
#include "share/backup/ob_backup_data_table_operator.h"
#include "share/backup/ob_backup_clean_operator.h"
#include "share/ob_srv_rpc_proxy.h"
...
...
@@ -931,7 +932,7 @@ int64_t ObBackupCleanLSTask::get_deep_copy_size() const
bool
ObBackupCleanLSTask
::
can_execute_on_any_server
()
const
{
return
tru
e
;
return
fals
e
;
}
int
ObBackupCleanLSTask
::
do_update_dst_and_doing_status_
(
common
::
ObMySQLProxy
&
sql_proxy
,
common
::
ObAddr
&
dst
,
share
::
ObTaskId
&
trace_id
)
...
...
@@ -944,6 +945,50 @@ int ObBackupCleanLSTask::do_update_dst_and_doing_status_(common::ObMySQLProxy &s
return
ret
;
}
int
ObBackupCleanLSTask
::
set_optional_servers_
()
{
int
ret
=
OB_SUCCESS
;
ObArray
<
ObBackupServer
>
servers
;
uint64_t
tenant_id
=
get_tenant_id
();
share
::
ObLocationService
*
location_service
=
GCTX
.
location_service_
;
int64_t
cluster_id
=
GCONF
.
cluster_id
;
share
::
ObLSID
ls_id
(
share
::
ObLSID
::
SYS_LS_ID
);
share
::
ObLSLocation
location
;
bool
is_cache_hit
=
false
;
if
(
OB_ISNULL
(
location_service
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"location_service ptr is null"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
location_service
->
get
(
cluster_id
,
tenant_id
,
ls_id
,
INT64_MAX
/*expire_renew_time*/
,
is_cache_hit
,
location
)))
{
LOG_WARN
(
"failed to get location"
,
K
(
ret
),
K
(
cluster_id
),
K
(
tenant_id
),
K
(
ls_id
));
}
else
{
const
common
::
ObIArray
<
ObLSReplicaLocation
>
&
replica_array
=
location
.
get_replica_locations
();
for
(
int
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
replica_array
.
count
();
++
i
)
{
const
ObLSReplicaLocation
&
replica
=
replica_array
.
at
(
i
);
if
(
replica
.
is_valid
())
{
ObBackupServer
server
;
server
.
set
(
replica
.
get_server
(),
1
/*high priority*/
);
if
(
OB_FAIL
(
servers
.
push_back
(
server
)))
{
LOG_WARN
(
"failed to push server"
,
K
(
ret
),
K
(
server
));
}
}
}
if
(
OB_SUCC
(
ret
)
&&
servers
.
empty
())
{
ret
=
OB_EAGAIN
;
LOG_WARN
(
"no optional servers, retry_later"
,
K
(
ret
),
K
(
*
this
));
}
}
if
(
OB_SUCC
(
ret
)
&&
OB_FAIL
(
set_optional_servers
(
servers
)))
{
LOG_WARN
(
"failed to optional servers"
,
K
(
ret
));
}
else
{
FLOG_INFO
(
"task optional servers are:"
,
K
(
*
this
),
K
(
servers
));
}
return
ret
;
}
int
ObBackupCleanLSTask
::
execute
(
obrpc
::
ObSrvRpcProxy
&
rpc_proxy
)
const
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -1008,7 +1053,9 @@ int ObBackupCleanLSTask::build(const ObBackupCleanTaskAttr &task_attr, const ObB
LOG_WARN
(
"failed to assign backup path"
,
K
(
ret
),
K
(
task_attr
.
backup_path_
));
}
else
if
(
OB_FAIL
(
task_attr
.
get_backup_clean_id
(
id_
)))
{
LOG_WARN
(
"failed to get task id"
,
K
(
ret
),
K
(
task_attr
));
}
}
else
if
(
OB_FAIL
(
set_optional_servers_
()))
{
LOG_WARN
(
"failed to set optional servers"
,
K
(
ret
),
K
(
task_attr
));
}
}
return
ret
;
}
...
...
src/rootserver/backup/ob_backup_schedule_task.h
浏览文件 @
7205374e
...
...
@@ -385,6 +385,7 @@ public:
virtual
int
cancel
(
obrpc
::
ObSrvRpcProxy
&
rpc_proxy
)
const
override
;
private:
virtual
int
do_update_dst_and_doing_status_
(
common
::
ObMySQLProxy
&
sql_proxy
,
common
::
ObAddr
&
dst
,
share
::
ObTaskId
&
trace_id
)
override
;
int
set_optional_servers_
();
public:
int
build
(
const
share
::
ObBackupCleanTaskAttr
&
task_attr
,
const
share
::
ObBackupCleanLSTaskAttr
&
ls_attr
);
INHERIT_TO_STRING_KV
(
"ObBackupScheduleTask"
,
ObBackupScheduleTask
,
K_
(
job_id
),
K_
(
incarnation_id
),
K_
(
id
),
K_
(
round_id
),
...
...
src/share/backup/ob_backup_struct.cpp
浏览文件 @
7205374e
...
...
@@ -30,10 +30,6 @@ using namespace lib;
using
namespace
common
;
using
namespace
share
;
bool
share
::
has_independ_inc_backup_set
(
const
int64_t
version
)
{
return
version
>=
OB_BACKUP_COMPATIBLE_VERSION_V2
&&
version
<
OB_BACKUP_COMPATIBLE_VERSION_MAX
;
}
bool
share
::
is_valid_backup_inner_table_version
(
const
ObBackupInnerTableVersion
&
version
)
{
return
version
>
0
&&
version
<
OB_BACKUP_INNER_TABLE_VMAX
;
...
...
src/share/backup/ob_backup_struct.h
浏览文件 @
7205374e
...
...
@@ -33,16 +33,6 @@ namespace oceanbase
namespace
share
{
enum
ObBackupCompatibleVersion
// used for data backup TODO(chongrong): delete it?
{
OB_BACKUP_COMPATIBLE_VERSION_V1
=
1
,
// since 2.2.60
OB_BACKUP_COMPATIBLE_VERSION_V2
=
2
,
// since 2.2.77
OB_BACKUP_COMPATIBLE_VERSION_V3
=
3
,
// since 3.1
OB_BACKUP_COMPATIBLE_VERSION_V4
=
4
,
// since 4.0
OB_BACKUP_COMPATIBLE_VERSION_MAX
,
};
bool
has_independ_inc_backup_set
(
const
int64_t
version
);
// for log archive and data backup, exclude backup lease service inner table
enum
ObBackupInnerTableVersion
{
OB_BACKUP_INNER_TABLE_V1
=
1
,
// since 2.2.60
...
...
src/storage/backup/ob_ls_backup_clean_mgr.cpp
浏览文件 @
7205374e
...
...
@@ -33,21 +33,23 @@ int ObLSBackupCleanScheduler::schedule_backup_clean_dag(const obrpc::ObLSBackupC
int
ret
=
OB_SUCCESS
;
ObLSBackupCleanDagNetInitParam
param
;
ObLSBackupCleanDagNet
*
clean_dag_net
=
nullptr
;
ObTenantDagScheduler
*
scheduler
=
MTL
(
ObTenantDagScheduler
*
);
if
(
OB_ISNULL
(
scheduler
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected null MTL scheduler"
,
K
(
ret
),
K
(
scheduler
));
}
else
if
(
OB_FAIL
(
param
.
set
(
args
)))
{
LOG_WARN
(
"failed to set ls backup clean net init param"
,
K
(
ret
),
K
(
args
));
}
else
if
(
OB_FAIL
(
scheduler
->
create_and_add_dag_net
(
&
param
,
clean_dag_net
)))
{
if
(
OB_TASK_EXIST
==
ret
)
{
ret
=
OB_SUCCESS
;
LOG_INFO
(
"[BACKUP_CLEAN]alreadly have log stream backup dag net in DagScheduler"
,
K
(
ret
));
MTL_SWITCH
(
args
.
tenant_id_
)
{
ObTenantDagScheduler
*
scheduler
=
MTL
(
ObTenantDagScheduler
*
);
if
(
OB_ISNULL
(
scheduler
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected null MTL scheduler"
,
K
(
ret
),
K
(
scheduler
));
}
else
if
(
OB_FAIL
(
param
.
set
(
args
)))
{
LOG_WARN
(
"failed to set ls backup clean net init param"
,
K
(
ret
),
K
(
args
));
}
else
if
(
OB_FAIL
(
scheduler
->
create_and_add_dag_net
(
&
param
,
clean_dag_net
)))
{
if
(
OB_TASK_EXIST
==
ret
)
{
ret
=
OB_SUCCESS
;
LOG_INFO
(
"[BACKUP_CLEAN]alreadly have log stream backup dag net in DagScheduler"
,
K
(
ret
));
}
else
{
LOG_WARN
(
"failed to create log stream backup dag net"
,
K
(
ret
));
}
}
else
{
LOG_
WARN
(
"failed to create log stream backup dag net"
,
K
(
ret
));
LOG_
INFO
(
"[BACKUP_CLEAN]success to create log stream backup dag net"
,
K
(
ret
),
K
(
param
));
}
}
else
{
LOG_INFO
(
"[BACKUP_CLEAN]success to create log stream backup dag net"
,
K
(
ret
),
K
(
param
));
}
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录