Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
25c8a1a2
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,发现更多精彩内容 >>
提交
25c8a1a2
编写于
3月 12, 2014
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More bug fixed introduced by code cleanup
上级
b5d6ad69
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
23 deletion
+35
-23
db/db_impl.cc
db/db_impl.cc
+16
-7
db/db_test.cc
db/db_test.cc
+17
-16
utilities/backupable/backupable_db_test.cc
utilities/backupable/backupable_db_test.cc
+2
-0
未找到文件。
db/db_impl.cc
浏览文件 @
25c8a1a2
...
@@ -277,16 +277,25 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname)
...
@@ -277,16 +277,25 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname)
}
}
DBImpl
::~
DBImpl
()
{
DBImpl
::~
DBImpl
()
{
// only the default CFD is alive at this point
mutex_
.
Lock
();
if
(
default_cf_handle_
!=
nullptr
)
{
if
(
flush_on_destroy_
)
{
auto
default_cfd
=
default_cf_handle_
->
cfd
();
autovector
<
ColumnFamilyData
*>
to_delete
;
if
(
flush_on_destroy_
&&
for
(
auto
cfd
:
*
versions_
->
GetColumnFamilySet
())
{
default_cfd
->
mem
()
->
GetFirstSequenceNumber
()
!=
0
)
{
if
(
cfd
->
mem
()
->
GetFirstSequenceNumber
()
!=
0
)
{
FlushMemTable
(
default_cfd
,
FlushOptions
());
cfd
->
Ref
();
mutex_
.
Unlock
();
FlushMemTable
(
cfd
,
FlushOptions
());
mutex_
.
Lock
();
if
(
cfd
->
Unref
())
{
to_delete
.
push_back
(
cfd
);
}
}
}
for
(
auto
cfd
:
to_delete
)
{
delete
cfd
;
}
}
}
}
mutex_
.
Lock
();
// Wait for background work to finish
// Wait for background work to finish
shutting_down_
.
Release_Store
(
this
);
// Any non-nullptr value is ok
shutting_down_
.
Release_Store
(
this
);
// Any non-nullptr value is ok
while
(
bg_compaction_scheduled_
||
while
(
bg_compaction_scheduled_
||
...
...
db/db_test.cc
浏览文件 @
25c8a1a2
...
@@ -1998,34 +1998,35 @@ TEST(DBTest, RollLog) {
...
@@ -1998,34 +1998,35 @@ TEST(DBTest, RollLog) {
TEST
(
DBTest
,
WAL
)
{
TEST
(
DBTest
,
WAL
)
{
do
{
do
{
CreateAndReopenWithCF
({
"pikachu"
});
WriteOptions
writeOpt
=
WriteOptions
();
WriteOptions
writeOpt
=
WriteOptions
();
writeOpt
.
disableWAL
=
true
;
writeOpt
.
disableWAL
=
true
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"foo"
,
"v1"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"foo"
,
"v1"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"bar"
,
"v1"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"bar"
,
"v1"
));
Reopen
(
);
Reopen
WithColumnFamilies
({
"default"
,
"pikachu"
}
);
ASSERT_EQ
(
"v1"
,
Get
(
"foo"
));
ASSERT_EQ
(
"v1"
,
Get
(
1
,
"foo"
));
ASSERT_EQ
(
"v1"
,
Get
(
"bar"
));
ASSERT_EQ
(
"v1"
,
Get
(
1
,
"bar"
));
writeOpt
.
disableWAL
=
false
;
writeOpt
.
disableWAL
=
false
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"bar"
,
"v2"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"bar"
,
"v2"
));
writeOpt
.
disableWAL
=
true
;
writeOpt
.
disableWAL
=
true
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"foo"
,
"v2"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"foo"
,
"v2"
));
Reopen
(
);
Reopen
WithColumnFamilies
({
"default"
,
"pikachu"
}
);
// Both value's should be present.
// Both value's should be present.
ASSERT_EQ
(
"v2"
,
Get
(
"bar"
));
ASSERT_EQ
(
"v2"
,
Get
(
1
,
"bar"
));
ASSERT_EQ
(
"v2"
,
Get
(
"foo"
));
ASSERT_EQ
(
"v2"
,
Get
(
1
,
"foo"
));
writeOpt
.
disableWAL
=
true
;
writeOpt
.
disableWAL
=
true
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"bar"
,
"v3"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"bar"
,
"v3"
));
writeOpt
.
disableWAL
=
false
;
writeOpt
.
disableWAL
=
false
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
"foo"
,
"v3"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"foo"
,
"v3"
));
Reopen
(
);
Reopen
WithColumnFamilies
({
"default"
,
"pikachu"
}
);
// again both values should be present.
// again both values should be present.
ASSERT_EQ
(
"v3"
,
Get
(
"foo"
));
ASSERT_EQ
(
"v3"
,
Get
(
1
,
"foo"
));
ASSERT_EQ
(
"v3"
,
Get
(
"bar"
));
ASSERT_EQ
(
"v3"
,
Get
(
1
,
"bar"
));
}
while
(
ChangeCompactOptions
());
}
while
(
ChangeCompactOptions
());
}
}
...
@@ -2130,7 +2131,7 @@ TEST(DBTest, FLUSH) {
...
@@ -2130,7 +2131,7 @@ TEST(DBTest, FLUSH) {
ReopenWithColumnFamilies
({
"default"
,
"pikachu"
});
ReopenWithColumnFamilies
({
"default"
,
"pikachu"
});
ASSERT_EQ
(
"v1"
,
Get
(
1
,
"foo"
));
ASSERT_EQ
(
"v1"
,
Get
(
1
,
"foo"
));
ASSERT_EQ
(
"
NOT_FOUND
"
,
Get
(
1
,
"bar"
));
ASSERT_EQ
(
"
v1
"
,
Get
(
1
,
"bar"
));
writeOpt
.
disableWAL
=
true
;
writeOpt
.
disableWAL
=
true
;
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"bar"
,
"v2"
));
ASSERT_OK
(
dbfull
()
->
Put
(
writeOpt
,
handles_
[
1
],
"bar"
,
"v2"
));
...
...
utilities/backupable/backupable_db_test.cc
浏览文件 @
25c8a1a2
...
@@ -721,6 +721,8 @@ TEST(BackupableDBTest, FailOverwritingBackups) {
...
@@ -721,6 +721,8 @@ TEST(BackupableDBTest, FailOverwritingBackups) {
OpenBackupableDB
(
true
);
OpenBackupableDB
(
true
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
FillDB
(
db_
.
get
(),
100
*
i
,
100
*
(
i
+
1
));
FillDB
(
db_
.
get
(),
100
*
i
,
100
*
(
i
+
1
));
CloseBackupableDB
();
OpenBackupableDB
(
false
);
ASSERT_OK
(
db_
->
CreateNewBackup
(
true
));
ASSERT_OK
(
db_
->
CreateNewBackup
(
true
));
CloseBackupableDB
();
CloseBackupableDB
();
OpenBackupableDB
(
false
);
OpenBackupableDB
(
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录