Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
df44bfa7
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
df44bfa7
编写于
2月 02, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
2月 02, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8950 from Alex-Burmak/s3_min_upload_part_size
Support of s3_min_upload_part_size setting in DiskS3
上级
b4b30202
0c0ad543
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
6 deletion
+14
-6
dbms/src/Disks/DiskS3.cpp
dbms/src/Disks/DiskS3.cpp
+11
-5
dbms/src/Disks/DiskS3.h
dbms/src/Disks/DiskS3.h
+3
-1
未找到文件。
dbms/src/Disks/DiskS3.cpp
浏览文件 @
df44bfa7
...
...
@@ -65,8 +65,9 @@ namespace
const
String
&
bucket_
,
const
String
&
metadata_path_
,
const
String
&
s3_path_
,
size_t
min_upload_part_size
,
size_t
buf_size_
)
:
WriteBufferFromS3
(
client_ptr_
,
bucket_
,
s3_path_
,
DEFAULT_BLOCK_SIZE
,
buf_size_
)
:
WriteBufferFromS3
(
client_ptr_
,
bucket_
,
s3_path_
,
min_upload_part_size
,
buf_size_
)
,
metadata_path
(
metadata_path_
)
,
s3_path
(
s3_path_
)
{
...
...
@@ -156,12 +157,14 @@ private:
};
DiskS3
::
DiskS3
(
String
name_
,
std
::
shared_ptr
<
Aws
::
S3
::
S3Client
>
client_
,
String
bucket_
,
String
s3_root_path_
,
String
metadata_path_
)
DiskS3
::
DiskS3
(
String
name_
,
std
::
shared_ptr
<
Aws
::
S3
::
S3Client
>
client_
,
String
bucket_
,
String
s3_root_path_
,
String
metadata_path_
,
size_t
min_upload_part_size_
)
:
name
(
std
::
move
(
name_
))
,
client
(
std
::
move
(
client_
))
,
bucket
(
std
::
move
(
bucket_
))
,
s3_root_path
(
std
::
move
(
s3_root_path_
))
,
metadata_path
(
std
::
move
(
metadata_path_
))
,
min_upload_part_size
(
min_upload_part_size_
)
{
}
...
...
@@ -274,13 +277,15 @@ std::unique_ptr<WriteBuffer> DiskS3::writeFile(const String & path, size_t buf_s
if
(
!
exists
(
path
)
||
mode
==
WriteMode
::
Rewrite
)
{
String
new_s3_path
=
s3_root_path
+
getRandomName
();
return
std
::
make_unique
<
WriteIndirectBufferFromS3
>
(
client
,
bucket
,
metadata_path
+
path
,
new_s3_path
,
buf_size
);
return
std
::
make_unique
<
WriteIndirectBufferFromS3
>
(
client
,
bucket
,
metadata_path
+
path
,
new_s3_path
,
min_upload_part_size
,
buf_size
);
}
else
{
auto
old_s3_path
=
getS3Path
(
path
);
ReadBufferFromS3
read_buffer
(
client
,
bucket
,
old_s3_path
,
buf_size
);
auto
writeBuffer
=
std
::
make_unique
<
WriteIndirectBufferFromS3
>
(
client
,
bucket
,
metadata_path
+
path
,
old_s3_path
,
buf_size
);
auto
writeBuffer
=
std
::
make_unique
<
WriteIndirectBufferFromS3
>
(
client
,
bucket
,
metadata_path
+
path
,
old_s3_path
,
min_upload_part_size
,
buf_size
);
std
::
vector
<
char
>
buffer
(
buf_size
);
while
(
!
read_buffer
.
eof
())
writeBuffer
->
write
(
buffer
.
data
(),
read_buffer
.
read
(
buffer
.
data
(),
buf_size
));
...
...
@@ -410,7 +415,8 @@ void registerDiskS3(DiskFactory & factory)
String
metadata_path
=
context
.
getPath
()
+
"disks/"
+
name
+
"/"
;
auto
s3disk
=
std
::
make_shared
<
DiskS3
>
(
name
,
client
,
uri
.
bucket
,
uri
.
key
,
metadata_path
);
auto
s3disk
=
std
::
make_shared
<
DiskS3
>
(
name
,
client
,
uri
.
bucket
,
uri
.
key
,
metadata_path
,
context
.
getSettingsRef
().
s3_min_upload_part_size
);
/// This code is used only to check access to the corresponding disk.
...
...
dbms/src/Disks/DiskS3.h
浏览文件 @
df44bfa7
...
...
@@ -21,7 +21,8 @@ class DiskS3 : public IDisk
public:
friend
class
DiskS3Reservation
;
DiskS3
(
String
name_
,
std
::
shared_ptr
<
Aws
::
S3
::
S3Client
>
client_
,
String
bucket_
,
String
s3_root_path_
,
String
metadata_path_
);
DiskS3
(
String
name_
,
std
::
shared_ptr
<
Aws
::
S3
::
S3Client
>
client_
,
String
bucket_
,
String
s3_root_path_
,
String
metadata_path_
,
size_t
min_upload_part_size_
);
const
String
&
getName
()
const
override
{
return
name
;
}
...
...
@@ -82,6 +83,7 @@ private:
const
String
bucket
;
const
String
s3_root_path
;
const
String
metadata_path
;
size_t
min_upload_part_size
;
UInt64
reserved_bytes
=
0
;
UInt64
reservation_count
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录