get storage id from stoage_ids.conf when id not exist in data file

multi_ipaddr
YuQing 2019-10-15 19:04:04 +08:00
parent 6aa9e83bc3
commit 0ead100d59
1 changed files with 15 additions and 7 deletions

View File

@ -3590,15 +3590,23 @@ static int tracker_mem_add_storage_from_file(FDFSGroups *pGroups,
if (g_use_storage_id) if (g_use_storage_id)
{ {
if (storage_id == NULL || *storage_id == '\0') if (storage_id == NULL || *storage_id == '\0')
{
FDFSStorageIdInfo *idInfo;
idInfo = fdfs_get_storage_id_by_ip(group_name, ip_addr);
if (idInfo == NULL)
{ {
logError("file: "__FILE__", line: %d, " logError("file: "__FILE__", line: %d, "
"in the file \"%s/%s\", " "in the file \"%s/%s\", "
"group: %s, item \"%s\" is not found or empty", "group: %s, item \"%s\" is not found or empty, "
"and storage ip %s not configed in storage_ids.conf",
__LINE__, data_path, __LINE__, data_path,
STORAGE_SERVERS_LIST_FILENAME_NEW, STORAGE_SERVERS_LIST_FILENAME_NEW,
group_name, STORAGE_ITEM_SERVER_ID); group_name, STORAGE_ITEM_SERVER_ID, ip_addr);
return ENOENT; return ENOENT;
} }
storage_id = idInfo->id;
}
} }
if (ip_addr == NULL) if (ip_addr == NULL)