Skip to content

Commit

Permalink
find the trunk server for each group when current tracker be a leader
Browse files Browse the repository at this point in the history
git-svn-id: http://fastdfs.googlecode.com/svn@972 0d4c4929-bc51-0410-a161-b7c81ae5c018
  • Loading branch information
happyfish100 committed Jan 7, 2012
1 parent cff6bf2 commit 32dc782
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion trunk/HISTORY
@@ -1,7 +1,8 @@

Version 3.06 2011-12-25
Version 3.06 2012-01-07
* add common/avl_tree.h and common/avl_tree.c
* organize trunk free blocks using AVL tree
* find the trunk server for each group when current tracker be a leader

Version 3.05 2011-12-20
* remove compile warnings
Expand Down
22 changes: 22 additions & 0 deletions trunk/tracker/tracker_mem.c
Expand Up @@ -4689,6 +4689,28 @@ int tracker_mem_active_store_server(FDFSGroupInfo *pGroup, \
return 0;
}

void tracker_mem_find_trunk_servers()
{
FDFSGroupInfo **ppGroup;
FDFSGroupInfo **ppGroupEnd;

if (!(g_if_leader_self && g_if_use_trunk_file))
{
return;
}

pthread_mutex_lock(&mem_thread_lock);
ppGroupEnd = g_groups.groups + g_groups.count;
for (ppGroup=g_groups.groups; ppGroup<ppGroupEnd; ppGroup++)
{
if ((*ppGroup)->pTrunkServer == NULL)
{
tracker_mem_find_trunk_server(*ppGroup, true);
}
}
pthread_mutex_unlock(&mem_thread_lock);
}

int tracker_mem_offline_store_server(FDFSGroupInfo *pGroup, \
FDFSStorageDetail *pStorage)
{
Expand Down
2 changes: 2 additions & 0 deletions trunk/tracker/tracker_mem.h
Expand Up @@ -123,6 +123,8 @@ int tracker_mem_get_status(TrackerServerInfo *pTrackerServer, \

int tracker_save_groups();

void tracker_mem_find_trunk_servers();

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions trunk/tracker/tracker_relationship.c
Expand Up @@ -388,6 +388,8 @@ static int relationship_select_leader()
"I am the new tracker leader %s:%d", \
__LINE__, trackerStatus.pTrackerServer->ip_addr, \
trackerStatus.pTrackerServer->port);

tracker_mem_find_trunk_servers();
}
else
{
Expand Down

0 comments on commit 32dc782

Please sign in to comment.