diff options
Diffstat (limited to 'server/doris_server_main.cpp')
| -rw-r--r-- | server/doris_server_main.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/server/doris_server_main.cpp b/server/doris_server_main.cpp index 480e904..4e4e20e 100644 --- a/server/doris_server_main.cpp +++ b/server/doris_server_main.cpp @@ -302,24 +302,32 @@ static int32_t doris_init_config_for_business(struct doris_global_info *info, st MESA_load_profile_uint_def(config_file, business->bizname, "max_store_full_versions", &business->saves_when_fulldel, 0); if(business->saves_when_fulldel > 16) { - MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "\033[1;31;40mAlert! %s [%s]max_store_full_versions support max 16!!!!\033[0m\n", config_file, business->bizname); + MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "\033[1;31;40m[Alert] %s [%s]max_store_full_versions support max 16!!!!\033[0m\n", config_file, business->bizname); business->saves_when_fulldel = 16; } MESA_load_profile_uint_def(config_file, business->bizname, "grafana_monitor_status_id", &business->mmval_status_codeid, 3); - MESA_load_profile_uint_def(config_file, business->bizname, "mem_cache_max_versions", &business->cache_max_versions, 0); + MESA_load_profile_uint_def(config_file, business->bizname, "persistence_write_on", &business->persistence_write_on, 1); + MESA_load_profile_int_def(config_file, business->bizname, "mem_cache_max_versions", &business->cache_max_versions, 0); + if(business->persistence_write_on==0 && business->cache_max_versions==0) + { + MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "\033[1;31;40m[Alert] %s [%s], you must set mem_cache_max_versions if you disable persistence_write_on!\033[0m\n", config_file, business->bizname); + return -2; + } if(0>MESA_load_profile_string_nodef(config_file, business->bizname, "store_config_path", business->store_path_root, sizeof(business->store_path_root))) { MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "%s: [%s]store_config_path not found!", bizname, config_file); assert(0);return -1; } - snprintf(tmp_dir, 512, "%s/full/index", business->store_path_root); - snprintf(tmp_dir2,512, "%s/inc/index", business->store_path_root); - if(doris_mkdir_according_path(tmp_dir) || doris_mkdir_according_path(tmp_dir2)) + if(business->persistence_write_on) { - MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "mkdir %s failed: %s\n", tmp_dir, strerror(errno)); - return -1; + snprintf(tmp_dir, 512, "%s/full/index", business->store_path_root); + snprintf(tmp_dir2,512, "%s/inc/index", business->store_path_root); + if(doris_mkdir_according_path(tmp_dir) || doris_mkdir_according_path(tmp_dir2)) + { + MESA_RUNTIME_LOGV3(info->log_runtime, RLOG_LV_FATAL, "mkdir %s failed: %s\n", tmp_dir, strerror(errno)); + return -1; + } } - MESA_load_profile_uint_def(config_file, business->bizname, "receive_config_way", &business->recv_way, RECV_WAY_DRS_CLIENT); assert(business->recv_way==RECV_WAY_IDX_FILE || business->recv_way==RECV_WAY_DRS_CLIENT || business->recv_way==RECV_WAY_HTTP_POST); if(business->recv_way == RECV_WAY_IDX_FILE) @@ -371,6 +379,10 @@ static int32_t doris_init_config_for_business(struct doris_global_info *info, st { assert(0);return -2; } + if(!business->persistence_write_on) + { + g_doris_server_info.business_post_nopersists++; + } g_doris_server_info.business_post_num++; business->token2node = new map<string, struct version_list_node *>; } @@ -466,7 +478,12 @@ int main(int argc, char **argv) "http_post_server_status", MONITOR_METRICS_GAUGE, "Running status of doris http post server."); MESA_Monitor_operation(g_doris_server_info.monitor, g_doris_server_info.mmid_post_server, MONITOR_VALUE_SET, PROMETHUES_POST_SERVER_DOWN); } - + if(g_doris_server_info.business_post_nopersists>0 && NULL==(g_doris_server_info.kvdbhandle=doris_kvdb_hanlde_new("./leveldbdata"))) + { + MESA_RUNTIME_LOGV3(g_doris_server_info.log_runtime, RLOG_LV_FATAL, "\033[1;31;40mOpen levelDB ./leveldbdata failed.\033[0m"); + assert(0);return -11; + } + if(g_doris_server_info.ssl_conn_on && NULL==(g_doris_server_info.ssl_instance=doris_connections_create_ssl_ctx())) { assert(0);return -8; |
