mirror of https://github.com/milvus-io/milvus.git
Fix start milvus failed on macos (#19394)
Signed-off-by: xige-16 <xi.ge@zilliz.com> Signed-off-by: xige-16 <xi.ge@zilliz.com>pull/19352/head
parent
6d6e14e67d
commit
d4bc00423c
|
@ -18,14 +18,14 @@ include_directories(${MILVUS_ENGINE_SRC})
|
|||
include_directories(${MILVUS_THIRDPARTY_SRC})
|
||||
|
||||
set(FOUND_OPENBLAS "unknown")
|
||||
add_subdirectory( pb )
|
||||
add_subdirectory( exceptions )
|
||||
add_subdirectory( utils )
|
||||
add_subdirectory( log )
|
||||
add_subdirectory( pb )
|
||||
add_subdirectory( segcore )
|
||||
add_subdirectory( query )
|
||||
add_subdirectory( common )
|
||||
add_subdirectory( indexbuilder )
|
||||
add_subdirectory( config )
|
||||
add_subdirectory( index )
|
||||
add_subdirectory( common )
|
||||
add_subdirectory( storage )
|
||||
add_subdirectory( index )
|
||||
add_subdirectory( query )
|
||||
add_subdirectory( segcore )
|
||||
add_subdirectory( indexbuilder )
|
||||
|
|
|
@ -23,6 +23,7 @@ add_library(milvus_common SHARED ${COMMON_SRC})
|
|||
if ( MSYS )
|
||||
target_link_libraries(milvus_common
|
||||
milvus_config
|
||||
milvus_utils
|
||||
milvus_log
|
||||
yaml-cpp
|
||||
boost_bitset_ext
|
||||
|
@ -32,6 +33,7 @@ if ( MSYS )
|
|||
else()
|
||||
target_link_libraries(milvus_common
|
||||
milvus_config
|
||||
milvus_utils
|
||||
milvus_log
|
||||
yaml-cpp
|
||||
boost_bitset_ext
|
||||
|
|
|
@ -28,7 +28,6 @@ set(CONFIG_SRC
|
|||
add_library(milvus_config STATIC ${CONFIG_SRC})
|
||||
|
||||
target_link_libraries(milvus_config
|
||||
milvus_exceptions
|
||||
knowhere
|
||||
milvus_proto
|
||||
milvus_utils
|
||||
)
|
||||
|
|
|
@ -20,4 +20,4 @@ set(exceptions_files
|
|||
|
||||
add_library(milvus_exceptions STATIC ${exceptions_files})
|
||||
|
||||
target_link_libraries(milvus_exceptions PRIVATE milvus_proto)
|
||||
target_link_libraries(milvus_exceptions milvus_proto)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include "index/Utils.h"
|
||||
#include "index/Meta.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include "exceptions/EasyAssert.h"
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "common/BitsetView.h"
|
||||
#include "knowhere/index/vector_index/ConfAdapterMgr.h"
|
||||
#include "knowhere/index/vector_index/adapter/VectorAdapter.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
|
||||
namespace milvus::index {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "index/IndexInfo.h"
|
||||
#include "index/Meta.h"
|
||||
#include "index/Utils.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -22,6 +23,8 @@ namespace milvus::indexbuilder {
|
|||
ScalarIndexCreator::ScalarIndexCreator(DataType dtype, const char* type_params, const char* index_params)
|
||||
: dtype_(dtype) {
|
||||
// TODO: move parse-related logic to a common interface.
|
||||
proto::indexcgo::TypeParams type_params_;
|
||||
proto::indexcgo::IndexParams index_params_;
|
||||
milvus::index::ParseFromString(type_params_, std::string(type_params));
|
||||
milvus::index::ParseFromString(index_params_, std::string(index_params));
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "indexbuilder/IndexCreatorBase.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <common/CDataType.h>
|
||||
|
@ -40,8 +39,6 @@ class ScalarIndexCreator : public IndexCreatorBase {
|
|||
|
||||
private:
|
||||
index::IndexBasePtr index_ = nullptr;
|
||||
proto::indexcgo::TypeParams type_params_;
|
||||
proto::indexcgo::IndexParams index_params_;
|
||||
Config config_;
|
||||
DataType dtype_;
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "indexbuilder/VecIndexCreator.h"
|
||||
#include "index/Utils.h"
|
||||
#include "index/IndexFactory.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
|
||||
#ifdef BUILD_DISK_ANN
|
||||
#include "storage/DiskFileManagerImpl.h"
|
||||
|
@ -26,6 +27,8 @@ VecIndexCreator::VecIndexCreator(DataType data_type,
|
|||
const char* serialized_type_params,
|
||||
const char* serialized_index_params)
|
||||
: data_type_(data_type) {
|
||||
proto::indexcgo::TypeParams type_params_;
|
||||
proto::indexcgo::IndexParams index_params_;
|
||||
milvus::index::ParseFromString(type_params_, std::string(serialized_type_params));
|
||||
milvus::index::ParseFromString(index_params_, std::string(serialized_index_params));
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "indexbuilder/IndexCreatorBase.h"
|
||||
#include "index/VectorIndex.h"
|
||||
#include "index/IndexInfo.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
|
||||
namespace milvus::indexbuilder {
|
||||
|
||||
|
@ -51,8 +50,6 @@ class VecIndexCreator : public IndexCreatorBase {
|
|||
|
||||
private:
|
||||
milvus::index::IndexBasePtr index_ = nullptr;
|
||||
proto::indexcgo::TypeParams type_params_;
|
||||
proto::indexcgo::IndexParams index_params_;
|
||||
Config config_;
|
||||
DataType data_type_;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "index/IndexFactory.h"
|
||||
#include "storage/Util.h"
|
||||
#include "segcore/load_index_c.h"
|
||||
#include "pb/index_cgo_msg.pb.h"
|
||||
|
||||
CStatus
|
||||
NewLoadIndexInfo(CLoadIndexInfo* c_load_index_info) {
|
||||
|
@ -200,20 +199,12 @@ AppendIndexFilePath(CLoadIndexInfo c_load_index_info, const char* c_file_path) {
|
|||
}
|
||||
|
||||
CStatus
|
||||
AppendIndexInfo(
|
||||
CLoadIndexInfo c_load_index_info, int64_t index_id, int64_t build_id, int64_t version, const char* c_index_params) {
|
||||
AppendIndexInfo(CLoadIndexInfo c_load_index_info, int64_t index_id, int64_t build_id, int64_t version) {
|
||||
try {
|
||||
auto load_index_info = (milvus::index::LoadIndexInfo*)c_load_index_info;
|
||||
load_index_info->index_id = index_id;
|
||||
load_index_info->index_build_id = build_id;
|
||||
load_index_info->index_version = version;
|
||||
milvus::proto::indexcgo::IndexParams index_params;
|
||||
milvus::index::ParseFromString(index_params, c_index_params);
|
||||
|
||||
for (auto i = 0; i < index_params.params().size(); i++) {
|
||||
auto& param = index_params.params(i);
|
||||
load_index_info->index_params[param.key()] = param.value();
|
||||
}
|
||||
|
||||
auto status = CStatus();
|
||||
status.error_code = Success;
|
||||
|
|
|
@ -41,8 +41,7 @@ AppendFieldInfo(CLoadIndexInfo c_load_index_info,
|
|||
enum CDataType field_type);
|
||||
|
||||
CStatus
|
||||
AppendIndexInfo(
|
||||
CLoadIndexInfo c_load_index_info, int64_t index_id, int64_t build_id, int64_t version, const char* index_params);
|
||||
AppendIndexInfo(CLoadIndexInfo c_load_index_info, int64_t index_id, int64_t build_id, int64_t version);
|
||||
|
||||
CStatus
|
||||
AppendIndex(CLoadIndexInfo c_load_index_info, CBinarySet c_binary_set);
|
||||
|
|
|
@ -15,4 +15,3 @@ aux_source_directory( ${MILVUS_ENGINE_SRC}/utils UTILS_FILES )
|
|||
|
||||
add_library( milvus_utils STATIC ${UTILS_FILES} )
|
||||
|
||||
target_link_libraries( milvus_utils PRIVATE milvus_exceptions)
|
||||
|
|
|
@ -28,11 +28,7 @@ import (
|
|||
"path/filepath"
|
||||
"unsafe"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/milvus-io/milvus/api/commonpb"
|
||||
"github.com/milvus-io/milvus/api/schemapb"
|
||||
"github.com/milvus-io/milvus/internal/proto/indexcgopb"
|
||||
"github.com/milvus-io/milvus/internal/proto/querypb"
|
||||
)
|
||||
|
||||
|
@ -65,11 +61,18 @@ func (li *LoadIndexInfo) appendLoadIndexInfo(bytesIndex [][]byte, indexInfo *que
|
|||
return err
|
||||
}
|
||||
|
||||
err = li.appendIndexInfo(indexInfo.IndexID, indexInfo.BuildID, indexInfo.IndexVersion, indexInfo.IndexParams)
|
||||
err = li.appendIndexInfo(indexInfo.IndexID, indexInfo.BuildID, indexInfo.IndexVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, param := range indexInfo.IndexParams {
|
||||
err = li.appendIndexParam(param.Key, param.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err = li.appendIndexData(bytesIndex, indexPaths)
|
||||
return err
|
||||
}
|
||||
|
@ -84,20 +87,12 @@ func (li *LoadIndexInfo) appendIndexParam(indexKey string, indexValue string) er
|
|||
return HandleCStatus(&status, "AppendIndexParam failed")
|
||||
}
|
||||
|
||||
func (li *LoadIndexInfo) appendIndexInfo(indexID int64, buildID int64, indexVersion int64, indexParams []*commonpb.KeyValuePair) error {
|
||||
protoIndexParams := &indexcgopb.IndexParams{
|
||||
Params: indexParams,
|
||||
}
|
||||
|
||||
indexParamsStr := proto.MarshalTextString(protoIndexParams)
|
||||
indexParamsPointer := C.CString(indexParamsStr)
|
||||
defer C.free(unsafe.Pointer(indexParamsPointer))
|
||||
|
||||
func (li *LoadIndexInfo) appendIndexInfo(indexID int64, buildID int64, indexVersion int64) error {
|
||||
cIndexID := C.int64_t(indexID)
|
||||
cBuildID := C.int64_t(buildID)
|
||||
cIndexVersion := C.int64_t(indexVersion)
|
||||
|
||||
status := C.AppendIndexInfo(li.cLoadIndexInfo, cIndexID, cBuildID, cIndexVersion, indexParamsPointer)
|
||||
status := C.AppendIndexInfo(li.cLoadIndexInfo, cIndexID, cBuildID, cIndexVersion)
|
||||
return HandleCStatus(&status, "AppendIndexInfo failed")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue