Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
7ed2c3e4
R
rocksdb
项目概览
kvdb
/
rocksdb
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ed2c3e4
编写于
11月 10, 2015
作者:
S
Siying Dong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #823 from yuslepukhin/fix_off_t_type
Make use of portable `uint64_t` type to make possible 64-bit file access
上级
631863c6
720af226
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
29 deletion
+32
-29
include/rocksdb/env.h
include/rocksdb/env.h
+6
-6
port/win/env_win.cc
port/win/env_win.cc
+2
-8
util/env_test.cc
util/env_test.cc
+2
-2
util/file_reader_writer.cc
util/file_reader_writer.cc
+1
-1
util/file_reader_writer.h
util/file_reader_writer.h
+1
-1
util/file_reader_writer_test.cc
util/file_reader_writer_test.cc
+2
-2
util/io_posix.cc
util/io_posix.cc
+15
-6
util/io_posix.h
util/io_posix.h
+3
-3
未找到文件。
include/rocksdb/env.h
浏览文件 @
7ed2c3e4
...
...
@@ -570,7 +570,7 @@ class WritableFile {
// This asks the OS to initiate flushing the cached data to disk,
// without waiting for completion.
// Default implementation does nothing.
virtual
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
{
return
Status
::
OK
();
}
virtual
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
{
return
Status
::
OK
();
}
// PrepareWrite performs any necessary preparation for a write
// before the write actually occurs. This allows for pre-allocation
...
...
@@ -590,8 +590,8 @@ class WritableFile {
if
(
new_last_preallocated_block
>
last_preallocated_block_
)
{
size_t
num_spanned_blocks
=
new_last_preallocated_block
-
last_preallocated_block_
;
Allocate
(
static_cast
<
off_t
>
(
block_size
*
last_preallocated_block_
)
,
static_cast
<
off_t
>
(
block_size
*
num_spanned_blocks
)
);
Allocate
(
block_size
*
last_preallocated_block_
,
block_size
*
num_spanned_blocks
);
last_preallocated_block_
=
new_last_preallocated_block
;
}
}
...
...
@@ -600,7 +600,7 @@ class WritableFile {
/*
* Pre-allocate space for a file.
*/
virtual
Status
Allocate
(
off_t
offset
,
off
_t
len
)
{
virtual
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
{
return
Status
::
OK
();
}
...
...
@@ -920,10 +920,10 @@ class WritableFileWrapper : public WritableFile {
}
protected:
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
{
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
{
return
target_
->
Allocate
(
offset
,
len
);
}
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
override
{
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
override
{
return
target_
->
RangeSync
(
offset
,
nbytes
);
}
...
...
port/win/env_win.cc
浏览文件 @
7ed2c3e4
...
...
@@ -61,12 +61,6 @@ ThreadStatusUpdater* CreateThreadStatusUpdater() {
return
new
ThreadStatusUpdater
();
}
// A wrapper for fadvise, if the platform doesn't support fadvise,
// it will simply return Status::NotSupport.
int
Fadvise
(
int
fd
,
off_t
offset
,
size_t
len
,
int
advice
)
{
return
0
;
// simply do nothing.
}
inline
Status
IOErrorFromWindowsError
(
const
std
::
string
&
context
,
DWORD
err
)
{
return
Status
::
IOError
(
context
,
GetWindowsErrSz
(
err
));
}
...
...
@@ -605,7 +599,7 @@ class WinMmapFile : public WritableFile {
return
Status
::
OK
();
}
virtual
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
{
virtual
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
{
return
Status
::
OK
();
}
};
...
...
@@ -1053,7 +1047,7 @@ class WinWritableFile : public WritableFile {
return
filesize_
;
}
virtual
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
{
virtual
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
{
Status
status
;
TEST_KILL_RANDOM
(
"WinWritableFile::Allocate"
,
rocksdb_kill_odds
);
...
...
util/env_test.cc
浏览文件 @
7ed2c3e4
...
...
@@ -971,11 +971,11 @@ TEST_F(EnvPosixTest, WritableFileWrapper) {
}
protected:
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
{
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
{
inc
(
11
);
return
Status
::
OK
();
}
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
override
{
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
override
{
inc
(
12
);
return
Status
::
OK
();
}
...
...
util/file_reader_writer.cc
浏览文件 @
7ed2c3e4
...
...
@@ -248,7 +248,7 @@ Status WritableFileWriter::SyncInternal(bool use_fsync) {
return
s
;
}
Status
WritableFileWriter
::
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
{
Status
WritableFileWriter
::
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
{
IOSTATS_TIMER_GUARD
(
range_sync_nanos
);
TEST_SYNC_POINT
(
"WritableFileWriter::RangeSync:0"
);
return
writable_file_
->
RangeSync
(
offset
,
nbytes
);
...
...
util/file_reader_writer.h
浏览文件 @
7ed2c3e4
...
...
@@ -162,7 +162,7 @@ class WritableFileWriter {
Status
WriteUnbuffered
();
// Normal write
Status
WriteBuffered
(
const
char
*
data
,
size_t
size
);
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
);
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
);
size_t
RequestToken
(
size_t
bytes
,
bool
align
);
Status
SyncInternal
(
bool
use_fsync
);
};
...
...
util/file_reader_writer_test.cc
浏览文件 @
7ed2c3e4
...
...
@@ -47,8 +47,8 @@ TEST_F(WritableFileWriterTest, RangeSync) {
}
protected:
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
{
return
Status
::
OK
();
}
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
override
{
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
{
return
Status
::
OK
();
}
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
override
{
EXPECT_EQ
(
offset
%
4096
,
0u
);
EXPECT_EQ
(
nbytes
%
4096
,
0u
);
...
...
util/io_posix.cc
浏览文件 @
7ed2c3e4
...
...
@@ -478,12 +478,15 @@ Status PosixMmapFile::InvalidateCache(size_t offset, size_t length) {
}
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status
PosixMmapFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
Status
PosixMmapFile
::
Allocate
(
uint64_t
offset
,
uint64_t
len
)
{
assert
(
offset
<=
std
::
numeric_limits
<
off_t
>::
max
());
assert
(
len
<=
std
::
numeric_limits
<
off_t
>::
max
());
TEST_KILL_RANDOM
(
"PosixMmapFile::Allocate:0"
,
rocksdb_kill_odds
);
int
alloc_status
=
0
;
if
(
allow_fallocate_
)
{
alloc_status
=
fallocate
(
fd_
,
fallocate_with_keep_size_
?
FALLOC_FL_KEEP_SIZE
:
0
,
offset
,
len
);
fd_
,
fallocate_with_keep_size_
?
FALLOC_FL_KEEP_SIZE
:
0
,
static_cast
<
off_t
>
(
offset
),
static_cast
<
off_t
>
(
len
));
}
if
(
alloc_status
==
0
)
{
return
Status
::
OK
();
...
...
@@ -606,13 +609,16 @@ Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {
}
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status
PosixWritableFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
Status
PosixWritableFile
::
Allocate
(
uint64_t
offset
,
uint64_t
len
)
{
assert
(
offset
<=
std
::
numeric_limits
<
off_t
>::
max
());
assert
(
len
<=
std
::
numeric_limits
<
off_t
>::
max
());
TEST_KILL_RANDOM
(
"PosixWritableFile::Allocate:0"
,
rocksdb_kill_odds
);
IOSTATS_TIMER_GUARD
(
allocate_nanos
);
int
alloc_status
=
0
;
if
(
allow_fallocate_
)
{
alloc_status
=
fallocate
(
fd_
,
fallocate_with_keep_size_
?
FALLOC_FL_KEEP_SIZE
:
0
,
offset
,
len
);
fd_
,
fallocate_with_keep_size_
?
FALLOC_FL_KEEP_SIZE
:
0
,
static_cast
<
off_t
>
(
offset
),
static_cast
<
off_t
>
(
len
));
}
if
(
alloc_status
==
0
)
{
return
Status
::
OK
();
...
...
@@ -621,8 +627,11 @@ Status PosixWritableFile::Allocate(off_t offset, off_t len) {
}
}
Status
PosixWritableFile
::
RangeSync
(
off_t
offset
,
off_t
nbytes
)
{
if
(
sync_file_range
(
fd_
,
offset
,
nbytes
,
SYNC_FILE_RANGE_WRITE
)
==
0
)
{
Status
PosixWritableFile
::
RangeSync
(
uint64_t
offset
,
uint64_t
nbytes
)
{
assert
(
offset
<=
std
::
numeric_limits
<
off_t
>::
max
());
assert
(
nbytes
<=
std
::
numeric_limits
<
off_t
>::
max
());
if
(
sync_file_range
(
fd_
,
static_cast
<
off_t
>
(
offset
),
static_cast
<
off_t
>
(
nbytes
),
SYNC_FILE_RANGE_WRITE
)
==
0
)
{
return
Status
::
OK
();
}
else
{
return
IOError
(
filename_
,
errno
);
...
...
util/io_posix.h
浏览文件 @
7ed2c3e4
...
...
@@ -90,8 +90,8 @@ class PosixWritableFile : public WritableFile {
virtual
uint64_t
GetFileSize
()
override
;
virtual
Status
InvalidateCache
(
size_t
offset
,
size_t
length
)
override
;
#ifdef ROCKSDB_FALLOCATE_PRESENT
virtual
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
;
virtual
Status
RangeSync
(
off_t
offset
,
off
_t
nbytes
)
override
;
virtual
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
;
virtual
Status
RangeSync
(
uint64_t
offset
,
uint64
_t
nbytes
)
override
;
virtual
size_t
GetUniqueId
(
char
*
id
,
size_t
max_size
)
const
override
;
#endif
};
...
...
@@ -157,7 +157,7 @@ class PosixMmapFile : public WritableFile {
virtual
uint64_t
GetFileSize
()
override
;
virtual
Status
InvalidateCache
(
size_t
offset
,
size_t
length
)
override
;
#ifdef ROCKSDB_FALLOCATE_PRESENT
virtual
Status
Allocate
(
off_t
offset
,
off
_t
len
)
override
;
virtual
Status
Allocate
(
uint64_t
offset
,
uint64
_t
len
)
override
;
#endif
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录