mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-20 10:50:08 +03:00
B #3021:Fix bugs updating the heartbeat timeout update
This commit is contained in:
parent
e0f4855d61
commit
fa88368c46
@ -477,6 +477,10 @@ void RaftManager::leader()
|
||||
replica_manager.start_replica_threads(_follower_ids);
|
||||
heartbeat_manager.start_replica_threads(_follower_ids);
|
||||
|
||||
heartbeat_manager.replicate();
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &last_heartbeat);
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
aclm->reload_rules();
|
||||
@ -555,12 +559,6 @@ void RaftManager::follower(unsigned int _term)
|
||||
|
||||
requests.clear();
|
||||
|
||||
//Reset heartbeat when turning into follower when a higher term is found:
|
||||
// 1. On vote request
|
||||
// 2. On heartbeat response
|
||||
// 3. On log replicate request
|
||||
clock_gettime(CLOCK_REALTIME, &last_heartbeat);
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
if ( nd.is_federation_master() )
|
||||
@ -834,7 +832,6 @@ void RaftManager::timer_action(const ActionRequest& ar)
|
||||
time_t sec = last_heartbeat.tv_sec + broadcast_timeout.tv_sec;
|
||||
long nsec = last_heartbeat.tv_nsec + broadcast_timeout.tv_nsec;
|
||||
|
||||
|
||||
if ((sec < the_time.tv_sec) || (sec == the_time.tv_sec &&
|
||||
nsec <= the_time.tv_nsec))
|
||||
{
|
||||
@ -1024,6 +1021,12 @@ void RaftManager::request_vote()
|
||||
/* ------------------------------------------------------------------ */
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
if ( state != CANDIDATE )
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
break;
|
||||
}
|
||||
|
||||
votedfor = -1;
|
||||
|
||||
raft_state.replace("VOTEDFOR", votedfor);
|
||||
@ -1034,7 +1037,6 @@ void RaftManager::request_vote()
|
||||
|
||||
logdb->update_raft_state(raft_state_name, raft_state_xml);
|
||||
|
||||
|
||||
ms = ( (float) rand() / RAND_MAX ) * (election_timeout.tv_sec * 1000
|
||||
+ election_timeout.tv_nsec / 1000000);
|
||||
|
||||
|
@ -531,8 +531,6 @@ void ZoneVoteRequest::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
return;
|
||||
}
|
||||
|
||||
raftm->update_last_heartbeat(-1);
|
||||
|
||||
success_response(static_cast<int>(current_term), att);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user