Commit e65468a4 authored by jinhai's avatar jinhai
Browse files

Merge branch 'branch-0.5.0-yk' into 'branch-0.5.0'

MS-639 SQ8H index created failed and server hang

See merge request megasearch/milvus!704

Former-commit-id: 5a8468240aa1b1db82a113184b8adbd04c874e7c
parents 074bdbc5 60b1edcb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ Please mark all change in change log and use the ticket from JIRA.
- MS-637 - out of memory when load too many tasks
- MS-640 - Cache object size calculate incorrect
- MS-641 - Segment fault(signal 11) in PickToLoad
- MS-639 - SQ8H index created failed and server hang

## Improvement
- MS-552 - Add and change the easylogging library
+22 −0
Original line number Diff line number Diff line
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License 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/BuildMgr.h"

namespace milvus {
namespace scheduler {}  // namespace scheduler
}  // namespace milvus
+63 −0
Original line number Diff line number Diff line
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License 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.

#pragma once

#include <atomic>
#include <condition_variable>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <queue>
#include <string>
#include <thread>
#include <unordered_map>
#include <vector>

namespace milvus {
namespace scheduler {

class BuildMgr {
 public:
    explicit BuildMgr(int64_t numoftasks) : numoftasks_(numoftasks) {
    }

 public:
    void
    Put() {
        ++numoftasks_;
    }

    void
    take() {
        --numoftasks_;
    }

    int64_t
    numoftasks() {
        return (int64_t)numoftasks_;
    }

 private:
    std::atomic_long numoftasks_;
};

using BuildMgrPtr = std::shared_ptr<BuildMgr>;

}  // namespace scheduler
}  // namespace milvus
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@ std::mutex JobMgrInst::mutex_;
OptimizerPtr OptimizerInst::instance = nullptr;
std::mutex OptimizerInst::mutex_;

BuildMgrPtr BuildMgrInst::instance = nullptr;
std::mutex BuildMgrInst::mutex_;

void
load_simple_config() {
    server::Config& config = server::Config::GetInstance();
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#pragma once

#include "BuildMgr.h"
#include "JobMgr.h"
#include "ResourceMgr.h"
#include "Scheduler.h"
@@ -106,6 +107,24 @@ class OptimizerInst {
    static std::mutex mutex_;
};

class BuildMgrInst {
 public:
    static BuildMgrPtr
    GetInstance() {
        if (instance == nullptr) {
            std::lock_guard<std::mutex> lock(mutex_);
            if (instance == nullptr) {
                instance = std::make_shared<BuildMgr>(4);
            }
        }
        return instance;
    }

 private:
    static BuildMgrPtr instance;
    static std::mutex mutex_;
};

void
StartSchedulerService();

Loading