Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
51fa5ba0
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,发现更多精彩内容 >>
提交
51fa5ba0
编写于
2月 06, 2023
作者:
W
WenJinyu
提交者:
ob-robot
2月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix check oss permission
上级
cd043fb8
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
21 addition
and
17 deletion
+21
-17
src/share/backup/ob_backup_connectivity.cpp
src/share/backup/ob_backup_connectivity.cpp
+20
-17
src/share/backup/ob_backup_connectivity.h
src/share/backup/ob_backup_connectivity.h
+1
-0
未找到文件。
src/share/backup/ob_backup_connectivity.cpp
浏览文件 @
51fa5ba0
...
...
@@ -179,7 +179,7 @@ int ObBackupConnectivityCheckManager::set_connectivity_check_path_(
}
else
if
(
OB_FAIL
(
ObBackupStorageInfoOperator
::
get_check_file_name
(
*
sql_proxy_
,
tenant_id_
,
backup_dest
,
check_file_name
)))
{
LOG_WARN
(
"failed to get check file name"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
path
.
join
(
check_file_name
,
ObBackupFileSuffix
::
BACKUP
)))
{
}
else
if
(
OB_FAIL
(
path
.
join
(
check_file_name
,
ObBackupFileSuffix
::
NONE
)))
{
// check_file_name already include suffix
LOG_WARN
(
"failed to join check file name"
,
K
(
ret
),
K_
(
tenant_id
));
}
return
ret
;
...
...
@@ -275,7 +275,7 @@ int ObBackupCheckFile::set_connectivity_check_name_()
}
else
if
(
OB_FAIL
(
backup_time_to_strftime
(
check_time_s
,
buff
,
sizeof
(
buff
),
pos
,
'T'
/* concat */
)))
{
LOG_WARN
(
"failed to convert time"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
databuff_printf
(
connectivity_file_name_
,
sizeof
(
connectivity_file_name_
),
"%lu_%s_%s_%s
"
,
tenant_id_
,
"connect"
,
"file"
,
buff
)))
{
"%lu_%s_%s_%s
%s"
,
tenant_id_
,
"connect"
,
"file"
,
buff
,
OB_BACKUP_SUFFIX
)))
{
LOG_WARN
(
"failed to set connectivity file name"
,
K
(
ret
));
}
return
ret
;
...
...
@@ -411,7 +411,7 @@ int ObBackupCheckFile::create_connectivity_check_file(
}
else
if
(
false
==
is_match
)
{
if
(
OB_FAIL
(
set_connectivity_check_name_
()))
{
LOG_WARN
(
"failed to set check file name"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
path
.
join
(
connectivity_file_name_
,
ObBackupFileSuffix
::
BACKUP
)))
{
}
else
if
(
OB_FAIL
(
path
.
join
(
connectivity_file_name_
,
ObBackupFileSuffix
::
NONE
)))
{
// connectivity_file_name_ already include suffix
LOG_WARN
(
"failed to join connectivity file name"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
generate_format_desc_
(
backup_dest
,
check_desc
)))
{
LOG_WARN
(
"failed to set buffer"
,
K
(
ret
),
K_
(
tenant_id
));
...
...
@@ -479,11 +479,13 @@ int ObBackupCheckFile::delete_permission_check_file(const ObBackupDest &backup_d
int
ObBackupCheckFile
::
get_permission_check_file_path_
(
const
ObBackupDest
&
backup_dest
,
bool
is_appender
,
share
::
ObBackupPath
&
path
)
{
int
ret
=
OB_SUCCESS
;
int64_t
check_time_s
=
ObTimeUtility
::
current_time
()
/
1000
/
1000
;
char
buff
[
OB_BACKUP_MAX_TIME_STR_LEN
]
=
{
0
};
const
char
*
prefix
=
is_appender
?
"append"
:
"put"
;
int64_t
pos
=
0
;
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
...
...
@@ -493,9 +495,9 @@ int ObBackupCheckFile::get_permission_check_file_path_(
}
else
if
(
OB_FAIL
(
backup_time_to_strftime
(
check_time_s
,
buff
,
sizeof
(
buff
),
pos
,
'T'
/* concat */
)))
{
LOG_WARN
(
"failed to convert time"
,
K
(
ret
),
K
(
backup_dest
));
}
else
if
(
OB_FAIL
(
databuff_printf
(
permission_file_name_
,
sizeof
(
permission_file_name_
),
"%lu_%s_%s_%s
"
,
tenant_id_
,
"permission"
,
"file"
,
buff
)))
{
LOG_WARN
(
"failed to set permission file name"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
path
.
join
(
permission_file_name_
,
ObBackupFileSuffix
::
BACKUP
)))
{
"%lu_%s_%s_%s
_%s%s"
,
tenant_id_
,
prefix
,
"permission"
,
"file"
,
buff
,
OB_BACKUP_SUFFIX
)))
{
LOG_WARN
(
"failed to set permission file name"
,
K
(
ret
)
,
K
(
buff
)
);
}
else
if
(
OB_FAIL
(
path
.
join
(
permission_file_name_
,
ObBackupFileSuffix
::
NONE
)))
{
// permission_file_name_ already include suffix
LOG_WARN
(
"failed to join permission file name"
,
K
(
ret
),
K_
(
permission_file_name
));
}
return
ret
;
...
...
@@ -523,9 +525,9 @@ int ObBackupCheckFile::check_appender_permission_(const ObBackupDest &backup_des
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"backup check file not init"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
get_permission_check_file_path_
(
backup_dest
,
path
)))
{
}
else
if
(
OB_FAIL
(
get_permission_check_file_path_
(
backup_dest
,
true
/*is_appender*/
,
path
)))
{
LOG_WARN
(
"failed to get permission check file path"
,
K
(
ret
),
K_
(
tenant_id
),
K
(
backup_dest
));
}
else
if
(
OB_FAIL
(
util
.
set_access_type
(
&
iod_opts
,
true
,
DEFAULT_OPT_ARG_NUM
)))
{
}
else
if
(
OB_FAIL
(
util
.
set_access_type
(
&
iod_opts
,
true
/*is_appender*/
,
DEFAULT_OPT_ARG_NUM
)))
{
LOG_WARN
(
"fail to set access type"
);
}
else
if
(
OB_FAIL
(
util
.
set_append_strategy
(
&
iod_opts
,
is_data_file
,
epoch
,
DEFAULT_OPT_ARG_NUM
)))
{
LOG_WARN
(
"fail to set append strategy"
);
...
...
@@ -581,7 +583,7 @@ int ObBackupCheckFile::check_io_permission(const ObBackupDest &backup_dest)
}
else
if
(
!
backup_dest
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"backup dest is valid"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
get_permission_check_file_path_
(
backup_dest
,
path
)))
{
}
else
if
(
OB_FAIL
(
get_permission_check_file_path_
(
backup_dest
,
false
/*is_appender*/
,
path
)))
{
LOG_WARN
(
"failed to get permission check file path"
,
K
(
ret
),
K_
(
tenant_id
));
}
else
if
(
OB_FAIL
(
generate_format_desc_
(
backup_dest
,
check_desc
)))
{
LOG_WARN
(
"failed to set buffer"
,
K
(
ret
),
K_
(
tenant_id
));
...
...
@@ -612,15 +614,7 @@ int ObBackupCheckFile::check_io_permission(const ObBackupDest &backup_dest)
ret
=
OB_BACKUP_PERMISSION_DENIED
;
}
LOG_WARN
(
"failed to read single file"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
check_appender_permission_
(
backup_dest
))){
if
(
is_permission_error_
(
ret
))
{
ROOTSERVICE_EVENT_ADD
(
"connectivity_check"
,
"permission check"
,
"tenant_id"
,
tenant_id_
,
"error_code"
,
ret
,
"comment"
,
"appender write"
);
ret
=
OB_BACKUP_PERMISSION_DENIED
;
}
LOG_WARN
(
"failed to appender permission"
,
K
(
ret
));
}
if
(
write_ok
&&
(
OB_SUCCESS
!=
(
tmp_ret
=
util
.
del_file
(
path
.
get_obstr
(),
backup_dest
.
get_storage_info
()))))
{
if
(
is_permission_error_
(
tmp_ret
))
{
ROOTSERVICE_EVENT_ADD
(
"connectivity_check"
,
"permission check"
,
...
...
@@ -630,6 +624,15 @@ int ObBackupCheckFile::check_io_permission(const ObBackupDest &backup_dest)
ret
=
(
OB_SUCCESS
==
ret
)
?
tmp_ret
:
ret
;
LOG_WARN
(
"failed to del file"
,
K
(
tmp_ret
),
K
(
ret
),
K
(
path
),
K
(
backup_dest
));
}
if
(
OB_FAIL
(
ret
))
{
}
else
if
(
OB_FAIL
(
check_appender_permission_
(
backup_dest
))){
if
(
is_permission_error_
(
ret
))
{
ROOTSERVICE_EVENT_ADD
(
"connectivity_check"
,
"permission check"
,
"tenant_id"
,
tenant_id_
,
"error_code"
,
ret
,
"comment"
,
"appender write"
);
ret
=
OB_BACKUP_PERMISSION_DENIED
;
}
LOG_WARN
(
"failed to appender permission"
,
K
(
ret
));
}
return
ret
;
}
...
...
src/share/backup/ob_backup_connectivity.h
浏览文件 @
51fa5ba0
...
...
@@ -68,6 +68,7 @@ public:
private:
int
get_permission_check_file_path_
(
const
share
::
ObBackupDest
&
backup_dest
,
bool
is_appender
,
share
::
ObBackupPath
&
path
);
int
check_appender_permission_
(
const
share
::
ObBackupDest
&
backup_dest
);
int
set_connectivity_check_name_
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录