Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
2cd88ef8
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 搜索 >>
未验证
提交
2cd88ef8
编写于
7月 06, 2020
作者:
Y
yukun
提交者:
GitHub
7月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2743 from fishpenguin/scalar-field-filtering
Scalar field filtering
上级
5854a09b
8f31d93d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
67 addition
and
10 deletion
+67
-10
CHANGELOG.md
CHANGELOG.md
+3
-0
core/src/db/DB.h
core/src/db/DB.h
+6
-0
core/src/db/DBImpl.cpp
core/src/db/DBImpl.cpp
+30
-0
core/src/db/DBImpl.h
core/src/db/DBImpl.h
+6
-0
core/src/db/wal/WalManager.cpp
core/src/db/wal/WalManager.cpp
+6
-6
core/src/server/ValidationUtil.cpp
core/src/server/ValidationUtil.cpp
+8
-2
core/src/server/delivery/request/DeleteByIDRequest.cpp
core/src/server/delivery/request/DeleteByIDRequest.cpp
+1
-1
core/src/server/grpc_impl/GrpcRequestHandler.cpp
core/src/server/grpc_impl/GrpcRequestHandler.cpp
+7
-1
未找到文件。
CHANGELOG.md
浏览文件 @
2cd88ef8
...
...
@@ -21,7 +21,10 @@ Please mark all changes in change log and use the issue from GitHub
-
\#
2696 Check the validity of the parameters of creating collection: segment_size
-
\#
2697 Index can not be created
-
\#
2698 Count entities got wrong result with binary vectors
-
\#
2728 Index type name should returned if index type is not supported
-
\#
2731 No entity returned with
`get_entity_by_id`
-
\#
2732 Server destroyed after
`delete by id`
-
\#
2733 The max value of top-k should be limited
## Feature
-
\#
2319 Redo metadata to support MVCC
...
...
core/src/db/DB.h
浏览文件 @
2cd88ef8
...
...
@@ -103,9 +103,15 @@ class DB {
virtual
Status
DeleteVector
(
const
std
::
string
&
collection_id
,
IDNumber
vector_id
)
=
0
;
virtual
Status
DeleteEntity
(
const
std
::
string
&
collection_id
,
IDNumber
entity_id
)
=
0
;
virtual
Status
DeleteVectors
(
const
std
::
string
&
collection_id
,
IDNumbers
vector_ids
)
=
0
;
virtual
Status
DeleteEntities
(
const
std
::
string
&
collection_id
,
IDNumbers
entity_ids
)
=
0
;
virtual
Status
Flush
(
const
std
::
string
&
collection_id
)
=
0
;
...
...
core/src/db/DBImpl.cpp
浏览文件 @
2cd88ef8
...
...
@@ -1001,6 +1001,12 @@ DBImpl::DeleteVector(const std::string& collection_id, IDNumber vector_id) {
return
DeleteVectors
(
collection_id
,
ids
);
}
Status
DBImpl
::
DeleteEntity
(
const
std
::
string
&
collection_id
,
milvus
::
engine
::
IDNumber
entity_id
)
{
IDNumbers
ids
;
ids
.
push_back
(
entity_id
);
}
Status
DBImpl
::
DeleteVectors
(
const
std
::
string
&
collection_id
,
IDNumbers
vector_ids
)
{
if
(
!
initialized_
.
load
(
std
::
memory_order_acquire
))
{
...
...
@@ -1025,6 +1031,30 @@ DBImpl::DeleteVectors(const std::string& collection_id, IDNumbers vector_ids) {
return
status
;
}
Status
DBImpl
::
DeleteEntities
(
const
std
::
string
&
collection_id
,
milvus
::
engine
::
IDNumbers
entity_ids
)
{
if
(
!
initialized_
.
load
(
std
::
memory_order_acquire
))
{
return
SHUTDOWN_ERROR
;
}
Status
status
;
if
(
options_
.
wal_enable_
)
{
wal_mgr_
->
DeleteById
(
collection_id
,
entity_ids
);
swn_wal_
.
Notify
();
}
else
{
wal
::
MXLogRecord
record
;
record
.
lsn
=
0
;
// need to get from meta ?
record
.
type
=
wal
::
MXLogType
::
Delete
;
record
.
collection_id
=
collection_id
;
record
.
ids
=
entity_ids
.
data
();
record
.
length
=
entity_ids
.
size
();
status
=
ExecWalRecord
(
record
);
}
return
status
;
}
Status
DBImpl
::
Flush
(
const
std
::
string
&
collection_id
)
{
if
(
!
initialized_
.
load
(
std
::
memory_order_acquire
))
{
...
...
core/src/db/DBImpl.h
浏览文件 @
2cd88ef8
...
...
@@ -113,9 +113,15 @@ class DBImpl : public DB, public server::CacheConfigHandler, public server::Engi
Status
DeleteVector
(
const
std
::
string
&
collection_id
,
IDNumber
vector_id
)
override
;
Status
DeleteEntity
(
const
std
::
string
&
collection_id
,
IDNumber
entity_id
)
override
;
Status
DeleteVectors
(
const
std
::
string
&
collection_id
,
IDNumbers
vector_ids
)
override
;
Status
DeleteEntities
(
const
std
::
string
&
collection_id
,
IDNumbers
entity_ids
)
override
;
Status
Flush
(
const
std
::
string
&
collection_id
)
override
;
...
...
core/src/db/wal/WalManager.cpp
浏览文件 @
2cd88ef8
...
...
@@ -575,9 +575,9 @@ WalManager::InsertEntities(const std::string& collection_id, const std::string&
}
bool
WalManager
::
DeleteById
(
const
std
::
string
&
collection_id
,
const
IDNumbers
&
vector
_ids
)
{
size_t
vector_num
=
vector
_ids
.
size
();
if
(
vector
_num
==
0
)
{
WalManager
::
DeleteById
(
const
std
::
string
&
collection_id
,
const
IDNumbers
&
entity
_ids
)
{
size_t
entity_num
=
entity
_ids
.
size
();
if
(
entity
_num
==
0
)
{
LOG_WAL_ERROR_
<<
"The ids is empty."
;
return
false
;
}
...
...
@@ -591,7 +591,7 @@ WalManager::DeleteById(const std::string& collection_id, const IDNumbers& vector
record
.
partition_tag
=
""
;
uint64_t
new_lsn
=
0
;
for
(
size_t
i
=
0
;
i
<
vector
_num
;
i
+=
record
.
length
)
{
for
(
size_t
i
=
0
;
i
<
entity
_num
;
i
+=
record
.
length
)
{
size_t
surplus_space
=
p_buffer_
->
SurplusSpace
();
size_t
max_rcd_num
=
0
;
if
(
surplus_space
>=
head_size
+
unit_size
)
{
...
...
@@ -600,8 +600,8 @@ WalManager::DeleteById(const std::string& collection_id, const IDNumbers& vector
max_rcd_num
=
(
mxlog_config_
.
buffer_size
-
head_size
)
/
unit_size
;
}
record
.
length
=
std
::
min
(
vector
_num
-
i
,
max_rcd_num
);
record
.
ids
=
vector
_ids
.
data
()
+
i
;
record
.
length
=
std
::
min
(
entity
_num
-
i
,
max_rcd_num
);
record
.
ids
=
entity
_ids
.
data
()
+
i
;
record
.
data_size
=
0
;
record
.
data
=
nullptr
;
...
...
core/src/server/ValidationUtil.cpp
浏览文件 @
2cd88ef8
...
...
@@ -193,8 +193,14 @@ Status
ValidateCollectionIndexType
(
int32_t
index_type
)
{
int
engine_type
=
static_cast
<
int
>
(
engine
::
EngineType
(
index_type
));
if
(
engine_type
<=
0
||
engine_type
>
static_cast
<
int
>
(
engine
::
EngineType
::
MAX_VALUE
))
{
std
::
string
msg
=
"Invalid index type: "
+
std
::
to_string
(
index_type
)
+
". "
+
"Make sure the index type is in IndexType list."
;
std
::
string
index_type_str
;
for
(
auto
it
=
engine
::
s_map_engine_type
.
begin
();
it
!=
engine
::
s_map_engine_type
.
end
();
it
++
)
{
if
(
it
->
second
==
(
engine
::
EngineType
)
index_type
)
{
index_type_str
=
it
->
first
;
}
}
std
::
string
msg
=
"Invalid index type: "
+
index_type_str
+
". "
+
"Make sure the index type is in IndexType list."
;
LOG_SERVER_ERROR_
<<
msg
;
return
Status
(
SERVER_INVALID_INDEX_TYPE
,
msg
);
}
...
...
core/src/server/delivery/request/DeleteByIDRequest.cpp
浏览文件 @
2cd88ef8
...
...
@@ -78,7 +78,7 @@ DeleteByIDRequest::OnExecute() {
rc
.
RecordSection
(
"check validation"
);
status
=
DBWrapper
::
DB
()
->
Delete
Vector
s
(
collection_name_
,
vector_ids_
);
status
=
DBWrapper
::
DB
()
->
Delete
Entitie
s
(
collection_name_
,
vector_ids_
);
if
(
!
status
.
ok
())
{
return
status
;
}
...
...
core/src/server/grpc_impl/GrpcRequestHandler.cpp
浏览文件 @
2cd88ef8
...
...
@@ -21,6 +21,7 @@
#include "context/HybridSearchContext.h"
#include "query/BinaryQuery.h"
#include "server/ValidationUtil.h"
#include "server/context/ConnectionContext.h"
#include "tracing/TextMapCarrier.h"
#include "tracing/TracerUtil.h"
...
...
@@ -1543,7 +1544,12 @@ GrpcRequestHandler::DeserializeJsonToBoolQuery(
json
::
iterator
vector_param_it
=
it
.
value
().
begin
();
if
(
vector_param_it
!=
it
.
value
().
end
())
{
vector_query
->
field_name
=
vector_param_it
.
key
();
vector_query
->
topk
=
vector_param_it
.
value
()[
"topk"
];
int64_t
topk
=
vector_param_it
.
value
()[
"topk"
];
status
=
server
::
ValidateSearchTopk
(
topk
);
if
(
!
status
.
ok
())
{
return
status
;
}
vector_query
->
topk
=
topk
;
vector_query
->
extra_params
=
vector_param_it
.
value
()[
"params"
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录