Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
ecc52d36
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ecc52d36
编写于
6月 19, 2020
作者:
X
XuPeng-SH
提交者:
GitHub
6月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(db/snapshot): fix ut errors (#2605)
Signed-off-by:
N
peng.xu
<
peng.xu@zilliz.com
>
上级
523ed18c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
27 addition
and
16 deletion
+27
-16
core/src/db/snapshot/Operations.cpp
core/src/db/snapshot/Operations.cpp
+3
-2
core/src/db/snapshot/Operations.h
core/src/db/snapshot/Operations.h
+7
-6
core/src/db/snapshot/ResourceOperations.h
core/src/db/snapshot/ResourceOperations.h
+1
-1
core/unittest/db/test_snapshot.cpp
core/unittest/db/test_snapshot.cpp
+16
-7
未找到文件。
core/src/db/snapshot/Operations.cpp
浏览文件 @
ecc52d36
...
...
@@ -82,10 +82,11 @@ Operations::operator()(Store& store) {
void
Operations
::
SetStatus
(
const
Status
&
status
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
finish_mtx_
);
status_
=
status
;
}
Status
const
Status
&
Operations
::
WaitToFinish
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
finish_mtx_
);
finish_cond_
.
wait
(
lock
,
[
this
]
{
return
done_
;
});
...
...
@@ -182,7 +183,7 @@ Operations::GetSnapshot(ScopedSnapshotT& ss) const {
return
status
;
}
Status
const
Status
&
Operations
::
ApplyToStore
(
Store
&
store
)
{
if
(
GetType
()
==
OperationsType
::
W_Compound
)
{
/* std::cout << ToString() << std::endl; */
...
...
core/src/db/snapshot/Operations.h
浏览文件 @
ecc52d36
...
...
@@ -104,10 +104,10 @@ class Operations : public std::enable_shared_from_this<Operations> {
virtual
Status
PreCheck
();
virtual
Status
virtual
const
Status
&
ApplyToStore
(
Store
&
store
);
Status
const
Status
&
WaitToFinish
();
void
...
...
@@ -116,8 +116,9 @@ class Operations : public std::enable_shared_from_this<Operations> {
void
SetStatus
(
const
Status
&
status
);
Status
const
Status
&
GetStatus
()
const
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
finish_mtx_
);
return
status_
;
}
...
...
@@ -241,7 +242,7 @@ class LoadOperation : public Operations {
:
Operations
(
OperationContext
(),
ScopedSnapshotT
(),
OperationsType
::
O_Leaf
),
context_
(
context
)
{
}
Status
const
Status
&
ApplyToStore
(
Store
&
store
)
override
{
if
(
done_
)
{
Done
(
store
);
...
...
@@ -290,7 +291,7 @@ class HardDeleteOperation : public Operations {
:
Operations
(
OperationContext
(),
ScopedSnapshotT
(),
OperationsType
::
W_Leaf
),
id_
(
id
)
{
}
Status
const
Status
&
ApplyToStore
(
Store
&
store
)
override
{
if
(
done_
)
return
status_
;
...
...
@@ -311,7 +312,7 @@ class HardDeleteOperation<Collection> : public Operations {
:
Operations
(
OperationContext
(),
ScopedSnapshotT
(),
OperationsType
::
W_Leaf
),
id_
(
id
)
{
}
Status
const
Status
&
ApplyToStore
(
Store
&
store
)
override
{
if
(
done_
)
{
Done
(
store
);
...
...
core/src/db/snapshot/ResourceOperations.h
浏览文件 @
ecc52d36
...
...
@@ -108,7 +108,7 @@ class LoadOperation<Collection> : public Operations {
:
Operations
(
OperationContext
(),
ScopedSnapshotT
(),
OperationsType
::
O_Leaf
),
context_
(
context
)
{
}
Status
const
Status
&
ApplyToStore
(
Store
&
store
)
override
{
if
(
done_
)
{
Done
(
store
);
...
...
core/unittest/db/test_snapshot.cpp
浏览文件 @
ecc52d36
...
...
@@ -839,7 +839,7 @@ TEST_F(SnapshotTest, CompoundTest1) {
context
.
lsn
=
next_lsn
();
auto
op
=
std
::
make_shared
<
NewSegmentOperation
>
(
context
,
latest_ss
);
SegmentPtr
new_seg
;
status
=
op
->
CommitNewSegment
(
new_seg
);
auto
status
=
op
->
CommitNewSegment
(
new_seg
);
if
(
!
status
.
ok
())
{
std
::
cout
<<
status
.
ToString
()
<<
std
::
endl
;
}
...
...
@@ -1121,8 +1121,12 @@ TEST_F(SnapshotTest, CompoundTest2) {
for
(
auto
&
id
:
seg_ids
)
{
auto
seg
=
latest_ss
->
GetResource
<
Segment
>
(
id
);
if
(
!
seg
)
{
std
::
cout
<<
"Error seg="
<<
id
<<
std
::
endl
;
ASSERT_TRUE
(
seg
);
std
::
cout
<<
"Stale seg="
<<
id
<<
std
::
endl
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
partition_mtx
);
std
::
cout
<<
((
stale_partitions
.
find
(
p_id
)
!=
stale_partitions
.
end
())
?
" due stale partition"
:
" unexpected"
)
<<
std
::
endl
;
ASSERT_TRUE
(
stale_partitions
.
find
(
p_id
)
!=
stale_partitions
.
end
());
return
;
}
if
(
!
partition
)
{
partition
=
latest_ss
->
GetResource
<
Partition
>
(
seg
->
GetPartitionId
());
...
...
@@ -1212,7 +1216,7 @@ TEST_F(SnapshotTest, CompoundTest2) {
context
.
lsn
=
next_lsn
();
auto
op
=
std
::
make_shared
<
NewSegmentOperation
>
(
context
,
latest_ss
);
SegmentPtr
new_seg
;
status
=
op
->
CommitNewSegment
(
new_seg
);
auto
status
=
op
->
CommitNewSegment
(
new_seg
);
if
(
!
status
.
ok
())
{
std
::
cout
<<
status
.
ToString
()
<<
std
::
endl
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
partition_mtx
);
...
...
@@ -1229,8 +1233,13 @@ TEST_F(SnapshotTest, CompoundTest2) {
}
status
=
op
->
Push
();
if
(
!
status
.
ok
())
{
std
::
cout
<<
status
.
ToString
()
<<
std
::
endl
;
std
::
unique_lock
<
std
::
mutex
>
lock
(
partition_mtx
);
/* if (stale_partitions.find(partition_id) == stale_partitions.end()) { */
/* for (auto p : stale_partitions) { */
/* std::cout << "stale p: " << p << std::endl; */
/* } */
/* ASSERT_TRUE(false); */
/* } */
ASSERT_TRUE
(
stale_partitions
.
find
(
partition_id
)
!=
stale_partitions
.
end
());
return
;
}
...
...
@@ -1289,10 +1298,10 @@ TEST_F(SnapshotTest, CompoundTest2) {
};
for
(
auto
i
=
0
;
i
<
loop_cnt
;
++
i
)
{
if
(
RandomInt
(
0
,
10
)
>
6
)
{
if
(
RandomInt
(
0
,
10
)
>
5
)
{
create_partition
();
}
if
(
RandomInt
(
0
,
10
)
>
8
)
{
if
(
RandomInt
(
0
,
10
)
>
7
)
{
drop_partition
();
}
create_new_segment
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录