Merge pull request #1608 from youny626/fix#1598

Fix#1598
pull/1550/head
Jin Hai 2020-03-10 18:16:28 +08:00 committed by GitHub
commit 4825f0724a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -57,6 +57,7 @@ Please mark all change in change log and use the issue from GitHub
- \#1577 Row count incorrect if delete vectors then create index
- \#1580 Old segment folder not removed after merge/compact if create_index is called before adding data
- \#1590 Server down caused by failure to write file during concurrent mixed operations
- \#1598 Server down during mixed operations
- \#1601 External link bug in HTTP doc
## Feature

View File

@ -9,7 +9,10 @@
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.
#include "scheduler/task/SearchTask.h"
#include <fiu-local.h>
#include <algorithm>
#include <memory>
#include <string>
@ -21,7 +24,6 @@
#include "metrics/Metrics.h"
#include "scheduler/SchedInst.h"
#include "scheduler/job/SearchJob.h"
#include "scheduler/task/SearchTask.h"
#include "segment/SegmentReader.h"
#include "utils/Log.h"
#include "utils/TimeRecorder.h"
@ -264,13 +266,16 @@ XSearchTask::Execute() {
// step 3: pick up topk result
auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk;
if (search_job->GetResultIds().front() == -1 && search_job->GetResultIds().size() > spec_k) {
// initialized results set
search_job->GetResultIds().resize(spec_k);
search_job->GetResultDistances().resize(spec_k);
}
{
std::unique_lock<std::mutex> lock(search_job->mutex());
if (search_job->GetResultIds().front() == -1 && search_job->GetResultIds().size() > spec_k) {
// initialized results set
search_job->GetResultIds().resize(spec_k);
search_job->GetResultDistances().resize(spec_k);
}
XSearchTask::MergeTopkToResultSet(output_ids, output_distance, spec_k, nq, topk, ascending_reduce,
search_job->GetResultIds(), search_job->GetResultDistances());
}