fix id miss bug

Former-commit-id: 53581de275e862ca9574014a6bd025918077dc59
This commit is contained in:
groot 2019-05-17 17:33:28 +08:00 committed by jinhai
parent 9941416b82
commit 224fae759c
2 changed files with 9 additions and 2 deletions

View File

@ -488,10 +488,14 @@ ServerError AddBatchVectorTask::OnExecute() {
std::list<std::future<void>> threads_list;
uint64_t begin_index = 0, end_index = USE_MT;
while(end_index < vec_count) {
while(true) {
threads_list.push_back(
GetThreadPool().enqueue(&AddBatchVectorTask::ProcessIdMapping,
this, vector_ids, begin_index, end_index, tensor_ids_));
if(end_index >= vec_count) {
break;
}
begin_index = end_index;
end_index += USE_MT;
if(end_index > vec_count) {

View File

@ -211,7 +211,10 @@ TEST(AddVector, CLIENT_TEST) {
server::TimeRecorder rc("Add " + std::to_string(count) + " binary vectors in one batch");
std::vector<std::string> ids;
session.interface()->add_binary_vector_batch(ids, group.id, bin_tensor_list_2);
ASSERT_TRUE(!ids.empty());
ASSERT_EQ(ids.size(), bin_tensor_list_2.tensor_list.size());
for(size_t i = 0; i < ids.size(); i++) {
ASSERT_TRUE(!ids[i].empty());
}
rc.Elapse("done!");
}
#endif