storage.conf add parameter check_store_path_mark

v6.03_dev
YuQing 2019-11-19 10:40:17 +08:00
parent 5557429899
commit 0551999135
5 changed files with 39 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Version 6.03 2019-11-17
Version 6.03 2019-11-19
* dual IPs support two different types of inner (intranet) IPs
* storage server request tracker server to change it's status
to that of tracker leader when the storage server found

View File

@ -303,6 +303,14 @@ compress_binlog = false
# since V6.01
compress_binlog_time=01:30
# if check the mark of store path to prevent confusion
# recommend to set this parameter to true
# if two storage servers (instances) MUST use a same store path for
# some specific purposes, you should set this parameter to false
# default value is true
# since V6.03
check_store_path_mark = true
# use the ip address of this storage server if domain_name is empty,
# else this domain name will ocur in the url redirected by the tracker server
http.domain_name=

View File

@ -671,13 +671,16 @@ int storage_write_to_sync_ini_file()
);
for (i=0; i<g_fdfs_store_paths.count; i++)
if (g_check_store_path_mark)
{
if (g_fdfs_store_paths.paths[i].mark != NULL)
for (i=0; i<g_fdfs_store_paths.count; i++)
{
len += sprintf(buff + len, "%s%d=%s\n",
INIT_ITEM_STORE_PATH_MARK_PREFIX, i,
g_fdfs_store_paths.paths[i].mark);
if (g_fdfs_store_paths.paths[i].mark != NULL)
{
len += sprintf(buff + len, "%s%d=%s\n",
INIT_ITEM_STORE_PATH_MARK_PREFIX, i,
g_fdfs_store_paths.paths[i].mark);
}
}
}
@ -720,6 +723,11 @@ static int storage_load_store_path_marks(IniContext *pIniContext)
char name[64];
int i;
if (!g_check_store_path_mark)
{
return 0;
}
for (i=0; i<g_fdfs_store_paths.count; i++)
{
sprintf(name, "%s%d", INIT_ITEM_STORE_PATH_MARK_PREFIX, i);
@ -816,6 +824,11 @@ static int storage_check_store_path_mark(const int store_path_index,
char *mark;
int result;
if (!g_check_store_path_mark)
{
return 0;
}
snprintf(full_filename, sizeof(full_filename), "%s/data/%s",
g_fdfs_store_paths.paths[store_path_index].path,
STORE_PATH_MARK_FILENAME);
@ -928,8 +941,11 @@ static int storage_check_store_path_mark(const int store_path_index,
" create_time: %s }, "
"if you confirm that it is NOT "
"used by other storage server, you can delete "
"the mark file %s then try again", __LINE__,
store_path_index, g_fdfs_store_paths.
"the mark file %s then try again. if you DON'T "
"really need to check store path mark to prevent "
"confusion, you can set the parameter "
"check_store_path_mark to false in storage.conf",
__LINE__, store_path_index, g_fdfs_store_paths.
paths[store_path_index].path,
mark_info.ip_addr, mark_info.port,
mark_info.store_path_index, time_str,
@ -2064,6 +2080,8 @@ int storage_func_init(const char *filename, \
break;
}
g_check_store_path_mark = iniGetBoolValue(NULL,
"check_store_path_mark", &iniContext, true);
if ((result=fdfs_connection_pool_init(filename, &iniContext)) != 0)
{
break;
@ -2134,7 +2152,8 @@ int storage_func_init(const char *filename, \
"use_connection_pool=%d, " \
"g_connection_pool_max_idle_time=%ds, " \
"compress_binlog=%d, " \
"compress_binlog_time=%02d:%02d", \
"compress_binlog_time=%02d:%02d, " \
"check_store_path_mark=%d", \
g_fdfs_version.major, g_fdfs_version.minor, \
g_fdfs_base_path, g_fdfs_store_paths.count, \
g_subdir_count_per_path, \
@ -2171,7 +2190,7 @@ int storage_func_init(const char *filename, \
g_file_sync_skip_invalid_record, \
g_use_connection_pool, g_connection_pool_max_idle_time, \
g_compress_binlog, g_compress_binlog_time.hour, \
g_compress_binlog_time.minute);
g_compress_binlog_time.minute, g_check_store_path_mark);
#ifdef WITH_HTTPD
if (!g_http_params.disabled)

View File

@ -106,6 +106,7 @@ bool g_storage_ip_changed_auto_adjust = false;
bool g_thread_kill_done = false;
bool g_file_sync_skip_invalid_record = false;
bool g_check_store_path_mark = true;
bool g_compress_binlog = false;
TimeInfo g_compress_binlog_time = {0, 0};

View File

@ -155,6 +155,7 @@ extern bool g_thread_kill_done;
extern bool g_file_sync_skip_invalid_record;
extern bool g_check_store_path_mark;
extern bool g_compress_binlog;
extern TimeInfo g_compress_binlog_time; //compress binlog time base