Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
cdc47c36
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
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,发现更多精彩内容 >>
提交
cdc47c36
编写于
7月 01, 2019
作者:
Z
zhiru
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test
Former-commit-id: 338d1eb653c2b0726afe3ac19b2d62aefb5b0169
上级
fb7505cb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
22 deletion
+25
-22
cpp/unittest/db/mysql_db_test.cpp
cpp/unittest/db/mysql_db_test.cpp
+25
-22
未找到文件。
cpp/unittest/db/mysql_db_test.cpp
浏览文件 @
cdc47c36
...
@@ -18,28 +18,28 @@ using namespace zilliz::milvus;
...
@@ -18,28 +18,28 @@ using namespace zilliz::milvus;
namespace
{
namespace
{
static
const
std
::
string
TABLE_NAME
=
"test_group"
;
static
const
std
::
string
TABLE_NAME
=
"test_group"
;
static
constexpr
int64_t
TABLE_DIM
=
256
;
static
constexpr
int64_t
TABLE_DIM
=
256
;
static
constexpr
int64_t
VECTOR_COUNT
=
250000
;
static
constexpr
int64_t
VECTOR_COUNT
=
250000
;
static
constexpr
int64_t
INSERT_LOOP
=
100000
;
static
constexpr
int64_t
INSERT_LOOP
=
100000
;
engine
::
meta
::
TableSchema
BuildTableSchema
()
{
engine
::
meta
::
TableSchema
BuildTableSchema
()
{
engine
::
meta
::
TableSchema
table_info
;
engine
::
meta
::
TableSchema
table_info
;
table_info
.
dimension_
=
TABLE_DIM
;
table_info
.
dimension_
=
TABLE_DIM
;
table_info
.
table_id_
=
TABLE_NAME
;
table_info
.
table_id_
=
TABLE_NAME
;
table_info
.
engine_type_
=
(
int
)
engine
::
EngineType
::
FAISS_IDMAP
;
table_info
.
engine_type_
=
(
int
)
engine
::
EngineType
::
FAISS_IDMAP
;
return
table_info
;
return
table_info
;
}
}
void
BuildVectors
(
int64_t
n
,
std
::
vector
<
float
>&
vectors
)
{
void
BuildVectors
(
int64_t
n
,
std
::
vector
<
float
>&
vectors
)
{
vectors
.
clear
();
vectors
.
clear
();
vectors
.
resize
(
n
*
TABLE_DIM
);
vectors
.
resize
(
n
*
TABLE_DIM
);
float
*
data
=
vectors
.
data
();
float
*
data
=
vectors
.
data
();
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
j
=
0
;
j
<
TABLE_DIM
;
j
++
)
data
[
TABLE_DIM
*
i
+
j
]
=
drand48
();
for
(
int
j
=
0
;
j
<
TABLE_DIM
;
j
++
)
data
[
TABLE_DIM
*
i
+
j
]
=
drand48
();
data
[
TABLE_DIM
*
i
]
+=
i
/
2000.
;
data
[
TABLE_DIM
*
i
]
+=
i
/
2000.
;
}
}
}
}
}
}
...
@@ -72,7 +72,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
...
@@ -72,7 +72,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
std
::
thread
search
([
&
]()
{
std
::
thread
search
([
&
]()
{
engine
::
QueryResults
results
;
engine
::
QueryResults
results
;
int
k
=
10
;
int
k
=
10
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
2
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
3
));
INIT_TIMER
;
INIT_TIMER
;
std
::
stringstream
ss
;
std
::
stringstream
ss
;
...
@@ -91,6 +91,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
...
@@ -91,6 +91,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
ASSERT_STATS
(
stat
);
ASSERT_STATS
(
stat
);
for
(
auto
k
=
0
;
k
<
qb
;
++
k
)
{
for
(
auto
k
=
0
;
k
<
qb
;
++
k
)
{
// std::cout << results[k][0].first << " " << target_ids[k] << std::endl;
ASSERT_EQ
(
results
[
k
][
0
].
first
,
target_ids
[
k
]);
ASSERT_EQ
(
results
[
k
][
0
].
first
,
target_ids
[
k
]);
ss
.
str
(
""
);
ss
.
str
(
""
);
ss
<<
"Result ["
<<
k
<<
"]:"
;
ss
<<
"Result ["
<<
k
<<
"]:"
;
...
@@ -100,7 +101,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
...
@@ -100,7 +101,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
/* LOG(DEBUG) << ss.str(); */
/* LOG(DEBUG) << ss.str(); */
}
}
ASSERT_TRUE
(
count
>=
prev_count
);
ASSERT_TRUE
(
count
>=
prev_count
);
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
3
));
}
}
});
});
...
@@ -118,6 +119,8 @@ TEST_F(MySQLDBTest, DB_TEST) {
...
@@ -118,6 +119,8 @@ TEST_F(MySQLDBTest, DB_TEST) {
search
.
join
();
search
.
join
();
// db_->DropAll();
delete
db_
;
delete
db_
;
auto
dummyDB
=
engine
::
DBFactory
::
Build
(
options
);
auto
dummyDB
=
engine
::
DBFactory
::
Build
(
options
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录