Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
5faf7623
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 搜索 >>
提交
5faf7623
编写于
7月 04, 2020
作者:
F
fishpenguin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Server destroyed after delete by id
Signed-off-by:
N
fishpenguin
<
kun.yu@zilliz.com
>
上级
44ae2891
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
7 deletion
+51
-7
CHANGELOG.md
CHANGELOG.md
+2
-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/delivery/request/DeleteByIDRequest.cpp
core/src/server/delivery/request/DeleteByIDRequest.cpp
+1
-1
未找到文件。
CHANGELOG.md
浏览文件 @
5faf7623
...
...
@@ -23,6 +23,8 @@ Please mark all changes in change log and use the issue from GitHub
-
\#
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
浏览文件 @
5faf7623
...
...
@@ -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
浏览文件 @
5faf7623
...
...
@@ -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
浏览文件 @
5faf7623
...
...
@@ -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
浏览文件 @
5faf7623
...
...
@@ -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/delivery/request/DeleteByIDRequest.cpp
浏览文件 @
5faf7623
...
...
@@ -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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录