mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
code clean (#2265)
* use macro STATUS_CHECK Signed-off-by: yudong.cai <yudong.cai@zilliz.com> * comment S3 related config APIs Signed-off-by: yudong.cai <yudong.cai@zilliz.com> * fix clang-format Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
This commit is contained in:
parent
4cea320943
commit
cf6be092ab
File diff suppressed because it is too large
Load Diff
@ -25,14 +25,6 @@ namespace server {
|
||||
|
||||
using ConfigCallBackF = std::function<Status(const std::string&)>;
|
||||
|
||||
#define CONFIG_CHECK(func) \
|
||||
do { \
|
||||
Status s = func; \
|
||||
if (!s.ok()) { \
|
||||
return s; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
extern const char* CONFIG_NODE_DELIMITER;
|
||||
extern const char* CONFIG_VERSION;
|
||||
|
||||
@ -71,18 +63,18 @@ extern const char* CONFIG_STORAGE_PRIMARY_PATH_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_SECONDARY_PATH;
|
||||
extern const char* CONFIG_STORAGE_SECONDARY_PATH_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_FILE_CLEANUP_TIMEOUT;
|
||||
extern const char* CONFIG_STORAGE_S3_ENABLE;
|
||||
extern const char* CONFIG_STORAGE_S3_ENABLE_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_S3_ADDRESS;
|
||||
extern const char* CONFIG_STORAGE_S3_ADDRESS_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_S3_PORT;
|
||||
extern const char* CONFIG_STORAGE_S3_PORT_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_S3_ACCESS_KEY;
|
||||
extern const char* CONFIG_STORAGE_S3_ACCESS_KEY_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_S3_SECRET_KEY;
|
||||
extern const char* CONFIG_STORAGE_S3_SECRET_KEY_DEFAULT;
|
||||
extern const char* CONFIG_STORAGE_S3_BUCKET;
|
||||
extern const char* CONFIG_STORAGE_S3_BUCKET_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_ENABLE;
|
||||
// extern const char* CONFIG_STORAGE_S3_ENABLE_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_ADDRESS;
|
||||
// extern const char* CONFIG_STORAGE_S3_ADDRESS_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_PORT;
|
||||
// extern const char* CONFIG_STORAGE_S3_PORT_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_ACCESS_KEY;
|
||||
// extern const char* CONFIG_STORAGE_S3_ACCESS_KEY_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_SECRET_KEY;
|
||||
// extern const char* CONFIG_STORAGE_S3_SECRET_KEY_DEFAULT;
|
||||
// extern const char* CONFIG_STORAGE_S3_BUCKET;
|
||||
// extern const char* CONFIG_STORAGE_S3_BUCKET_DEFAULT;
|
||||
|
||||
/* cache config */
|
||||
extern const char* CONFIG_CACHE;
|
||||
@ -118,11 +110,7 @@ extern const char* CONFIG_ENGINE_GPU_SEARCH_THRESHOLD_DEFAULT;
|
||||
/* gpu resource config */
|
||||
extern const char* CONFIG_GPU_RESOURCE;
|
||||
extern const char* CONFIG_GPU_RESOURCE_ENABLE;
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
extern const char* CONFIG_GPU_RESOURCE_ENABLE_DEFAULT;
|
||||
#else
|
||||
extern const char* CONFIG_GPU_RESOURCE_ENABLE_DEFAULT;
|
||||
#endif
|
||||
extern const char* CONFIG_GPU_RESOURCE_CACHE_CAPACITY;
|
||||
extern const char* CONFIG_GPU_RESOURCE_CACHE_CAPACITY_DEFAULT;
|
||||
extern const char* CONFIG_GPU_RESOURCE_CACHE_THRESHOLD;
|
||||
@ -258,18 +246,18 @@ class Config {
|
||||
CheckStorageConfigSecondaryPath(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigFileCleanupTimeout(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3Enable(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3Address(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3Port(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3AccessKey(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3SecretKey(const std::string& value);
|
||||
Status
|
||||
CheckStorageConfigS3Bucket(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3Enable(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3Address(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3Port(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3AccessKey(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3SecretKey(const std::string& value);
|
||||
// Status
|
||||
// CheckStorageConfigS3Bucket(const std::string& value);
|
||||
|
||||
/* metric config */
|
||||
Status
|
||||
@ -393,18 +381,18 @@ class Config {
|
||||
GetStorageConfigSecondaryPath(std::string& value);
|
||||
Status
|
||||
GetStorageConfigFileCleanupTimeup(int64_t& value);
|
||||
Status
|
||||
GetStorageConfigS3Enable(bool& value);
|
||||
Status
|
||||
GetStorageConfigS3Address(std::string& value);
|
||||
Status
|
||||
GetStorageConfigS3Port(std::string& value);
|
||||
Status
|
||||
GetStorageConfigS3AccessKey(std::string& value);
|
||||
Status
|
||||
GetStorageConfigS3SecretKey(std::string& value);
|
||||
Status
|
||||
GetStorageConfigS3Bucket(std::string& value);
|
||||
// Status
|
||||
// GetStorageConfigS3Enable(bool& value);
|
||||
// Status
|
||||
// GetStorageConfigS3Address(std::string& value);
|
||||
// Status
|
||||
// GetStorageConfigS3Port(std::string& value);
|
||||
// Status
|
||||
// GetStorageConfigS3AccessKey(std::string& value);
|
||||
// Status
|
||||
// GetStorageConfigS3SecretKey(std::string& value);
|
||||
// Status
|
||||
// GetStorageConfigS3Bucket(std::string& value);
|
||||
|
||||
/* metric config */
|
||||
Status
|
||||
@ -520,18 +508,18 @@ class Config {
|
||||
SetStorageConfigSecondaryPath(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigFileCleanupTimeout(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3Enable(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3Address(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3Port(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3AccessKey(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3SecretKey(const std::string& value);
|
||||
Status
|
||||
SetStorageConfigS3Bucket(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3Enable(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3Address(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3Port(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3AccessKey(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3SecretKey(const std::string& value);
|
||||
// Status
|
||||
// SetStorageConfigS3Bucket(const std::string& value);
|
||||
|
||||
/* metric config */
|
||||
Status
|
||||
@ -558,6 +546,22 @@ class Config {
|
||||
SetEngineConfigOmpThreadNum(const std::string& value);
|
||||
Status
|
||||
SetEngineConfigSimdType(const std::string& value);
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
Status
|
||||
SetEngineConfigGpuSearchThreshold(const std::string& value);
|
||||
|
||||
/* gpu resource config */
|
||||
Status
|
||||
SetGpuResourceConfigEnable(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigCacheCapacity(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigCacheThreshold(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigSearchResources(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigBuildIndexResources(const std::string& value);
|
||||
#endif
|
||||
|
||||
/* tracing config */
|
||||
Status
|
||||
@ -593,23 +597,6 @@ class Config {
|
||||
Status
|
||||
SetLogsDeleteExceeds(const std::string& value);
|
||||
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
Status
|
||||
SetEngineConfigGpuSearchThreshold(const std::string& value);
|
||||
|
||||
/* gpu resource config */
|
||||
Status
|
||||
SetGpuResourceConfigEnable(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigCacheCapacity(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigCacheThreshold(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigSearchResources(const std::string& value);
|
||||
Status
|
||||
SetGpuResourceConfigBuildIndexResources(const std::string& value);
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool restart_required_ = false;
|
||||
std::string config_file_;
|
||||
|
||||
@ -158,15 +158,15 @@ GetCollectionFilePath(const DBMetaOptions& options, meta::SegmentSchema& table_f
|
||||
std::string parent_path = ConstructParentFolder(options.path_, table_file);
|
||||
std::string file_path = parent_path + "/" + table_file.file_id_;
|
||||
|
||||
bool s3_enable = false;
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
config.GetStorageConfigS3Enable(s3_enable);
|
||||
fiu_do_on("GetCollectionFilePath.enable_s3", s3_enable = true);
|
||||
if (s3_enable) {
|
||||
/* need not check file existence */
|
||||
table_file.location_ = file_path;
|
||||
return Status::OK();
|
||||
}
|
||||
// bool s3_enable = false;
|
||||
// server::Config& config = server::Config::GetInstance();
|
||||
// config.GetStorageConfigS3Enable(s3_enable);
|
||||
// fiu_do_on("GetCollectionFilePath.enable_s3", s3_enable = true);
|
||||
// if (s3_enable) {
|
||||
// /* need not check file existence */
|
||||
// table_file.location_ = file_path;
|
||||
// return Status::OK();
|
||||
// }
|
||||
|
||||
if (boost::filesystem::exists(parent_path)) {
|
||||
table_file.location_ = file_path;
|
||||
|
||||
@ -465,7 +465,7 @@ ExecutionEngineImpl::Load(bool to_cache) {
|
||||
bool gpu_enable = false;
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
CONFIG_CHECK(config.GetGpuResourceConfigEnable(gpu_enable));
|
||||
STATUS_CHECK(config.GetGpuResourceConfigEnable(gpu_enable));
|
||||
#endif
|
||||
if (!gpu_enable && index_->index_mode() == knowhere::IndexMode::MODE_GPU) {
|
||||
std::string err_msg = "Index with type " + index_->index_type() + " must be used in GPU mode";
|
||||
|
||||
@ -36,7 +36,7 @@ Status
|
||||
KnowhereResource::Initialize() {
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
std::string simd_type;
|
||||
CONFIG_CHECK(config.GetEngineConfigSimdType(simd_type));
|
||||
STATUS_CHECK(config.GetEngineConfigSimdType(simd_type));
|
||||
if (simd_type == "avx512") {
|
||||
faiss::faiss_use_avx512 = true;
|
||||
faiss::faiss_use_avx2 = false;
|
||||
@ -64,7 +64,7 @@ KnowhereResource::Initialize() {
|
||||
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
bool enable_gpu = false;
|
||||
CONFIG_CHECK(config.GetGpuResourceConfigEnable(enable_gpu));
|
||||
STATUS_CHECK(config.GetGpuResourceConfigEnable(enable_gpu));
|
||||
fiu_do_on("KnowhereResource.Initialize.disable_gpu", enable_gpu = false);
|
||||
if (not enable_gpu)
|
||||
return Status::OK();
|
||||
@ -79,7 +79,7 @@ KnowhereResource::Initialize() {
|
||||
|
||||
// get build index gpu resource
|
||||
std::vector<int64_t> build_index_gpus;
|
||||
CONFIG_CHECK(config.GetGpuResourceConfigBuildIndexResources(build_index_gpus));
|
||||
STATUS_CHECK(config.GetGpuResourceConfigBuildIndexResources(build_index_gpus));
|
||||
|
||||
for (auto gpu_id : build_index_gpus) {
|
||||
gpu_resources.insert(std::make_pair(gpu_id, GpuResourceSetting()));
|
||||
@ -87,7 +87,7 @@ KnowhereResource::Initialize() {
|
||||
|
||||
// get search gpu resource
|
||||
std::vector<int64_t> search_gpus;
|
||||
CONFIG_CHECK(config.GetGpuResourceConfigSearchResources(search_gpus));
|
||||
STATUS_CHECK(config.GetGpuResourceConfigSearchResources(search_gpus));
|
||||
|
||||
for (auto& gpu_id : search_gpus) {
|
||||
gpu_resources.insert(std::make_pair(gpu_id, GpuResourceSetting()));
|
||||
|
||||
@ -26,16 +26,16 @@ Status
|
||||
PrometheusMetrics::Init() {
|
||||
try {
|
||||
Config& config = Config::GetInstance();
|
||||
CONFIG_CHECK(config.GetMetricConfigEnableMonitor(startup_));
|
||||
STATUS_CHECK(config.GetMetricConfigEnableMonitor(startup_));
|
||||
if (!startup_) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
// Following should be read from config file.
|
||||
std::string server_port, push_port, push_address;
|
||||
CONFIG_CHECK(config.GetServerConfigPort(server_port));
|
||||
CONFIG_CHECK(config.GetMetricConfigPort(push_port));
|
||||
CONFIG_CHECK(config.GetMetricConfigAddress(push_address));
|
||||
STATUS_CHECK(config.GetServerConfigPort(server_port));
|
||||
STATUS_CHECK(config.GetMetricConfigPort(push_port));
|
||||
STATUS_CHECK(config.GetMetricConfigAddress(push_address));
|
||||
|
||||
const std::string uri = std::string("/metrics");
|
||||
// const std::size_t num_threads = 2;
|
||||
|
||||
@ -160,7 +160,7 @@ Server::Start() {
|
||||
Config& config = Config::GetInstance();
|
||||
|
||||
std::string meta_uri;
|
||||
CONFIG_CHECK(config.GetDBConfigBackendUrl(meta_uri));
|
||||
STATUS_CHECK(config.GetDBConfigBackendUrl(meta_uri));
|
||||
if (meta_uri.length() > 6 && strcasecmp("sqlite", meta_uri.substr(0, 6).c_str()) == 0) {
|
||||
std::cout << "WARNNING: You are using SQLite as the meta data management, "
|
||||
"which can't be used in production. Please change it to MySQL!"
|
||||
@ -209,31 +209,25 @@ Server::Start() {
|
||||
std::string logs_path;
|
||||
int64_t max_log_file_size = 0;
|
||||
int64_t delete_exceeds = 0;
|
||||
CONFIG_CHECK(config.GetLogsTraceEnable(trace_enable));
|
||||
CONFIG_CHECK(config.GetLogsDebugEnable(debug_enable));
|
||||
CONFIG_CHECK(config.GetLogsInfoEnable(info_enable));
|
||||
CONFIG_CHECK(config.GetLogsWarningEnable(warning_enable));
|
||||
CONFIG_CHECK(config.GetLogsErrorEnable(error_enable));
|
||||
CONFIG_CHECK(config.GetLogsFatalEnable(fatal_enable));
|
||||
CONFIG_CHECK(config.GetLogsPath(logs_path));
|
||||
CONFIG_CHECK(config.GetLogsMaxLogFileSize(max_log_file_size));
|
||||
CONFIG_CHECK(config.GetLogsDeleteExceeds(delete_exceeds));
|
||||
STATUS_CHECK(config.GetLogsTraceEnable(trace_enable));
|
||||
STATUS_CHECK(config.GetLogsDebugEnable(debug_enable));
|
||||
STATUS_CHECK(config.GetLogsInfoEnable(info_enable));
|
||||
STATUS_CHECK(config.GetLogsWarningEnable(warning_enable));
|
||||
STATUS_CHECK(config.GetLogsErrorEnable(error_enable));
|
||||
STATUS_CHECK(config.GetLogsFatalEnable(fatal_enable));
|
||||
STATUS_CHECK(config.GetLogsPath(logs_path));
|
||||
STATUS_CHECK(config.GetLogsMaxLogFileSize(max_log_file_size));
|
||||
STATUS_CHECK(config.GetLogsDeleteExceeds(delete_exceeds));
|
||||
InitLog(trace_enable, debug_enable, info_enable, warning_enable, error_enable, fatal_enable, logs_path,
|
||||
max_log_file_size, delete_exceeds);
|
||||
}
|
||||
|
||||
std::string deploy_mode;
|
||||
s = config.GetServerConfigDeployMode(deploy_mode);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
STATUS_CHECK(config.GetServerConfigDeployMode(deploy_mode));
|
||||
|
||||
if (deploy_mode == "single" || deploy_mode == "cluster_writable") {
|
||||
std::string db_path;
|
||||
s = config.GetStorageConfigPrimaryPath(db_path);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
STATUS_CHECK(config.GetStorageConfigPrimaryPath(db_path));
|
||||
|
||||
try {
|
||||
// True if a new directory was created, otherwise false.
|
||||
@ -249,17 +243,11 @@ Server::Start() {
|
||||
}
|
||||
|
||||
bool wal_enable = false;
|
||||
s = config.GetWalConfigEnable(wal_enable);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
STATUS_CHECK(config.GetWalConfigEnable(wal_enable));
|
||||
|
||||
if (wal_enable) {
|
||||
std::string wal_path;
|
||||
s = config.GetWalConfigWalPath(wal_path);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
STATUS_CHECK(config.GetWalConfigWalPath(wal_path));
|
||||
|
||||
try {
|
||||
// True if a new directory was created, otherwise false.
|
||||
@ -282,21 +270,10 @@ Server::Start() {
|
||||
#else
|
||||
LOG_SERVER_INFO_ << "CPU edition";
|
||||
#endif
|
||||
s = StorageChecker::CheckStoragePermission();
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
|
||||
s = CpuChecker::CheckCpuInstructionSet();
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
|
||||
STATUS_CHECK(StorageChecker::CheckStoragePermission());
|
||||
STATUS_CHECK(CpuChecker::CheckCpuInstructionSet());
|
||||
#ifdef MILVUS_GPU_VERSION
|
||||
s = GpuChecker::CheckGpuEnvironment();
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
}
|
||||
STATUS_CHECK(GpuChecker::CheckGpuEnvironment());
|
||||
#endif
|
||||
/* record config and hardware information into log */
|
||||
LogConfigInFile(config_filename_);
|
||||
|
||||
@ -77,8 +77,8 @@ GrpcServer::StartService() {
|
||||
Config& config = Config::GetInstance();
|
||||
std::string address, port;
|
||||
|
||||
CONFIG_CHECK(config.GetServerConfigAddress(address));
|
||||
CONFIG_CHECK(config.GetServerConfigPort(port));
|
||||
STATUS_CHECK(config.GetServerConfigAddress(address));
|
||||
STATUS_CHECK(config.GetServerConfigPort(port));
|
||||
|
||||
std::string server_address(address + ":" + port);
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ WebServer::StartService() {
|
||||
|
||||
Config& config = Config::GetInstance();
|
||||
std::string port;
|
||||
CONFIG_CHECK(config.GetServerConfigWebPort(port));
|
||||
STATUS_CHECK(config.GetServerConfigWebPort(port));
|
||||
|
||||
{
|
||||
AppComponent components = AppComponent(std::stoi(port));
|
||||
|
||||
@ -17,6 +17,15 @@
|
||||
|
||||
namespace milvus {
|
||||
|
||||
class Status;
|
||||
#define STATUS_CHECK(func) \
|
||||
do { \
|
||||
Status s = func; \
|
||||
if (!s.ok()) { \
|
||||
return s; \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
using StatusCode = ErrorCode;
|
||||
|
||||
class Status {
|
||||
|
||||
@ -209,35 +209,35 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
|
||||
ASSERT_TRUE(config.GetStorageConfigSecondaryPath(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_secondary_path);
|
||||
|
||||
bool storage_s3_enable = true;
|
||||
ASSERT_TRUE(config.SetStorageConfigS3Enable(std::to_string(storage_s3_enable)).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3Enable(bool_val).ok());
|
||||
ASSERT_TRUE(bool_val == storage_s3_enable);
|
||||
|
||||
std::string storage_s3_addr = "192.168.1.100";
|
||||
ASSERT_TRUE(config.SetStorageConfigS3Address(storage_s3_addr).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3Address(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_s3_addr);
|
||||
|
||||
std::string storage_s3_port = "12345";
|
||||
ASSERT_TRUE(config.SetStorageConfigS3Port(storage_s3_port).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3Port(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_s3_port);
|
||||
|
||||
std::string storage_s3_access_key = "minioadmin";
|
||||
ASSERT_TRUE(config.SetStorageConfigS3AccessKey(storage_s3_access_key).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3AccessKey(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_s3_access_key);
|
||||
|
||||
std::string storage_s3_secret_key = "minioadmin";
|
||||
ASSERT_TRUE(config.SetStorageConfigS3SecretKey(storage_s3_secret_key).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3SecretKey(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_s3_secret_key);
|
||||
|
||||
std::string storage_s3_bucket = "s3bucket";
|
||||
ASSERT_TRUE(config.SetStorageConfigS3Bucket(storage_s3_bucket).ok());
|
||||
ASSERT_TRUE(config.GetStorageConfigS3Bucket(str_val).ok());
|
||||
ASSERT_TRUE(str_val == storage_s3_bucket);
|
||||
// bool storage_s3_enable = true;
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3Enable(std::to_string(storage_s3_enable)).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3Enable(bool_val).ok());
|
||||
// ASSERT_TRUE(bool_val == storage_s3_enable);
|
||||
//
|
||||
// std::string storage_s3_addr = "192.168.1.100";
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3Address(storage_s3_addr).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3Address(str_val).ok());
|
||||
// ASSERT_TRUE(str_val == storage_s3_addr);
|
||||
//
|
||||
// std::string storage_s3_port = "12345";
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3Port(storage_s3_port).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3Port(str_val).ok());
|
||||
// ASSERT_TRUE(str_val == storage_s3_port);
|
||||
//
|
||||
// std::string storage_s3_access_key = "minioadmin";
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3AccessKey(storage_s3_access_key).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3AccessKey(str_val).ok());
|
||||
// ASSERT_TRUE(str_val == storage_s3_access_key);
|
||||
//
|
||||
// std::string storage_s3_secret_key = "minioadmin";
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3SecretKey(storage_s3_secret_key).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3SecretKey(str_val).ok());
|
||||
// ASSERT_TRUE(str_val == storage_s3_secret_key);
|
||||
//
|
||||
// std::string storage_s3_bucket = "s3bucket";
|
||||
// ASSERT_TRUE(config.SetStorageConfigS3Bucket(storage_s3_bucket).ok());
|
||||
// ASSERT_TRUE(config.GetStorageConfigS3Bucket(str_val).ok());
|
||||
// ASSERT_TRUE(str_val == storage_s3_bucket);
|
||||
|
||||
/* metric config */
|
||||
bool metric_enable_monitor = false;
|
||||
@ -417,9 +417,9 @@ TEST_F(ConfigTest, SERVER_CONFIG_CLI_TEST) {
|
||||
ASSERT_TRUE(s.ok());
|
||||
|
||||
/* storage config */
|
||||
std::string storage_s3_enable = "true";
|
||||
get_cmd = gen_get_command(ms::CONFIG_STORAGE, ms::CONFIG_STORAGE_S3_ENABLE);
|
||||
set_cmd = gen_set_command(ms::CONFIG_STORAGE, ms::CONFIG_STORAGE_S3_ENABLE, storage_s3_enable);
|
||||
std::string storage_primary_path = "/tmp/milvus1";
|
||||
get_cmd = gen_get_command(ms::CONFIG_STORAGE, ms::CONFIG_STORAGE_PRIMARY_PATH);
|
||||
set_cmd = gen_set_command(ms::CONFIG_STORAGE, ms::CONFIG_STORAGE_PRIMARY_PATH, storage_primary_path);
|
||||
s = config.ProcessConfigCli(dummy, set_cmd);
|
||||
ASSERT_TRUE(s.ok());
|
||||
s = config.ProcessConfigCli(result, get_cmd);
|
||||
@ -599,18 +599,18 @@ TEST_F(ConfigTest, SERVER_CONFIG_INVALID_TEST) {
|
||||
ASSERT_FALSE(config.SetStorageConfigSecondaryPath("../milvus,./zilliz").ok());
|
||||
ASSERT_FALSE(config.SetStorageConfigSecondaryPath("/home/^^__^^,/zilliz").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3Enable("10").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3Address("127.0.0").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3Port("100").ok());
|
||||
ASSERT_FALSE(config.SetStorageConfigS3Port("100000").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3AccessKey("").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3SecretKey("").ok());
|
||||
|
||||
ASSERT_FALSE(config.SetStorageConfigS3Bucket("").ok());
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3Enable("10").ok());
|
||||
//
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3Address("127.0.0").ok());
|
||||
//
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3Port("100").ok());
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3Port("100000").ok());
|
||||
//
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3AccessKey("").ok());
|
||||
//
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3SecretKey("").ok());
|
||||
//
|
||||
// ASSERT_FALSE(config.SetStorageConfigS3Bucket("").ok());
|
||||
|
||||
/* metric config */
|
||||
ASSERT_FALSE(config.SetMetricConfigEnableMonitor("Y").ok());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user