Unverified Commit 4825f072 authored by Jin Hai's avatar Jin Hai Committed by GitHub
Browse files

Merge pull request #1608 from youny626/fix#1598

Fix#1598
parents 17d26185 2a6e70d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+11 −6
Original line number Diff line number Diff line
@@ -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;

            {
                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);
                }
            {
                std::unique_lock<std::mutex> lock(search_job->mutex());

                XSearchTask::MergeTopkToResultSet(output_ids, output_distance, spec_k, nq, topk, ascending_reduce,
                                                  search_job->GetResultIds(), search_job->GetResultDistances());
            }