Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
0f7e8085
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
0f7e8085
编写于
7月 24, 2020
作者:
B
BossZou
提交者:
GitHub
7月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix HasPartition (#2997)
Signed-off-by:
N
yhz
<
413554850@qq.com
>
上级
2aa02094
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
18 deletion
+30
-18
core/src/db/SSDB.h
core/src/db/SSDB.h
+3
-0
core/src/db/SSDBImpl.cpp
core/src/db/SSDBImpl.cpp
+19
-0
core/src/db/SSDBImpl.h
core/src/db/SSDBImpl.h
+3
-0
core/src/server/delivery/request/HasPartitionRequest.cpp
core/src/server/delivery/request/HasPartitionRequest.cpp
+5
-18
未找到文件。
core/src/db/SSDB.h
浏览文件 @
0f7e8085
...
...
@@ -81,6 +81,9 @@ class SSDB {
virtual
Status
ShowPartitions
(
const
std
::
string
&
collection_name
,
std
::
vector
<
std
::
string
>&
partition_names
)
=
0
;
virtual
Status
HasPartition
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_tag
,
bool
&
exist
)
=
0
;
virtual
Status
InsertEntities
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_name
,
DataChunkPtr
&
data_chunk
)
=
0
;
...
...
core/src/db/SSDBImpl.cpp
浏览文件 @
0f7e8085
...
...
@@ -373,6 +373,25 @@ SSDBImpl::ShowPartitions(const std::string& collection_name, std::vector<std::st
return
Status
::
OK
();
}
Status
SSDBImpl
::
HasPartition
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_tag
,
bool
&
exist
)
{
CHECK_INITIALIZED
;
snapshot
::
ScopedSnapshotT
ss
;
STATUS_CHECK
(
snapshot
::
Snapshots
::
GetInstance
().
GetSnapshot
(
ss
,
collection_name
));
auto
partition_tags
=
std
::
move
(
ss
->
GetPartitionNames
());
for
(
auto
&
tag
:
partition_tags
)
{
if
(
tag
==
partition_tag
)
{
exist
=
true
;
return
Status
::
OK
();
}
}
exist
=
false
;
return
Status
::
OK
();
}
Status
SSDBImpl
::
InsertEntities
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_name
,
DataChunkPtr
&
data_chunk
)
{
...
...
core/src/db/SSDBImpl.h
浏览文件 @
0f7e8085
...
...
@@ -76,6 +76,9 @@ class SSDBImpl : public SSDB {
Status
ShowPartitions
(
const
std
::
string
&
collection_name
,
std
::
vector
<
std
::
string
>&
partition_names
)
override
;
Status
HasPartition
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_tag
,
bool
&
exist
)
override
;
Status
InsertEntities
(
const
std
::
string
&
collection_name
,
const
std
::
string
&
partition_name
,
DataChunkPtr
&
data_chunk
)
override
;
...
...
core/src/server/delivery/request/HasPartitionRequest.cpp
浏览文件 @
0f7e8085
...
...
@@ -51,26 +51,13 @@ HasPartitionRequest::OnExecute() {
return
status
;
}
// only process root collection, ignore partition collection
engine
::
meta
::
CollectionSchema
collection_schema
;
collection_schema
.
collection_id_
=
collection_name_
;
status
=
DBWrapper
::
DB
()
->
DescribeCollection
(
collection_schema
);
if
(
!
status
.
ok
())
{
if
(
status
.
code
()
==
DB_NOT_FOUND
)
{
return
Status
(
SERVER_COLLECTION_NOT_EXIST
,
CollectionNotExistMsg
(
collection_name_
));
}
else
{
return
status
;
}
}
else
{
if
(
!
collection_schema
.
owner_collection_
.
empty
())
{
return
Status
(
SERVER_INVALID_COLLECTION_NAME
,
CollectionNotExistMsg
(
collection_name_
));
}
bool
exists
=
false
;
STATUS_CHECK
(
DBWrapper
::
SSDB
()
->
HasCollection
(
collection_name_
,
exists
));
if
(
!
exists
)
{
return
Status
(
SERVER_COLLECTION_NOT_EXIST
,
CollectionNotExistMsg
(
collection_name_
));
}
status
=
DBWrapper
::
DB
()
->
HasPartition
(
collection_name_
,
partition_tag_
,
has_partition_
);
if
(
!
status
.
ok
())
{
return
status
;
}
STATUS_CHECK
(
DBWrapper
::
SSDB
()
->
HasPartition
(
collection_name_
,
partition_tag_
,
has_partition_
));
}
catch
(
std
::
exception
&
ex
)
{
return
Status
(
SERVER_UNEXPECTED_ERROR
,
ex
.
what
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录