mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
test(db): change test case
Former-commit-id: 4d371cf9f3cb591eafff64373aaaabaabd90118c
This commit is contained in:
parent
32b64ab724
commit
f7cd398c3b
@ -59,6 +59,7 @@ TEST_F(DBTest, DB_TEST) {
|
||||
|
||||
engine::Options opt;
|
||||
opt.memory_sync_interval = 1;
|
||||
opt.index_trigger_size = 1024*group_dim;
|
||||
opt.meta.backend_uri = "http://127.0.0.1";
|
||||
opt.meta.path = "/tmp/vecwise_test/db_test";
|
||||
|
||||
@ -81,7 +82,7 @@ TEST_F(DBTest, DB_TEST) {
|
||||
engine::IDNumbers target_ids;
|
||||
|
||||
int d = 256;
|
||||
int nb = 5;
|
||||
int nb = 100;
|
||||
float *xb = new float[d * nb];
|
||||
for(int i = 0; i < nb; i++) {
|
||||
for(int j = 0; j < d; j++) xb[d * i + j] = drand48();
|
||||
@ -95,7 +96,33 @@ TEST_F(DBTest, DB_TEST) {
|
||||
qxb[d * i] += i / 2000.;
|
||||
}
|
||||
|
||||
int loop = 2000000;
|
||||
std::thread search([&]() {
|
||||
engine::QueryResults results;
|
||||
int k = 10;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
/* std::this_thread::sleep_for(std::chrono::milliseconds(30)); */
|
||||
|
||||
INIT_TIMER;
|
||||
std::stringstream ss;
|
||||
long count = 0;
|
||||
|
||||
for (auto j=0; j<5; ++j) {
|
||||
ss.str("");
|
||||
db->count(group_name, count);
|
||||
|
||||
ss << "Search " << j << " With Size " << count;
|
||||
|
||||
START_TIMER;
|
||||
stat = db->search(group_name, k, qb, qxb, results);
|
||||
STOP_TIMER(ss.str());
|
||||
|
||||
ASSERT_STATS(stat);
|
||||
ASSERT_EQ(results[0][0], target_ids[0]);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
});
|
||||
|
||||
int loop = 40000;
|
||||
|
||||
for (auto i=0; i<loop; ++i) {
|
||||
if (i==40) {
|
||||
@ -103,30 +130,10 @@ TEST_F(DBTest, DB_TEST) {
|
||||
} else {
|
||||
db->add_vectors(group_name, nb, xb, vector_ids);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||
}
|
||||
|
||||
engine::QueryResults results;
|
||||
int k = 10;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
INIT_TIMER;
|
||||
|
||||
std::stringstream ss;
|
||||
long count = 0;
|
||||
|
||||
for (auto j=0; j<15; ++j) {
|
||||
ss.str("");
|
||||
db->count(group_name, count);
|
||||
|
||||
ss << "Search " << j << " With Size " << count;
|
||||
|
||||
START_TIMER;
|
||||
stat = db->search(group_name, k, qb, qxb, results);
|
||||
STOP_TIMER(ss.str());
|
||||
|
||||
ASSERT_STATS(stat);
|
||||
ASSERT_EQ(results[0][0], target_ids[0]);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
search.join();
|
||||
|
||||
delete [] xb;
|
||||
delete [] qxb;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user