Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
fa3dbf20
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,发现更多精彩内容 >>
提交
fa3dbf20
编写于
12月 08, 2015
作者:
S
Siying Dong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #853 from Vaisman/enable_C4267_warning
Enable C4267 warning
上级
ad6aaf4f
41b32c60
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
31 addition
and
21 deletion
+31
-21
CMakeLists.txt
CMakeLists.txt
+1
-1
db/compaction.cc
db/compaction.cc
+2
-2
db/db_compaction_test.cc
db/db_compaction_test.cc
+1
-1
db/db_test.cc
db/db_test.cc
+1
-1
db/db_test_util.cc
db/db_test_util.cc
+2
-2
db/db_test_util.h
db/db_test_util.h
+1
-1
db/log_writer.cc
db/log_writer.cc
+2
-2
db/log_writer.h
db/log_writer.h
+1
-1
port/win/env_win.cc
port/win/env_win.cc
+8
-4
port/win/win_logger.cc
port/win/win_logger.cc
+2
-1
util/coding.h
util/coding.h
+2
-2
util/options_builder.cc
util/options_builder.cc
+2
-2
utilities/document/json_document_builder.cc
utilities/document/json_document_builder.cc
+6
-1
未找到文件。
CMakeLists.txt
浏览文件 @
fa3dbf20
...
...
@@ -60,7 +60,7 @@ add_custom_target(GenerateBuildVersion DEPENDS ${BUILD_VERSION_CC})
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/FC /d2Zi+ /W3 /WX /wd4127 /wd4244 /wd4
267 /wd4
800 /wd4996"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/FC /d2Zi+ /W3 /WX /wd4127 /wd4244 /wd4800 /wd4996"
)
# Used to run CI build and tests so we can run faster
set
(
OPTIMIZE_DEBUG_DEFAULT 0
)
# Debug build is unoptimized by default use -DOPTDBG=1 to optimize
...
...
db/compaction.cc
浏览文件 @
fa3dbf20
...
...
@@ -128,8 +128,8 @@ bool Compaction::TEST_IsBottommostLevel(
bool
Compaction
::
IsFullCompaction
(
VersionStorageInfo
*
vstorage
,
const
std
::
vector
<
CompactionInputFiles
>&
inputs
)
{
in
t
num_files_in_compaction
=
0
;
in
t
total_num_files
=
0
;
size_
t
num_files_in_compaction
=
0
;
size_
t
total_num_files
=
0
;
for
(
int
l
=
0
;
l
<
vstorage
->
num_levels
();
l
++
)
{
total_num_files
+=
vstorage
->
NumLevelFiles
(
l
);
}
...
...
db/db_compaction_test.cc
浏览文件 @
fa3dbf20
...
...
@@ -160,7 +160,7 @@ const SstFileMetaData* PickFileRandomly(
auto
result
=
rand
->
Uniform
(
file_id
);
return
&
(
level_meta
.
files
[
result
]);
}
file_id
-=
level_meta
.
files
.
size
(
);
file_id
-=
static_cast
<
uint32_t
>
(
level_meta
.
files
.
size
()
);
}
assert
(
false
);
return
nullptr
;
...
...
db/db_test.cc
浏览文件 @
fa3dbf20
...
...
@@ -2172,7 +2172,7 @@ TEST_F(DBTest, RecoverWithTableHandle) {
std
::
vector
<
std
::
vector
<
FileMetaData
>>
files
;
dbfull
()
->
TEST_GetFilesMetaData
(
handles_
[
1
],
&
files
);
in
t
total_files
=
0
;
size_
t
total_files
=
0
;
for
(
const
auto
&
level
:
files
)
{
total_files
+=
level
.
size
();
}
...
...
db/db_test_util.cc
浏览文件 @
fa3dbf20
...
...
@@ -661,14 +661,14 @@ uint64_t DBTestBase::SizeAtLevel(int level) {
return
sum
;
}
in
t
DBTestBase
::
TotalLiveFiles
(
int
cf
)
{
size_
t
DBTestBase
::
TotalLiveFiles
(
int
cf
)
{
ColumnFamilyMetaData
cf_meta
;
if
(
cf
==
0
)
{
db_
->
GetColumnFamilyMetaData
(
&
cf_meta
);
}
else
{
db_
->
GetColumnFamilyMetaData
(
handles_
[
cf
],
&
cf_meta
);
}
in
t
num_files
=
0
;
size_
t
num_files
=
0
;
for
(
auto
&
level
:
cf_meta
.
levels
)
{
num_files
+=
level
.
files
.
size
();
}
...
...
db/db_test_util.h
浏览文件 @
fa3dbf20
...
...
@@ -661,7 +661,7 @@ class DBTestBase : public testing::Test {
uint64_t
SizeAtLevel
(
int
level
);
in
t
TotalLiveFiles
(
int
cf
=
0
);
size_
t
TotalLiveFiles
(
int
cf
=
0
);
size_t
CountLiveFiles
();
#endif // ROCKSDB_LITE
...
...
db/log_writer.cc
浏览文件 @
fa3dbf20
...
...
@@ -47,7 +47,7 @@ Status Writer::AddRecord(const Slice& slice) {
Status
s
;
bool
begin
=
true
;
do
{
const
int
leftover
=
kBlockSize
-
block_offset_
;
const
int
64_t
leftover
=
kBlockSize
-
block_offset_
;
assert
(
leftover
>=
0
);
if
(
leftover
<
header_size
)
{
// Switch to a new block
...
...
@@ -62,7 +62,7 @@ Status Writer::AddRecord(const Slice& slice) {
}
// Invariant: we never leave < header_size bytes in a block.
assert
(
static_cast
<
int
>
(
kBlockSize
)
-
block_offset_
>=
header_size
);
assert
(
static_cast
<
int
64_t
>
(
kBlockSize
-
block_offset_
)
>=
header_size
);
const
size_t
avail
=
kBlockSize
-
block_offset_
-
header_size
;
const
size_t
fragment_length
=
(
left
<
avail
)
?
left
:
avail
;
...
...
db/log_writer.h
浏览文件 @
fa3dbf20
...
...
@@ -83,7 +83,7 @@ class Writer {
private:
unique_ptr
<
WritableFileWriter
>
dest_
;
in
t
block_offset_
;
// Current offset in block
size_
t
block_offset_
;
// Current offset in block
uint64_t
log_number_
;
bool
recycle_log_files_
;
...
...
port/win/env_win.cc
浏览文件 @
fa3dbf20
...
...
@@ -101,6 +101,7 @@ typedef std::unique_ptr<void, decltype(CloseHandleFunc)> UniqueCloseHandlePtr;
// rely on the current file offset.
SSIZE_T
pwrite
(
HANDLE
hFile
,
const
char
*
src
,
size_t
numBytes
,
uint64_t
offset
)
{
assert
(
numBytes
<=
std
::
numeric_limits
<
DWORD
>::
max
());
OVERLAPPED
overlapped
=
{
0
};
ULARGE_INTEGER
offsetUnion
;
offsetUnion
.
QuadPart
=
offset
;
...
...
@@ -112,7 +113,8 @@ SSIZE_T pwrite(HANDLE hFile, const char* src, size_t numBytes,
unsigned
long
bytesWritten
=
0
;
if
(
FALSE
==
WriteFile
(
hFile
,
src
,
numBytes
,
&
bytesWritten
,
&
overlapped
))
{
if
(
FALSE
==
WriteFile
(
hFile
,
src
,
static_cast
<
DWORD
>
(
numBytes
),
&
bytesWritten
,
&
overlapped
))
{
result
=
-
1
;
}
else
{
result
=
bytesWritten
;
...
...
@@ -123,6 +125,7 @@ SSIZE_T pwrite(HANDLE hFile, const char* src, size_t numBytes,
// See comments for pwrite above
SSIZE_T
pread
(
HANDLE
hFile
,
char
*
src
,
size_t
numBytes
,
uint64_t
offset
)
{
assert
(
numBytes
<=
std
::
numeric_limits
<
DWORD
>::
max
());
OVERLAPPED
overlapped
=
{
0
};
ULARGE_INTEGER
offsetUnion
;
offsetUnion
.
QuadPart
=
offset
;
...
...
@@ -134,7 +137,8 @@ SSIZE_T pread(HANDLE hFile, char* src, size_t numBytes, uint64_t offset) {
unsigned
long
bytesRead
=
0
;
if
(
FALSE
==
ReadFile
(
hFile
,
src
,
numBytes
,
&
bytesRead
,
&
overlapped
))
{
if
(
FALSE
==
ReadFile
(
hFile
,
src
,
static_cast
<
DWORD
>
(
numBytes
),
&
bytesRead
,
&
overlapped
))
{
return
-
1
;
}
else
{
result
=
bytesRead
;
...
...
@@ -948,13 +952,13 @@ class WinWritableFile : public WritableFile {
// Used for buffered access ONLY
assert
(
use_os_buffer_
);
assert
(
data
.
size
()
<
std
::
numeric_limits
<
int
>::
max
());
assert
(
data
.
size
()
<
std
::
numeric_limits
<
DWORD
>::
max
());
Status
s
;
DWORD
bytesWritten
=
0
;
if
(
!
WriteFile
(
hFile_
,
data
.
data
(),
data
.
size
(
),
&
bytesWritten
,
NULL
))
{
static_cast
<
DWORD
>
(
data
.
size
()
),
&
bytesWritten
,
NULL
))
{
auto
lastError
=
GetLastError
();
s
=
IOErrorFromWindowsError
(
"Failed to WriteFile: "
+
filename_
,
...
...
port/win/win_logger.cc
浏览文件 @
fa3dbf20
...
...
@@ -124,7 +124,8 @@ void WinLogger::Logv(const char* format, va_list ap) {
const
size_t
write_size
=
p
-
base
;
DWORD
bytesWritten
=
0
;
BOOL
ret
=
WriteFile
(
file_
,
base
,
write_size
,
&
bytesWritten
,
NULL
);
BOOL
ret
=
WriteFile
(
file_
,
base
,
static_cast
<
DWORD
>
(
write_size
),
&
bytesWritten
,
NULL
);
if
(
ret
==
FALSE
)
{
std
::
string
errSz
=
GetWindowsErrSz
(
GetLastError
());
fprintf
(
stderr
,
errSz
.
c_str
());
...
...
util/coding.h
浏览文件 @
fa3dbf20
...
...
@@ -184,11 +184,11 @@ inline void PutLengthPrefixedSlice(std::string* dst, const Slice& value) {
inline
void
PutLengthPrefixedSliceParts
(
std
::
string
*
dst
,
const
SliceParts
&
slice_parts
)
{
uint32
_t
total_bytes
=
0
;
size
_t
total_bytes
=
0
;
for
(
int
i
=
0
;
i
<
slice_parts
.
num_parts
;
++
i
)
{
total_bytes
+=
slice_parts
.
parts
[
i
].
size
();
}
PutVarint32
(
dst
,
total_bytes
);
PutVarint32
(
dst
,
static_cast
<
uint32_t
>
(
total_bytes
)
);
for
(
int
i
=
0
;
i
<
slice_parts
.
num_parts
;
++
i
)
{
dst
->
append
(
slice_parts
.
parts
[
i
].
data
(),
slice_parts
.
parts
[
i
].
size
());
}
...
...
util/options_builder.cc
浏览文件 @
fa3dbf20
...
...
@@ -127,8 +127,8 @@ void OptimizeForLevel(int read_amplification_threshold,
const
int
kMaxFileNumCompactionTrigger
=
4
;
const
int
kMinLevel0StopTrigger
=
3
;
int
file_num_buffer
=
kInitialLevel0TotalSize
/
options
->
write_buffer_size
+
1
;
int
file_num_buffer
=
static_cast
<
int
>
(
kInitialLevel0TotalSize
/
options
->
write_buffer_size
+
1
)
;
if
(
level0_stop_writes_trigger
>
file_num_buffer
)
{
// Have sufficient room for multiple level 0 files
...
...
utilities/document/json_document_builder.cc
浏览文件 @
fa3dbf20
...
...
@@ -4,6 +4,9 @@
// of patent rights can be found in the PATENTS file in the same directory.
#ifndef ROCKSDB_LITE
#include <assert.h>
#include <limits>
#include <stdint.h>
#include "rocksdb/utilities/json_document.h"
#include "third-party/fbson/FbsonWriter.h"
...
...
@@ -38,7 +41,9 @@ bool JSONDocumentBuilder::WriteEndObject() {
bool
JSONDocumentBuilder
::
WriteKeyValue
(
const
std
::
string
&
key
,
const
JSONDocument
&
value
)
{
size_t
bytesWritten
=
writer_
->
writeKey
(
key
.
c_str
(),
key
.
size
());
assert
(
key
.
size
()
<=
std
::
numeric_limits
<
uint8_t
>::
max
());
size_t
bytesWritten
=
writer_
->
writeKey
(
key
.
c_str
(),
static_cast
<
uint8_t
>
(
key
.
size
()));
if
(
bytesWritten
==
0
)
{
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录