tracker server adjust storage status to newer by anyway
parent
b638f2ce88
commit
86eef2069d
6
HISTORY
6
HISTORY
|
|
@ -1,7 +1,11 @@
|
|||
|
||||
Version 5.04 2014-08-19
|
||||
Version 5.04 2014-08-24
|
||||
* add fastdfs.spec for build RPM on Linux
|
||||
* depend on libfastcommon
|
||||
* in multi tracker servers case, when receive higher status like
|
||||
online / active and the storage status is wait_sync or syncing,
|
||||
the tracker adjust storage status to newer, and the storage rejoin
|
||||
to the tracker server
|
||||
|
||||
Version 5.03 2014-08-10
|
||||
* network send and recv retry when error EINTR happen
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ static pthread_mutex_t reporter_thread_lock;
|
|||
static pthread_t *report_tids = NULL;
|
||||
static int *src_storage_status = NULL; //returned by tracker server
|
||||
static signed char *my_report_status = NULL; //returned by tracker server
|
||||
static bool need_rejoin_tracker = false;
|
||||
|
||||
static int tracker_heart_beat(ConnectionInfo *pTrackerServer, \
|
||||
int *pstat_chg_sync_count, bool *bServerPortChanged);
|
||||
|
|
@ -540,6 +541,11 @@ static void *tracker_report_thread_entrance(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
if (need_rejoin_tracker)
|
||||
{
|
||||
need_rejoin_tracker = false;
|
||||
break;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
|
@ -844,6 +850,21 @@ static int tracker_merge_servers(ConnectionInfo *pTrackerServer, \
|
|||
FDFS_STORAGE_STATUS_SYNCING)) && \
|
||||
((*ppFound)->server.status > pServer->status))
|
||||
{
|
||||
*(pServer->ip_addr + IP_ADDRESS_SIZE - 1) = '\0';
|
||||
if (is_local_host_ip(pServer->ip_addr) && \
|
||||
buff2int(pServer->port) == g_server_port)
|
||||
{
|
||||
need_rejoin_tracker = true;
|
||||
logWarning("file: "__FILE__", line: %d, " \
|
||||
"tracker response status: %d, " \
|
||||
"local status: %d, need rejoin " \
|
||||
"tracker server: %s:%d", \
|
||||
__LINE__, pServer->status, \
|
||||
(*ppFound)->server.status, \
|
||||
pTrackerServer->ip_addr,
|
||||
pTrackerServer->port);
|
||||
}
|
||||
|
||||
memcpy(pDiffServer++, &((*ppFound)->server), \
|
||||
sizeof(FDFSStorageBrief));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4690,9 +4690,7 @@ int tracker_mem_sync_storages(FDFSGroupInfo *pGroup, \
|
|||
{
|
||||
pServer->id[FDFS_STORAGE_ID_MAX_SIZE - 1] = '\0';
|
||||
pServer->ip_addr[IP_ADDRESS_SIZE - 1] = '\0';
|
||||
if (pServer->status == FDFS_STORAGE_STATUS_NONE \
|
||||
|| pServer->status == FDFS_STORAGE_STATUS_ACTIVE \
|
||||
|| pServer->status == FDFS_STORAGE_STATUS_ONLINE)
|
||||
if (pServer->status == FDFS_STORAGE_STATUS_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -4708,6 +4706,8 @@ int tracker_mem_sync_storages(FDFSGroupInfo *pGroup, \
|
|||
tracker_mem_cmp_by_storage_id)) != NULL)
|
||||
{
|
||||
if ((*ppFound)->status == pServer->status \
|
||||
|| (*ppFound)->status == \
|
||||
FDFS_STORAGE_STATUS_INIT \
|
||||
|| (*ppFound)->status == \
|
||||
FDFS_STORAGE_STATUS_ONLINE \
|
||||
|| (*ppFound)->status == \
|
||||
|
|
@ -4718,6 +4718,13 @@ int tracker_mem_sync_storages(FDFSGroupInfo *pGroup, \
|
|||
continue;
|
||||
}
|
||||
|
||||
logWarning("file: "__FILE__", line: %d, "
|
||||
"storage server: %s:%d, dest status: %d, "
|
||||
"my status: %d, should change my status!",
|
||||
__LINE__, (*ppFound)->ip_addr,
|
||||
(*ppFound)->storage_port,
|
||||
pServer->status, (*ppFound)->status);
|
||||
|
||||
if (pServer->status == \
|
||||
FDFS_STORAGE_STATUS_DELETED
|
||||
|| pServer->status == \
|
||||
|
|
@ -4739,6 +4746,11 @@ int tracker_mem_sync_storages(FDFSGroupInfo *pGroup, \
|
|||
{
|
||||
//ignore deleted storage server
|
||||
}
|
||||
else if (pServer->status == FDFS_STORAGE_STATUS_ACTIVE
|
||||
|| pServer->status == FDFS_STORAGE_STATUS_ONLINE)
|
||||
{
|
||||
//ignore online or active storage server
|
||||
}
|
||||
else
|
||||
{
|
||||
FDFSStorageDetail *pStorageServer;
|
||||
|
|
|
|||
Loading…
Reference in New Issue