Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
889424b3
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
889424b3
编写于
8月 09, 2023
作者:
Y
yah01
提交者:
GitHub
8月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix load index with empty file list (#26236)
Signed-off-by:
N
yah01
<
yah2er0ne@outlook.com
>
上级
a8886064
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
5 deletion
+33
-5
internal/querycoordv2/checkers/index_checker.go
internal/querycoordv2/checkers/index_checker.go
+3
-1
internal/querycoordv2/checkers/index_checker_test.go
internal/querycoordv2/checkers/index_checker_test.go
+4
-3
internal/querynodev2/segments/segment_loader.go
internal/querynodev2/segments/segment_loader.go
+6
-1
internal/querynodev2/segments/segment_loader_test.go
internal/querynodev2/segments/segment_loader_test.go
+20
-0
未找到文件。
internal/querycoordv2/checkers/index_checker.go
浏览文件 @
889424b3
...
...
@@ -102,7 +102,9 @@ func (c *IndexChecker) checkReplica(ctx context.Context, collection *meta.Collec
continue
}
for
_
,
info
:=
range
infos
{
if
missingFields
.
Contain
(
info
.
GetFieldID
())
&&
info
.
GetEnableIndex
()
{
if
missingFields
.
Contain
(
info
.
GetFieldID
())
&&
info
.
GetEnableIndex
()
&&
len
(
info
.
GetIndexFilePaths
())
>
0
{
segmentsToUpdate
.
Insert
(
segment
)
}
}
...
...
internal/querycoordv2/checkers/index_checker_test.go
浏览文件 @
889424b3
...
...
@@ -97,9 +97,10 @@ func (suite *IndexCheckerSuite) TestLoadIndex() {
suite
.
broker
.
EXPECT
()
.
GetIndexInfo
(
mock
.
Anything
,
int64
(
1
),
int64
(
2
))
.
Return
([]
*
querypb
.
FieldIndexInfo
{
{
FieldID
:
101
,
IndexID
:
1000
,
EnableIndex
:
true
,
FieldID
:
101
,
IndexID
:
1000
,
EnableIndex
:
true
,
IndexFilePaths
:
[]
string
{
"index"
},
},
},
nil
)
...
...
internal/querynodev2/segments/segment_loader.go
浏览文件 @
889424b3
...
...
@@ -470,7 +470,7 @@ func (loader *segmentLoader) loadSegment(ctx context.Context,
if
segment
.
Type
()
==
SegmentTypeSealed
{
fieldID2IndexInfo
:=
make
(
map
[
int64
]
*
querypb
.
FieldIndexInfo
)
for
_
,
indexInfo
:=
range
loadInfo
.
IndexInfos
{
if
len
(
indexInfo
.
IndexFilePaths
)
>
0
{
if
len
(
indexInfo
.
GetIndexFilePaths
()
)
>
0
{
fieldID
:=
indexInfo
.
FieldID
fieldID2IndexInfo
[
fieldID
]
=
indexInfo
}
...
...
@@ -947,6 +947,11 @@ func (loader *segmentLoader) LoadIndex(ctx context.Context, segment *LocalSegmen
func
(
info
*
datapb
.
FieldBinlog
)
(
int64
,
*
datapb
.
FieldBinlog
)
{
return
info
.
GetFieldID
(),
info
})
for
_
,
info
:=
range
loadInfo
.
GetIndexInfos
()
{
if
len
(
info
.
GetIndexFilePaths
())
==
0
{
log
.
Warn
(
"failed to add index for segment, index file list is empty, the segment may be too small"
)
return
merr
.
WrapErrIndexNotFound
(
"index file list empty"
)
}
fieldInfo
,
ok
:=
fieldInfos
[
info
.
GetFieldID
()]
if
!
ok
{
return
merr
.
WrapErrParameterInvalid
(
"index info with corresponding field info"
,
"missing field info"
,
strconv
.
FormatInt
(
fieldInfo
.
GetFieldID
(),
10
))
...
...
internal/querynodev2/segments/segment_loader_test.go
浏览文件 @
889424b3
...
...
@@ -28,6 +28,7 @@ import (
"github.com/milvus-io/milvus/internal/storage"
"github.com/milvus-io/milvus/internal/util/initcore"
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/metric"
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
...
...
@@ -352,6 +353,25 @@ func (suite *SegmentLoaderSuite) TestLoadDeltaLogs() {
}
}
func
(
suite
*
SegmentLoaderSuite
)
TestLoadIndex
()
{
ctx
:=
context
.
Background
()
segment
:=
&
LocalSegment
{}
loadInfo
:=
&
querypb
.
SegmentLoadInfo
{
SegmentID
:
1
,
PartitionID
:
suite
.
partitionID
,
CollectionID
:
suite
.
collectionID
,
IndexInfos
:
[]
*
querypb
.
FieldIndexInfo
{
{
IndexFilePaths
:
[]
string
{},
},
},
}
err
:=
suite
.
loader
.
LoadIndex
(
ctx
,
segment
,
loadInfo
)
suite
.
ErrorIs
(
err
,
merr
.
ErrIndexNotFound
)
}
func
(
suite
*
SegmentLoaderSuite
)
TestLoadWithMmap
()
{
key
:=
paramtable
.
Get
()
.
QueryNodeCfg
.
MmapDirPath
.
Key
paramtable
.
Get
()
.
Save
(
key
,
"/tmp/mmap-test"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录