Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
6cd8c252
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
6cd8c252
编写于
12月 31, 2020
作者:
D
dragondriver
提交者:
yefu.chen
12月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add parameter check for almost all index type
Signed-off-by:
N
dragondriver
<
jiquan.long@zilliz.com
>
上级
29b21b4b
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
234 addition
and
531 deletion
+234
-531
internal/core/src/indexbuilder/IndexWrapper.cpp
internal/core/src/indexbuilder/IndexWrapper.cpp
+48
-58
internal/core/src/indexbuilder/IndexWrapper.h
internal/core/src/indexbuilder/IndexWrapper.h
+6
-0
internal/core/src/indexbuilder/utils.h
internal/core/src/indexbuilder/utils.h
+9
-4
internal/core/src/segcore/segment_c.cpp
internal/core/src/segcore/segment_c.cpp
+2
-2
internal/core/unittest/test_c_api.cpp
internal/core/unittest/test_c_api.cpp
+3
-458
internal/core/unittest/test_index_wrapper.cpp
internal/core/unittest/test_index_wrapper.cpp
+110
-8
internal/indexbuilder/index_test.go
internal/indexbuilder/index_test.go
+2
-0
internal/master/flush_scheduler.go
internal/master/flush_scheduler.go
+12
-0
internal/master/meta_table.go
internal/master/meta_table.go
+22
-0
internal/master/persistence_scheduler_test.go
internal/master/persistence_scheduler_test.go
+3
-1
internal/querynode/load_index_service_test.go
internal/querynode/load_index_service_test.go
+17
-0
未找到文件。
internal/core/src/indexbuilder/IndexWrapper.cpp
浏览文件 @
6cd8c252
...
...
@@ -67,75 +67,65 @@ IndexWrapper::parse() {
config_
[
key
]
=
value
;
}
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
meta
::
DIM
))
{
// should raise exception here?
PanicInfo
(
"dim must be specific in type params or index params!"
);
}
else
{
auto
dim
=
config_
[
milvus
::
knowhere
::
meta
::
DIM
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
meta
::
DIM
]
=
std
::
stoi
(
dim
);
}
auto
stoi_closure
=
[](
const
std
::
string
&
s
)
->
int
{
return
std
::
stoi
(
s
);
};
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
meta
::
TOPK
))
{
}
else
{
auto
topk
=
config_
[
milvus
::
knowhere
::
meta
::
TOPK
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
meta
::
TOPK
]
=
std
::
stoi
(
topk
);
}
/***************************** meta *******************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
meta
::
DIM
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
meta
::
TOPK
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
nlist
))
{
}
else
{
auto
nlist
=
config_
[
milvus
::
knowhere
::
IndexParams
::
nlist
].
get
<
std
::
string
>
(
);
config_
[
milvus
::
knowhere
::
IndexParams
::
nlist
]
=
std
::
stoi
(
nlis
t
);
}
/***************************** IVF Params *******************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
nprobe
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
nlist
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
m
,
stoi_closure
,
std
::
nullop
t
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
nbits
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
nprobe
))
{
}
else
{
auto
nprobe
=
config_
[
milvus
::
knowhere
::
IndexParams
::
nprobe
].
get
<
std
::
string
>
(
);
config_
[
milvus
::
knowhere
::
IndexParams
::
nprobe
]
=
std
::
stoi
(
nprobe
);
}
/************************** NSG Parameter **************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
knng
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
search_length
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
out_degree
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
candidate
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
nbits
))
{
}
else
{
auto
nbits
=
config_
[
milvus
::
knowhere
::
IndexParams
::
nbits
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
nbits
]
=
std
::
stoi
(
nbits
);
}
/************************** HNSW Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
efConstruction
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
M
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
ef
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
m
))
{
}
else
{
auto
m
=
config_
[
milvus
::
knowhere
::
IndexParams
::
m
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
m
]
=
std
::
stoi
(
m
);
}
/************************** Annoy Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
n_trees
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
search_k
,
stoi_closure
,
std
::
nullopt
);
/************************** NSG Parameter **************************/
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
knng
))
{
}
else
{
auto
knng
=
config_
[
milvus
::
knowhere
::
IndexParams
::
knng
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
knng
]
=
std
::
stoi
(
knng
);
}
/************************** PQ Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
PQM
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
search_length
))
{
}
else
{
auto
search_length
=
config_
[
milvus
::
knowhere
::
IndexParams
::
search_length
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
search_length
]
=
std
::
stoi
(
search_length
);
}
/************************** NGT Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
edge_size
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
out_degree
))
{
}
else
{
auto
out_degree
=
config_
[
milvus
::
knowhere
::
IndexParams
::
out_degree
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
out_degree
]
=
std
::
stoi
(
out_degree
);
}
/************************** NGT Search Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
epsilon
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
max_search_edges
,
stoi_closure
,
std
::
nullopt
);
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
IndexParams
::
candidate
))
{
}
else
{
auto
candidate
=
config_
[
milvus
::
knowhere
::
IndexParams
::
candidate
].
get
<
std
::
string
>
();
config_
[
milvus
::
knowhere
::
IndexParams
::
candidate
]
=
std
::
stoi
(
candidate
);
}
/************************** NGT_PANNG Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
forcedly_pruned_edge_size
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
selectively_pruned_edge_size
,
stoi_closure
,
std
::
nullopt
);
/************************** NGT_ONNG Params *****************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
outgoing_edge_size
,
stoi_closure
,
std
::
nullopt
);
check_parameter
<
int
>
(
milvus
::
knowhere
::
IndexParams
::
incoming_edge_size
,
stoi_closure
,
std
::
nullopt
);
/************************** Serialize Params *******************************/
check_parameter
<
int
>
(
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
stoi_closure
,
std
::
optional
{
4
});
}
/************************** Serialize *******************************/
if
(
!
config_
.
contains
(
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
))
{
config_
[
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
]
=
4
;
template
<
typename
T
>
void
IndexWrapper
::
check_parameter
(
const
std
::
string
&
key
,
std
::
function
<
T
(
std
::
string
)
>
fn
,
std
::
optional
<
T
>
default_v
)
{
if
(
!
config_
.
contains
(
key
))
{
if
(
default_v
.
has_value
())
{
config_
[
key
]
=
default_v
.
value
();
}
}
else
{
auto
slice_size
=
config_
[
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
].
get
<
std
::
string
>
()
;
config_
[
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
]
=
std
::
stoi
(
slice_siz
e
);
auto
value
=
config_
[
key
]
;
config_
[
key
]
=
fn
(
valu
e
);
}
}
...
...
internal/core/src/indexbuilder/IndexWrapper.h
浏览文件 @
6cd8c252
...
...
@@ -52,6 +52,12 @@ class IndexWrapper {
void
StoreRawData
(
const
knowhere
::
DatasetPtr
&
dataset
);
template
<
typename
T
>
void
check_parameter
(
const
std
::
string
&
key
,
std
::
function
<
T
(
std
::
string
)
>
fn
,
std
::
optional
<
T
>
default_v
=
std
::
nullopt
);
public:
void
BuildWithIds
(
const
knowhere
::
DatasetPtr
&
dataset
);
...
...
internal/core/src/indexbuilder/utils.h
浏览文件 @
6cd8c252
...
...
@@ -25,14 +25,17 @@ NM_List() {
static
std
::
vector
<
std
::
string
>
ret
{
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_IVFFLAT
,
milvus
::
knowhere
::
IndexEnum
::
INDEX_NSG
,
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWFlat
,
};
return
ret
;
}
std
::
vector
<
std
::
string
>
BIN_List
()
{
static
std
::
vector
<
std
::
string
>
ret
{
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IDMAP
,
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IVFFLAT
};
static
std
::
vector
<
std
::
string
>
ret
{
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IDMAP
,
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IVFFLAT
,
};
return
ret
;
}
...
...
@@ -40,7 +43,7 @@ std::vector<std::string>
Need_ID_List
()
{
static
std
::
vector
<
std
::
string
>
ret
{
// milvus::knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT,
// milvus::knowhere::IndexEnum::INDEX_NSG
// milvus::knowhere::IndexEnum::INDEX_NSG
,
};
return
ret
;
...
...
@@ -48,7 +51,9 @@ Need_ID_List() {
std
::
vector
<
std
::
string
>
Need_BuildAll_list
()
{
static
std
::
vector
<
std
::
string
>
ret
{
milvus
::
knowhere
::
IndexEnum
::
INDEX_NSG
};
static
std
::
vector
<
std
::
string
>
ret
{
milvus
::
knowhere
::
IndexEnum
::
INDEX_NSG
,
};
return
ret
;
}
...
...
internal/core/src/segcore/segment_c.cpp
浏览文件 @
6cd8c252
...
...
@@ -181,15 +181,15 @@ FillTargetEntry(CSegmentBase c_segment, CPlan c_plan, CQueryResult c_result) {
CStatus
UpdateSegmentIndex
(
CSegmentBase
c_segment
,
CLoadIndexInfo
c_load_index_info
)
{
auto
status
=
CStatus
();
try
{
auto
segment
=
(
milvus
::
segcore
::
SegmentBase
*
)
c_segment
;
auto
load_index_info
=
(
LoadIndexInfo
*
)
c_load_index_info
;
auto
res
=
segment
->
LoadIndexing
(
*
load_index_info
);
auto
status
=
CStatus
(
);
status
.
error_code
=
Success
;
status
.
error_msg
=
""
;
return
status
;
}
catch
(
std
::
exception
&
e
)
{
auto
status
=
CStatus
();
status
.
error_code
=
UnexpectedException
;
status
.
error_msg
=
strdup
(
e
.
what
());
return
status
;
...
...
internal/core/unittest/test_c_api.cpp
浏览文件 @
6cd8c252
此差异已折叠。
点击以展开。
internal/core/unittest/test_index_wrapper.cpp
浏览文件 @
6cd8c252
...
...
@@ -99,14 +99,105 @@ generate_conf(const milvus::knowhere::IndexType& index_type, const milvus::knowh
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_NSG
)
{
return
milvus
::
knowhere
::
Config
{{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
{
milvus
::
knowhere
::
IndexParams
::
nlist
,
163
},
{
milvus
::
knowhere
::
IndexParams
::
nprobe
,
8
},
{
milvus
::
knowhere
::
IndexParams
::
knng
,
20
},
{
milvus
::
knowhere
::
IndexParams
::
search_length
,
40
},
{
milvus
::
knowhere
::
IndexParams
::
out_degree
,
30
},
{
milvus
::
knowhere
::
IndexParams
::
candidate
,
100
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
}};
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
{
milvus
::
knowhere
::
IndexParams
::
nlist
,
163
},
{
milvus
::
knowhere
::
IndexParams
::
nprobe
,
8
},
{
milvus
::
knowhere
::
IndexParams
::
knng
,
20
},
{
milvus
::
knowhere
::
IndexParams
::
search_length
,
40
},
{
milvus
::
knowhere
::
IndexParams
::
out_degree
,
30
},
{
milvus
::
knowhere
::
IndexParams
::
candidate
,
100
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
};
#ifdef MILVUS_SUPPORT_SPTAG
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_SPTAG_KDT_RNT
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_SPTAG_BKT_RNT
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
#endif
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_HNSW
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
IndexParams
::
M
,
16
},
{
milvus
::
knowhere
::
IndexParams
::
efConstruction
,
200
},
{
milvus
::
knowhere
::
IndexParams
::
ef
,
200
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_ANNOY
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
IndexParams
::
n_trees
,
4
},
{
milvus
::
knowhere
::
IndexParams
::
search_k
,
100
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWFlat
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
IndexParams
::
M
,
16
},
{
milvus
::
knowhere
::
IndexParams
::
efConstruction
,
200
},
{
milvus
::
knowhere
::
IndexParams
::
ef
,
200
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWPQ
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
IndexParams
::
M
,
16
},
{
milvus
::
knowhere
::
IndexParams
::
efConstruction
,
200
},
{
milvus
::
knowhere
::
IndexParams
::
ef
,
200
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
{
milvus
::
knowhere
::
IndexParams
::
PQM
,
8
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWSQ
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
IndexParams
::
M
,
16
},
{
milvus
::
knowhere
::
IndexParams
::
efConstruction
,
200
},
{
milvus
::
knowhere
::
IndexParams
::
ef
,
200
},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_NGTPANNG
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
IndexParams
::
edge_size
,
10
},
{
milvus
::
knowhere
::
IndexParams
::
epsilon
,
0.1
},
{
milvus
::
knowhere
::
IndexParams
::
max_search_edges
,
50
},
{
milvus
::
knowhere
::
IndexParams
::
forcedly_pruned_edge_size
,
60
},
{
milvus
::
knowhere
::
IndexParams
::
selectively_pruned_edge_size
,
30
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
else
if
(
index_type
==
milvus
::
knowhere
::
IndexEnum
::
INDEX_NGTONNG
)
{
return
milvus
::
knowhere
::
Config
{
{
milvus
::
knowhere
::
meta
::
DIM
,
DIM
},
// {milvus::knowhere::meta::TOPK, 10},
{
milvus
::
knowhere
::
Metric
::
TYPE
,
metric_type
},
{
milvus
::
knowhere
::
IndexParams
::
edge_size
,
20
},
{
milvus
::
knowhere
::
IndexParams
::
epsilon
,
0.1
},
{
milvus
::
knowhere
::
IndexParams
::
max_search_edges
,
50
},
{
milvus
::
knowhere
::
IndexParams
::
outgoing_edge_size
,
5
},
{
milvus
::
knowhere
::
IndexParams
::
incoming_edge_size
,
40
},
{
milvus
::
knowhere
::
INDEX_FILE_SLICE_SIZE_IN_MEGABYTE
,
4
},
};
}
return
milvus
::
knowhere
::
Config
();
}
...
...
@@ -366,6 +457,17 @@ INSTANTIATE_TEST_CASE_P(
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IVFFLAT
,
milvus
::
knowhere
::
Metric
::
JACCARD
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_FAISS_BIN_IDMAP
,
milvus
::
knowhere
::
Metric
::
JACCARD
),
#ifdef MILVUS_SUPPORT_SPTAG
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_SPTAG_KDT_RNT
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_SPTAG_BKT_RNT
,
milvus
::
knowhere
::
Metric
::
L2
),
#endif
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_HNSW
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_ANNOY
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWFlat
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWPQ
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_RHNSWSQ
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_NGTPANNG
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_NGTONNG
,
milvus
::
knowhere
::
Metric
::
L2
),
std
::
pair
(
milvus
::
knowhere
::
IndexEnum
::
INDEX_NSG
,
milvus
::
knowhere
::
Metric
::
L2
)));
TEST_P
(
IndexWrapperTest
,
Constructor
)
{
...
...
internal/indexbuilder/index_test.go
浏览文件 @
6cd8c252
...
...
@@ -181,6 +181,8 @@ func TestCIndex_Codec(t *testing.T) {
err
=
index
.
Delete
()
assert
.
Equal
(
t
,
err
,
nil
)
err
=
copyIndex
.
Delete
()
assert
.
Equal
(
t
,
err
,
nil
)
}
}
...
...
internal/master/flush_scheduler.go
浏览文件 @
6cd8c252
...
...
@@ -68,6 +68,18 @@ func (scheduler *FlushScheduler) describe() error {
return
err
}
for
fieldID
,
data
:=
range
mapData
{
// check field indexable
segMeta
,
err
:=
scheduler
.
metaTable
.
GetSegmentByID
(
singleSegmentID
)
if
err
!=
nil
{
return
err
}
indexable
,
err
:=
scheduler
.
metaTable
.
IsIndexable
(
segMeta
.
CollectionID
,
fieldID
)
if
err
!=
nil
{
return
err
}
if
!
indexable
{
continue
}
info
:=
&
IndexBuildInfo
{
segmentID
:
singleSegmentID
,
fieldID
:
fieldID
,
...
...
internal/master/meta_table.go
浏览文件 @
6cd8c252
...
...
@@ -5,6 +5,8 @@ import (
"strconv"
"sync"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/util/typeutil"
...
...
@@ -678,3 +680,23 @@ func (mt *metaTable) UpdateFieldIndexParams(collName string, fieldName string, i
return
fmt
.
Errorf
(
"can not find field with id %s"
,
fieldName
)
}
func
(
mt
*
metaTable
)
IsIndexable
(
collID
UniqueID
,
fieldID
UniqueID
)
(
bool
,
error
)
{
mt
.
ddLock
.
RLock
()
defer
mt
.
ddLock
.
RUnlock
()
if
_
,
ok
:=
mt
.
collID2Meta
[
collID
];
!
ok
{
return
false
,
fmt
.
Errorf
(
"can not find collection with id %d"
,
collID
)
}
for
_
,
v
:=
range
mt
.
collID2Meta
[
collID
]
.
Schema
.
Fields
{
// field is vector type and index params is not empty
if
v
.
FieldID
==
fieldID
&&
(
v
.
DataType
==
schemapb
.
DataType_VECTOR_BINARY
||
v
.
DataType
==
schemapb
.
DataType_VECTOR_FLOAT
)
&&
len
(
v
.
IndexParams
)
!=
0
{
return
true
,
nil
}
}
// fieldID is not in schema(eg: timestamp) or not indexable
return
false
,
nil
}
internal/master/persistence_scheduler_test.go
浏览文件 @
6cd8c252
...
...
@@ -5,6 +5,8 @@ import (
"testing"
"time"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/proto/etcdpb"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
...
...
@@ -43,7 +45,7 @@ func TestPersistenceScheduler(t *testing.T) {
Name
:
"testcoll"
,
Fields
:
[]
*
schemapb
.
FieldSchema
{
{
FieldID
:
1
},
{
FieldID
:
100
},
{
FieldID
:
100
,
DataType
:
schemapb
.
DataType_VECTOR_FLOAT
,
IndexParams
:
[]
*
commonpb
.
KeyValuePair
{{
Key
:
"k"
,
Value
:
"v"
}}
},
},
},
})
...
...
internal/querynode/load_index_service_test.go
浏览文件 @
6cd8c252
...
...
@@ -16,6 +16,23 @@ import (
"github.com/zilliztech/milvus-distributed/internal/querynode/client"
)
//func TestLoadIndexClient_LoadIndex(t *testing.T) {
// pulsarURL := Params.PulsarAddress
// loadIndexChannels := Params.LoadIndexChannelNames
// loadIndexClient := client.NewLoadIndexClient(context.Background(), pulsarURL, loadIndexChannels)
//
// loadIndexPath := "collection0-segment0-field0"
// loadIndexPaths := make([]string, 0)
// loadIndexPaths = append(loadIndexPaths, loadIndexPath)
//
// indexParams := make(map[string]string)
// indexParams["index_type"] = "IVF_PQ"
// indexParams["index_mode"] = "cpu"
//
// loadIndexClient.LoadIndex(loadIndexPaths, 0, 0, "field0", indexParams)
// loadIndexClient.Close()
//}
func
TestLoadIndexService
(
t
*
testing
.
T
)
{
node
:=
newQueryNode
()
collectionID
:=
rand
.
Int63n
(
1000000
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录