Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
167bd885
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,发现更多精彩内容 >>
提交
167bd885
编写于
1月 25, 2016
作者:
A
Andrew Kryczka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[directory includes cleanup] Finish removing util->db dependencies
上级
acd7d586
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
118 addition
and
119 deletion
+118
-119
CMakeLists.txt
CMakeLists.txt
+5
-4
Makefile
Makefile
+1
-1
db/auto_roll_logger.cc
db/auto_roll_logger.cc
+1
-1
db/auto_roll_logger.h
db/auto_roll_logger.h
+0
-0
db/auto_roll_logger_test.cc
db/auto_roll_logger_test.cc
+1
-1
db/db_impl.cc
db/db_impl.cc
+2
-2
db/db_info_dumper.cc
db/db_info_dumper.cc
+2
-1
db/db_info_dumper.h
db/db_info_dumper.h
+0
-0
db/db_test.cc
db/db_test.cc
+100
-0
memtable/skiplistrep.cc
memtable/skiplistrep.cc
+0
-0
memtable/vectorrep.cc
memtable/vectorrep.cc
+0
-0
src.mk
src.mk
+5
-5
util/file_util.cc
util/file_util.cc
+0
-1
util/memenv_test.cc
util/memenv_test.cc
+0
-53
util/mock_env_test.cc
util/mock_env_test.cc
+0
-47
util/options.cc
util/options.cc
+0
-1
util/testutil.h
util/testutil.h
+0
-1
utilities/backupable/backupable_db_test.cc
utilities/backupable/backupable_db_test.cc
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
167bd885
...
...
@@ -99,6 +99,7 @@ add_subdirectory(third-party/gtest-1.7.0/fused-src/gtest)
# Main library source code
set
(
SOURCES
db/auto_roll_logger.cc
db/builder.cc
db/c.cc
db/column_family.cc
...
...
@@ -114,6 +115,7 @@ set(SOURCES
db/db_impl_debug.cc
db/db_impl_experimental.cc
db/db_impl_readonly.cc
db/db_info_dumper.cc
db/db_iter.cc
db/event_helpers.cc
db/experimental.cc
...
...
@@ -149,6 +151,8 @@ set(SOURCES
memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/skiplistrep.cc
memtable/vectorrep.cc
port/stack_trace.cc
port/win/env_win.cc
port/win/port_win.cc
...
...
@@ -194,7 +198,6 @@ set(SOURCES
util/comparator.cc
util/concurrent_arena.cc
util/crc32c.cc
util/db_info_dumper.cc
util/delete_scheduler_impl.cc
util/dynamic_bloom.cc
util/env.cc
...
...
@@ -224,7 +227,6 @@ set(SOURCES
util/perf_level.cc
util/random.cc
util/rate_limiter.cc
util/skiplistrep.cc
util/slice.cc
util/statistics.cc
util/status.cc
...
...
@@ -238,7 +240,6 @@ set(SOURCES
util/thread_status_updater.cc
util/thread_status_util.cc
util/thread_status_util_debug.cc
util/vectorrep.cc
util/xfunc.cc
util/xxhash.cc
utilities/backupable/backupable_db.cc
...
...
@@ -304,6 +305,7 @@ set(APPS
set
(
C_TESTS db/c_test.c
)
set
(
TESTS
db/auto_roll_logger_test.cc
db/column_family_test.cc
db/compact_files_test.cc
db/compaction_iterator_test.cc
...
...
@@ -365,7 +367,6 @@ set(TESTS
tools/sst_dump_test.cc
util/arena_test.cc
util/autovector_test.cc
util/auto_roll_logger_test.cc
util/bloom_test.cc
util/cache_test.cc
util/coding_test.cc
...
...
Makefile
浏览文件 @
167bd885
...
...
@@ -1019,7 +1019,7 @@ manual_compaction_test: db/manual_compaction_test.o $(LIBOBJECTS) $(TESTHARNESS)
filelock_test
:
util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)
auto_roll_logger_test
:
util
/auto_roll_logger_test.o $(LIBOBJECTS) $(TESTHARNESS)
auto_roll_logger_test
:
db
/auto_roll_logger_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)
memtable_list_test
:
db/memtable_list_test.o $(LIBOBJECTS) $(TESTHARNESS)
...
...
util
/auto_roll_logger.cc
→
db
/auto_roll_logger.cc
浏览文件 @
167bd885
...
...
@@ -3,7 +3,7 @@
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#include "
util
/auto_roll_logger.h"
#include "
db
/auto_roll_logger.h"
#include "util/mutexlock.h"
using
namespace
std
;
...
...
util
/auto_roll_logger.h
→
db
/auto_roll_logger.h
浏览文件 @
167bd885
文件已移动
util
/auto_roll_logger_test.cc
→
db
/auto_roll_logger_test.cc
浏览文件 @
167bd885
...
...
@@ -10,8 +10,8 @@
#include <fstream>
#include <iterator>
#include <algorithm>
#include "db/auto_roll_logger.h"
#include "util/testharness.h"
#include "util/auto_roll_logger.h"
#include "rocksdb/db.h"
#include <sys/stat.h>
#include <errno.h>
...
...
db/db_impl.cc
浏览文件 @
167bd885
...
...
@@ -31,8 +31,10 @@
#include <utility>
#include <vector>
#include "db/auto_roll_logger.h"
#include "db/builder.h"
#include "db/compaction_job.h"
#include "db/db_info_dumper.h"
#include "db/db_iter.h"
#include "db/dbformat.h"
#include "db/event_helpers.h"
...
...
@@ -76,13 +78,11 @@
#include "table/merger.h"
#include "table/table_builder.h"
#include "table/two_level_iterator.h"
#include "util/auto_roll_logger.h"
#include "util/autovector.h"
#include "util/build_version.h"
#include "util/coding.h"
#include "util/compression.h"
#include "util/crc32c.h"
#include "util/db_info_dumper.h"
#include "util/file_reader_writer.h"
#include "util/file_util.h"
#include "util/iostats_context_imp.h"
...
...
util
/db_info_dumper.cc
→
db
/db_info_dumper.cc
浏览文件 @
167bd885
...
...
@@ -7,6 +7,8 @@
#define __STDC_FORMAT_MACROS
#endif
#include "db/db_info_dumper.h"
#include <inttypes.h>
#include <stdio.h>
#include <string>
...
...
@@ -16,7 +18,6 @@
#include "db/filename.h"
#include "rocksdb/options.h"
#include "rocksdb/env.h"
#include "util/db_info_dumper.h"
namespace
rocksdb
{
...
...
util
/db_info_dumper.h
→
db
/db_info_dumper.h
浏览文件 @
167bd885
文件已移动
db/db_test.cc
浏览文件 @
167bd885
...
...
@@ -122,6 +122,106 @@ class DBTestWithParam
bool
exclusive_manual_compaction_
;
};
TEST_F
(
DBTest
,
MockEnvTest
)
{
unique_ptr
<
MockEnv
>
env
{
new
MockEnv
(
Env
::
Default
())};
Options
options
;
options
.
create_if_missing
=
true
;
options
.
env
=
env
.
get
();
DB
*
db
;
const
Slice
keys
[]
=
{
Slice
(
"aaa"
),
Slice
(
"bbb"
),
Slice
(
"ccc"
)};
const
Slice
vals
[]
=
{
Slice
(
"foo"
),
Slice
(
"bar"
),
Slice
(
"baz"
)};
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_OK
(
db
->
Put
(
WriteOptions
(),
keys
[
i
],
vals
[
i
]));
}
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
Iterator
*
iterator
=
db
->
NewIterator
(
ReadOptions
());
iterator
->
SeekToFirst
();
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_TRUE
(
iterator
->
Valid
());
ASSERT_TRUE
(
keys
[
i
]
==
iterator
->
key
());
ASSERT_TRUE
(
vals
[
i
]
==
iterator
->
value
());
iterator
->
Next
();
}
ASSERT_TRUE
(
!
iterator
->
Valid
());
delete
iterator
;
// TEST_FlushMemTable() is not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
DBImpl
*
dbi
=
reinterpret_cast
<
DBImpl
*>
(
db
);
ASSERT_OK
(
dbi
->
TEST_FlushMemTable
());
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
#endif // ROCKSDB_LITE
delete
db
;
}
TEST_F
(
DBTest
,
MemEnvTest
)
{
unique_ptr
<
Env
>
env
{
NewMemEnv
(
Env
::
Default
())};
Options
options
;
options
.
create_if_missing
=
true
;
options
.
env
=
env
.
get
();
DB
*
db
;
const
Slice
keys
[]
=
{
Slice
(
"aaa"
),
Slice
(
"bbb"
),
Slice
(
"ccc"
)};
const
Slice
vals
[]
=
{
Slice
(
"foo"
),
Slice
(
"bar"
),
Slice
(
"baz"
)};
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_OK
(
db
->
Put
(
WriteOptions
(),
keys
[
i
],
vals
[
i
]));
}
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
Iterator
*
iterator
=
db
->
NewIterator
(
ReadOptions
());
iterator
->
SeekToFirst
();
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_TRUE
(
iterator
->
Valid
());
ASSERT_TRUE
(
keys
[
i
]
==
iterator
->
key
());
ASSERT_TRUE
(
vals
[
i
]
==
iterator
->
value
());
iterator
->
Next
();
}
ASSERT_TRUE
(
!
iterator
->
Valid
());
delete
iterator
;
DBImpl
*
dbi
=
reinterpret_cast
<
DBImpl
*>
(
db
);
ASSERT_OK
(
dbi
->
TEST_FlushMemTable
());
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
delete
db
;
options
.
create_if_missing
=
false
;
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
delete
db
;
}
TEST_F
(
DBTest
,
WriteEmptyBatch
)
{
Options
options
;
options
.
env
=
env_
;
...
...
util
/skiplistrep.cc
→
memtable
/skiplistrep.cc
浏览文件 @
167bd885
文件已移动
util
/vectorrep.cc
→
memtable
/vectorrep.cc
浏览文件 @
167bd885
文件已移动
src.mk
浏览文件 @
167bd885
# These are the sources from which librocksdb.a is built:
LIB_SOURCES
=
\
db/auto_roll_logger.cc
\
db/builder.cc
\
db/c.cc
\
db/column_family.cc
\
...
...
@@ -15,6 +16,7 @@ LIB_SOURCES = \
db/db_impl_debug.cc
\
db/db_impl_readonly.cc
\
db/db_impl_experimental.cc
\
db/db_info_dumper.cc
\
db/db_iter.cc
\
db/experimental.cc
\
db/event_helpers.cc
\
...
...
@@ -50,6 +52,8 @@ LIB_SOURCES = \
memtable/hash_cuckoo_rep.cc
\
memtable/hash_linklist_rep.cc
\
memtable/hash_skiplist_rep.cc
\
memtable/skiplistrep.cc
\
memtable/vectorrep.cc
\
port/stack_trace.cc
\
port/port_posix.cc
\
table/adaptive_table_factory.cc
\
...
...
@@ -82,7 +86,6 @@ LIB_SOURCES = \
table/two_level_iterator.cc
\
tools/dump/db_dump_tool.cc
\
util/arena.cc
\
util/auto_roll_logger.cc
\
util/bloom.cc
\
util/build_version.cc
\
util/cache.cc
\
...
...
@@ -91,7 +94,6 @@ LIB_SOURCES = \
util/compaction_job_stats_impl.cc
\
util/concurrent_arena.cc
\
util/crc32c.cc
\
util/db_info_dumper.cc
\
util/delete_scheduler_impl.cc
\
util/dynamic_bloom.cc
\
util/env.cc
\
...
...
@@ -152,7 +154,6 @@ LIB_SOURCES = \
util/perf_level.cc
\
util/random.cc
\
util/rate_limiter.cc
\
util/skiplistrep.cc
\
util/slice.cc
\
util/statistics.cc
\
util/status.cc
\
...
...
@@ -165,7 +166,6 @@ LIB_SOURCES = \
util/thread_status_updater_debug.cc
\
util/thread_status_util.cc
\
util/thread_status_util_debug.cc
\
util/vectorrep.cc
\
util/xfunc.cc
\
util/xxhash.cc
\
...
...
@@ -180,6 +180,7 @@ MOCK_SOURCES = \
TEST_BENCH_SOURCES
=
\
third-party/gtest-1.7.0/fused-src/gtest/gtest-all.cc
\
db/auto_roll_logger_test.cc
\
db/column_family_test.cc
\
db/compaction_job_test.cc
\
db/compaction_job_stats_test.cc
\
...
...
@@ -240,7 +241,6 @@ TEST_BENCH_SOURCES = \
tools/reduce_levels_test.cc
\
tools/sst_dump_test.cc
\
util/arena_test.cc
\
util/auto_roll_logger_test.cc
\
util/autovector_test.cc
\
util/benchharness.cc
\
util/benchharness_test.cc
\
...
...
util/file_util.cc
浏览文件 @
167bd885
...
...
@@ -11,7 +11,6 @@
#include "rocksdb/delete_scheduler.h"
#include "rocksdb/env.h"
#include "rocksdb/options.h"
#include "db/filename.h"
#include "util/file_reader_writer.h"
namespace
rocksdb
{
...
...
util/memenv_test.cc
浏览文件 @
167bd885
...
...
@@ -4,7 +4,6 @@
#ifndef ROCKSDB_LITE
#include "db/db_impl.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "util/testharness.h"
...
...
@@ -183,58 +182,6 @@ TEST_F(MemEnvTest, LargeWrite) {
delete
[]
scratch
;
}
TEST_F
(
MemEnvTest
,
DBTest
)
{
Options
options
;
options
.
create_if_missing
=
true
;
options
.
env
=
env_
;
DB
*
db
;
const
Slice
keys
[]
=
{
Slice
(
"aaa"
),
Slice
(
"bbb"
),
Slice
(
"ccc"
)};
const
Slice
vals
[]
=
{
Slice
(
"foo"
),
Slice
(
"bar"
),
Slice
(
"baz"
)};
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_OK
(
db
->
Put
(
WriteOptions
(),
keys
[
i
],
vals
[
i
]));
}
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
Iterator
*
iterator
=
db
->
NewIterator
(
ReadOptions
());
iterator
->
SeekToFirst
();
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_TRUE
(
iterator
->
Valid
());
ASSERT_TRUE
(
keys
[
i
]
==
iterator
->
key
());
ASSERT_TRUE
(
vals
[
i
]
==
iterator
->
value
());
iterator
->
Next
();
}
ASSERT_TRUE
(
!
iterator
->
Valid
());
delete
iterator
;
DBImpl
*
dbi
=
reinterpret_cast
<
DBImpl
*>
(
db
);
ASSERT_OK
(
dbi
->
TEST_FlushMemTable
());
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
delete
db
;
options
.
create_if_missing
=
false
;
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
delete
db
;
}
}
// namespace rocksdb
int
main
(
int
argc
,
char
**
argv
)
{
...
...
util/mock_env_test.cc
浏览文件 @
167bd885
...
...
@@ -6,7 +6,6 @@
#include <string>
#include <vector>
#include "util/mock_env.h"
#include "db/db_impl.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "util/testharness.h"
...
...
@@ -221,52 +220,6 @@ TEST_F(MockEnvTest, Corrupt) {
ASSERT_NE
(
result
.
compare
(
kCorrupted
),
0
);
}
TEST_F
(
MockEnvTest
,
DBTest
)
{
Options
options
;
options
.
create_if_missing
=
true
;
options
.
env
=
env_
;
DB
*
db
;
const
Slice
keys
[]
=
{
Slice
(
"aaa"
),
Slice
(
"bbb"
),
Slice
(
"ccc"
)};
const
Slice
vals
[]
=
{
Slice
(
"foo"
),
Slice
(
"bar"
),
Slice
(
"baz"
)};
ASSERT_OK
(
DB
::
Open
(
options
,
"/dir/db"
,
&
db
));
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_OK
(
db
->
Put
(
WriteOptions
(),
keys
[
i
],
vals
[
i
]));
}
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
Iterator
*
iterator
=
db
->
NewIterator
(
ReadOptions
());
iterator
->
SeekToFirst
();
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
ASSERT_TRUE
(
iterator
->
Valid
());
ASSERT_TRUE
(
keys
[
i
]
==
iterator
->
key
());
ASSERT_TRUE
(
vals
[
i
]
==
iterator
->
value
());
iterator
->
Next
();
}
ASSERT_TRUE
(
!
iterator
->
Valid
());
delete
iterator
;
// TEST_FlushMemTable() is not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
DBImpl
*
dbi
=
reinterpret_cast
<
DBImpl
*>
(
db
);
ASSERT_OK
(
dbi
->
TEST_FlushMemTable
());
for
(
size_t
i
=
0
;
i
<
3
;
++
i
)
{
std
::
string
res
;
ASSERT_OK
(
db
->
Get
(
ReadOptions
(),
keys
[
i
],
&
res
));
ASSERT_TRUE
(
res
==
vals
[
i
]);
}
#endif // ROCKSDB_LITE
delete
db
;
}
TEST_F
(
MockEnvTest
,
FakeSleeping
)
{
int64_t
now
=
0
;
auto
s
=
env_
->
GetCurrentTime
(
&
now
);
...
...
util/options.cc
浏览文件 @
167bd885
...
...
@@ -17,7 +17,6 @@
#include <inttypes.h>
#include <limits>
#include "db/writebuffer.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/comparator.h"
...
...
util/testutil.h
浏览文件 @
167bd885
...
...
@@ -13,7 +13,6 @@
#include <string>
#include <vector>
#include "db/dbformat.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/env.h"
#include "rocksdb/iterator.h"
...
...
utilities/backupable/backupable_db_test.cc
浏览文件 @
167bd885
...
...
@@ -13,6 +13,7 @@
#include <algorithm>
#include <iostream>
#include "db/filename.h"
#include "port/port.h"
#include "port/stack_trace.h"
#include "rocksdb/types.h"
...
...
@@ -24,7 +25,6 @@
#include "util/mutexlock.h"
#include "util/string_util.h"
#include "util/testutil.h"
#include "util/auto_roll_logger.h"
#include "util/mock_env.h"
#include "utilities/backupable/backupable_db_testutil.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录