Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
7f3e417f
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,发现更多精彩内容 >>
提交
7f3e417f
编写于
1月 14, 2014
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix memtable construction in tests
上级
055e6df4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
8 deletion
+14
-8
db/version_edit_test.cc
db/version_edit_test.cc
+2
-2
db/write_batch_test.cc
db/write_batch_test.cc
+3
-2
table/table_test.cc
table/table_test.cc
+9
-4
未找到文件。
db/version_edit_test.cc
浏览文件 @
7f3e417f
...
@@ -15,7 +15,7 @@ namespace rocksdb {
...
@@ -15,7 +15,7 @@ namespace rocksdb {
static
void
TestEncodeDecode
(
const
VersionEdit
&
edit
)
{
static
void
TestEncodeDecode
(
const
VersionEdit
&
edit
)
{
std
::
string
encoded
,
encoded2
;
std
::
string
encoded
,
encoded2
;
edit
.
EncodeTo
(
&
encoded
);
edit
.
EncodeTo
(
&
encoded
);
VersionEdit
parsed
()
;
VersionEdit
parsed
;
Status
s
=
parsed
.
DecodeFrom
(
encoded
);
Status
s
=
parsed
.
DecodeFrom
(
encoded
);
ASSERT_TRUE
(
s
.
ok
())
<<
s
.
ToString
();
ASSERT_TRUE
(
s
.
ok
())
<<
s
.
ToString
();
parsed
.
EncodeTo
(
&
encoded2
);
parsed
.
EncodeTo
(
&
encoded2
);
...
@@ -27,7 +27,7 @@ class VersionEditTest { };
...
@@ -27,7 +27,7 @@ class VersionEditTest { };
TEST
(
VersionEditTest
,
EncodeDecode
)
{
TEST
(
VersionEditTest
,
EncodeDecode
)
{
static
const
uint64_t
kBig
=
1ull
<<
50
;
static
const
uint64_t
kBig
=
1ull
<<
50
;
VersionEdit
edit
()
;
VersionEdit
edit
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
TestEncodeDecode
(
edit
);
TestEncodeDecode
(
edit
);
edit
.
AddFile
(
3
,
kBig
+
300
+
i
,
kBig
+
400
+
i
,
edit
.
AddFile
(
3
,
kBig
+
300
+
i
,
kBig
+
400
+
i
,
...
...
db/write_batch_test.cc
浏览文件 @
7f3e417f
...
@@ -22,10 +22,11 @@ namespace rocksdb {
...
@@ -22,10 +22,11 @@ namespace rocksdb {
static
std
::
string
PrintContents
(
WriteBatch
*
b
)
{
static
std
::
string
PrintContents
(
WriteBatch
*
b
)
{
InternalKeyComparator
cmp
(
BytewiseComparator
());
InternalKeyComparator
cmp
(
BytewiseComparator
());
auto
factory
=
std
::
make_shared
<
SkipListFactory
>
();
auto
factory
=
std
::
make_shared
<
SkipListFactory
>
();
MemTable
*
mem
=
new
MemTable
(
cmp
,
factory
.
get
());
Options
options
;
options
.
memtable_factory
=
factory
;
MemTable
*
mem
=
new
MemTable
(
cmp
,
options
);
mem
->
Ref
();
mem
->
Ref
();
std
::
string
state
;
std
::
string
state
;
Options
options
;
Status
s
=
WriteBatchInternal
::
InsertInto
(
b
,
mem
,
&
options
);
Status
s
=
WriteBatchInternal
::
InsertInto
(
b
,
mem
,
&
options
);
int
count
=
0
;
int
count
=
0
;
Iterator
*
iter
=
mem
->
NewIterator
();
Iterator
*
iter
=
mem
->
NewIterator
();
...
...
table/table_test.cc
浏览文件 @
7f3e417f
...
@@ -370,7 +370,9 @@ class MemTableConstructor: public Constructor {
...
@@ -370,7 +370,9 @@ class MemTableConstructor: public Constructor {
:
Constructor
(
cmp
),
:
Constructor
(
cmp
),
internal_comparator_
(
cmp
),
internal_comparator_
(
cmp
),
table_factory_
(
new
SkipListFactory
)
{
table_factory_
(
new
SkipListFactory
)
{
memtable_
=
new
MemTable
(
internal_comparator_
,
table_factory_
.
get
());
Options
options
;
options
.
memtable_factory
=
table_factory_
;
memtable_
=
new
MemTable
(
internal_comparator_
,
options
);
memtable_
->
Ref
();
memtable_
->
Ref
();
}
}
~
MemTableConstructor
()
{
~
MemTableConstructor
()
{
...
@@ -378,7 +380,9 @@ class MemTableConstructor: public Constructor {
...
@@ -378,7 +380,9 @@ class MemTableConstructor: public Constructor {
}
}
virtual
Status
FinishImpl
(
const
Options
&
options
,
const
KVMap
&
data
)
{
virtual
Status
FinishImpl
(
const
Options
&
options
,
const
KVMap
&
data
)
{
delete
memtable_
->
Unref
();
delete
memtable_
->
Unref
();
memtable_
=
new
MemTable
(
internal_comparator_
,
table_factory_
.
get
());
Options
memtable_options
;
memtable_options
.
memtable_factory
=
table_factory_
;
memtable_
=
new
MemTable
(
internal_comparator_
,
memtable_options
);
memtable_
->
Ref
();
memtable_
->
Ref
();
int
seq
=
1
;
int
seq
=
1
;
for
(
KVMap
::
const_iterator
it
=
data
.
begin
();
for
(
KVMap
::
const_iterator
it
=
data
.
begin
();
...
@@ -1268,10 +1272,11 @@ class MemTableTest { };
...
@@ -1268,10 +1272,11 @@ class MemTableTest { };
TEST
(
MemTableTest
,
Simple
)
{
TEST
(
MemTableTest
,
Simple
)
{
InternalKeyComparator
cmp
(
BytewiseComparator
());
InternalKeyComparator
cmp
(
BytewiseComparator
());
auto
table_factory
=
std
::
make_shared
<
SkipListFactory
>
();
auto
table_factory
=
std
::
make_shared
<
SkipListFactory
>
();
MemTable
*
memtable
=
new
MemTable
(
cmp
,
table_factory
.
get
());
Options
options
;
options
.
memtable_factory
=
table_factory
;
MemTable
*
memtable
=
new
MemTable
(
cmp
,
options
);
memtable
->
Ref
();
memtable
->
Ref
();
WriteBatch
batch
;
WriteBatch
batch
;
Options
options
;
WriteBatchInternal
::
SetSequence
(
&
batch
,
100
);
WriteBatchInternal
::
SetSequence
(
&
batch
,
100
);
batch
.
Put
(
std
::
string
(
"k1"
),
std
::
string
(
"v1"
));
batch
.
Put
(
std
::
string
(
"k1"
),
std
::
string
(
"v1"
));
batch
.
Put
(
std
::
string
(
"k2"
),
std
::
string
(
"v2"
));
batch
.
Put
(
std
::
string
(
"k2"
),
std
::
string
(
"v2"
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录