Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
6820638c
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,发现更多精彩内容 >>
提交
6820638c
编写于
1月 04, 2014
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: IO: added test [#METR-2944].
上级
b9d6fc48
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
3 deletion
+48
-3
dbms/include/DB/IO/ReadBufferFromFile.h
dbms/include/DB/IO/ReadBufferFromFile.h
+2
-2
dbms/src/IO/tests/o_direct_and_dirty_pages.cpp
dbms/src/IO/tests/o_direct_and_dirty_pages.cpp
+45
-0
dbms/src/Interpreters/loadMetadata.cpp
dbms/src/Interpreters/loadMetadata.cpp
+1
-1
未找到文件。
dbms/include/DB/IO/ReadBufferFromFile.h
浏览文件 @
6820638c
...
...
@@ -16,13 +16,13 @@ private:
std
::
string
file_name
;
public:
ReadBufferFromFile
(
const
std
::
string
&
file_name_
,
size_t
buf_size
=
DBMS_DEFAULT_BUFFER_SIZE
,
ReadBufferFromFile
(
const
std
::
string
&
file_name_
,
size_t
buf_size
=
DBMS_DEFAULT_BUFFER_SIZE
,
int
flags
=
-
1
,
char
*
existing_memory
=
NULL
,
size_t
alignment
=
0
)
:
ReadBufferFromFileDescriptor
(
-
1
,
buf_size
,
existing_memory
,
alignment
),
file_name
(
file_name_
)
{
ProfileEvents
::
increment
(
ProfileEvents
::
FileOpen
);
fd
=
open
(
file_name
.
c_str
(),
O_RDONLY
);
fd
=
open
(
file_name
.
c_str
(),
flags
==
-
1
?
O_RDONLY
:
flags
);
if
(
-
1
==
fd
)
throwFromErrno
(
"Cannot open file "
+
file_name
,
errno
==
ENOENT
?
ErrorCodes
::
FILE_DOESNT_EXIST
:
ErrorCodes
::
CANNOT_OPEN_FILE
);
...
...
dbms/src/IO/tests/o_direct_and_dirty_pages.cpp
0 → 100644
浏览文件 @
6820638c
#include <string>
#include <iostream>
#include <DB/Core/Types.h>
#include <DB/IO/WriteHelpers.h>
#include <DB/IO/ReadHelpers.h>
#include <DB/IO/WriteBufferFromFile.h>
#include <DB/IO/ReadBufferFromFile.h>
int
main
(
int
argc
,
char
**
argv
)
{
using
namespace
DB
;
try
{
ReadBufferFromFile
rand_in
(
"/dev/urandom"
);
unsigned
rand
=
0
;
readBinary
(
rand
,
rand_in
);
String
test
=
"Hello, world! "
+
toString
(
rand
);
{
WriteBufferFromFile
wb
(
"test"
,
4096
);
writeStringBinary
(
test
,
wb
);
wb
.
next
();
}
{
ReadBufferFromFile
rb
(
"test"
,
4096
,
O_RDONLY
|
O_DIRECT
,
nullptr
,
4096
);
String
res
;
readStringBinary
(
res
,
rb
);
std
::
cerr
<<
"test: "
<<
test
<<
", res: "
<<
res
<<
std
::
endl
;
}
}
catch
(
const
Exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
", "
<<
e
.
displayText
()
<<
std
::
endl
;
return
1
;
}
return
0
;
}
dbms/src/Interpreters/loadMetadata.cpp
浏览文件 @
6820638c
...
...
@@ -112,7 +112,7 @@ void loadMetadata(Context & context)
{
static
const
size_t
in_buf_size
=
32768
;
char
in_buf
[
in_buf_size
];
ReadBufferFromFile
in
(
tables
[
j
],
32768
,
in_buf
);
ReadBufferFromFile
in
(
tables
[
j
],
32768
,
-
1
,
in_buf
);
WriteBufferFromString
out
(
s
);
copyData
(
in
,
out
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录