my_status change to my_result
parent
afc4fa2346
commit
6ea2f5e1ca
|
|
@ -1097,7 +1097,7 @@ static int storage_check_tracker_ipaddr(const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_my_status_per_tracker()
|
static int init_my_result_per_tracker()
|
||||||
{
|
{
|
||||||
int bytes;
|
int bytes;
|
||||||
TrackerServerInfo *pTrackerServer;
|
TrackerServerInfo *pTrackerServer;
|
||||||
|
|
@ -1121,8 +1121,8 @@ static int init_my_status_per_tracker()
|
||||||
for (pTrackerServer=g_tracker_group.servers; pTrackerServer<pServerEnd;
|
for (pTrackerServer=g_tracker_group.servers; pTrackerServer<pServerEnd;
|
||||||
pTrackerServer++)
|
pTrackerServer++)
|
||||||
{
|
{
|
||||||
pReportStatus->my_status = -1;
|
pReportStatus->my_result = -1;
|
||||||
pReportStatus->src_storage_status = -1;
|
pReportStatus->src_storage_result = -1;
|
||||||
pReportStatus++;
|
pReportStatus++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1947,7 +1947,7 @@ int storage_func_init(const char *filename, \
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result=init_my_status_per_tracker()) != 0)
|
if ((result=init_my_result_per_tracker()) != 0)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
signed char my_status;
|
signed char my_result;
|
||||||
signed char src_storage_status;
|
signed char src_storage_result;
|
||||||
bool get_my_ip_done;
|
bool get_my_ip_done;
|
||||||
} StorageStatusPerTracker;
|
} StorageStatusPerTracker;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -390,14 +390,14 @@ static void *tracker_report_thread_entrance(void *arg)
|
||||||
sync_old_done = true;
|
sync_old_done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_my_report_status[tracker_index].src_storage_status =
|
g_my_report_status[tracker_index].src_storage_result =
|
||||||
tracker_sync_notify(conn, tracker_index);
|
tracker_sync_notify(conn, tracker_index);
|
||||||
if (g_my_report_status[tracker_index].src_storage_status != 0)
|
if (g_my_report_status[tracker_index].src_storage_result != 0)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
for (k=0; k<g_tracker_group.server_count; k++)
|
for (k=0; k<g_tracker_group.server_count; k++)
|
||||||
{
|
{
|
||||||
if (g_my_report_status[k].src_storage_status != ENOENT)
|
if (g_my_report_status[k].src_storage_result != ENOENT)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -406,22 +406,20 @@ static void *tracker_report_thread_entrance(void *arg)
|
||||||
if (k == g_tracker_group.server_count)
|
if (k == g_tracker_group.server_count)
|
||||||
{ //src storage server already be deleted
|
{ //src storage server already be deleted
|
||||||
int my_status;
|
int my_status;
|
||||||
if (tracker_get_storage_max_status( \
|
if (tracker_get_storage_max_status(
|
||||||
&g_tracker_group, g_group_name, \
|
&g_tracker_group, g_group_name,
|
||||||
tracker_client_ip, my_server_id, \
|
tracker_client_ip, my_server_id,
|
||||||
&my_status) == 0)
|
&my_status) == 0)
|
||||||
{
|
{
|
||||||
tracker_sync_dest_query(conn);
|
tracker_sync_dest_query(conn);
|
||||||
if(my_status<FDFS_STORAGE_STATUS_OFFLINE
|
if (my_status < FDFS_STORAGE_STATUS_OFFLINE
|
||||||
&& g_sync_old_done)
|
&& g_sync_old_done)
|
||||||
{ //need re-sync old files
|
{ //need re-sync old files
|
||||||
pthread_mutex_lock( \
|
pthread_mutex_lock(&reporter_thread_lock);
|
||||||
&reporter_thread_lock);
|
|
||||||
g_sync_old_done = false;
|
g_sync_old_done = false;
|
||||||
sync_old_done = g_sync_old_done;
|
sync_old_done = g_sync_old_done;
|
||||||
storage_write_to_sync_ini_file();
|
storage_write_to_sync_ini_file();
|
||||||
pthread_mutex_unlock( \
|
pthread_mutex_unlock(&reporter_thread_lock);
|
||||||
&reporter_thread_lock);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -717,7 +715,7 @@ static int tracker_start_sync_threads(const FDFSStorageBrief *pStorage)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tracker_merge_servers(ConnectionInfo *pTrackerServer, \
|
static int tracker_merge_servers(ConnectionInfo *pTrackerServer,
|
||||||
FDFSStorageBrief *briefServers, const int server_count)
|
FDFSStorageBrief *briefServers, const int server_count)
|
||||||
{
|
{
|
||||||
FDFSStorageBrief *pServer;
|
FDFSStorageBrief *pServer;
|
||||||
|
|
@ -744,8 +742,13 @@ static int tracker_merge_servers(ConnectionInfo *pTrackerServer, \
|
||||||
{
|
{
|
||||||
memcpy(&(targetServer.server),pServer,sizeof(FDFSStorageBrief));
|
memcpy(&(targetServer.server),pServer,sizeof(FDFSStorageBrief));
|
||||||
|
|
||||||
ppFound = (FDFSStorageServer **)bsearch(&pTargetServer, \
|
|
||||||
g_sorted_storages, g_storage_count, \
|
if (is_local_host_ip(pServer->ip_addr))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ppFound = (FDFSStorageServer **)bsearch(&pTargetServer,
|
||||||
|
g_sorted_storages, g_storage_count,
|
||||||
sizeof(FDFSStorageServer *), storage_cmp_by_server_id);
|
sizeof(FDFSStorageServer *), storage_cmp_by_server_id);
|
||||||
if (ppFound != NULL)
|
if (ppFound != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1936,14 +1939,14 @@ int tracker_report_join(ConnectionInfo *pTrackerServer, \
|
||||||
{
|
{
|
||||||
for (i=0; i<g_tracker_group.server_count; i++)
|
for (i=0; i<g_tracker_group.server_count; i++)
|
||||||
{
|
{
|
||||||
if (g_my_report_status[i].my_status == -1)
|
if (g_my_report_status[i].my_result == -1)
|
||||||
{
|
{
|
||||||
logInfo("file: "__FILE__", line: %d, "
|
logInfo("file: "__FILE__", line: %d, "
|
||||||
"tracker server: #%d. %s:%d, g_my_report_status: %d",
|
"tracker server: #%d. %s:%d, g_my_report_status: %d",
|
||||||
__LINE__, i,
|
__LINE__, i,
|
||||||
g_tracker_group.servers[i].connections[0].ip_addr,
|
g_tracker_group.servers[i].connections[0].ip_addr,
|
||||||
g_tracker_group.servers[i].connections[0].port,
|
g_tracker_group.servers[i].connections[0].port,
|
||||||
g_my_report_status[i].my_status);
|
g_my_report_status[i].my_result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1991,7 +1994,7 @@ int tracker_report_join(ConnectionInfo *pTrackerServer, \
|
||||||
pInBuff = (char *)&respBody;
|
pInBuff = (char *)&respBody;
|
||||||
result = fdfs_recv_response(pTrackerServer, \
|
result = fdfs_recv_response(pTrackerServer, \
|
||||||
&pInBuff, sizeof(respBody), &in_bytes);
|
&pInBuff, sizeof(respBody), &in_bytes);
|
||||||
g_my_report_status[tracker_index].my_status = result;
|
g_my_report_status[tracker_index].my_result = result;
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, "
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
|
@ -2009,7 +2012,7 @@ int tracker_report_join(ConnectionInfo *pTrackerServer, \
|
||||||
__LINE__, pTrackerServer->ip_addr, \
|
__LINE__, pTrackerServer->ip_addr, \
|
||||||
pTrackerServer->port, \
|
pTrackerServer->port, \
|
||||||
(int)sizeof(respBody), in_bytes);
|
(int)sizeof(respBody), in_bytes);
|
||||||
g_my_report_status[tracker_index].my_status = EINVAL;
|
g_my_report_status[tracker_index].my_result = EINVAL;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue