mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
M #-: Fix HA synchronization (#888)
This commit is contained in:
parent
84c753e5ec
commit
b6f868fda1
@ -1180,6 +1180,8 @@ void Nebula::start(bool bootstrap_only)
|
||||
|
||||
rm->finalize();
|
||||
|
||||
raftm->finalize();
|
||||
|
||||
if (!cache)
|
||||
{
|
||||
vmm->finalize();
|
||||
@ -1206,7 +1208,6 @@ void Nebula::start(bool bootstrap_only)
|
||||
ipamm->join_thread();
|
||||
}
|
||||
|
||||
raftm->finalize();
|
||||
aclm->finalize();
|
||||
|
||||
authm->finalize();
|
||||
|
@ -128,9 +128,9 @@ RaftManager::RaftManager(int id, const VectorAttribute * leader_hook_mad,
|
||||
set_timeout(bcast, broadcast_timeout);
|
||||
set_timeout(elect, election_timeout);
|
||||
|
||||
// 5 seconds warm-up to start election
|
||||
// 15 seconds warm-up to start election
|
||||
clock_gettime(CLOCK_REALTIME, &last_heartbeat);
|
||||
last_heartbeat.tv_sec += 5;
|
||||
last_heartbeat.tv_sec += 15;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Initialize Hooks
|
||||
@ -688,7 +688,7 @@ void RaftManager::timer_action()
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
if ( nd.is_cache() )
|
||||
if ( nd.is_cache() || server_id < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ void ZoneVoteRequest::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
RaftManager * raftm = nd.get_raftm();
|
||||
|
||||
unsigned int candidate_term = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
unsigned int candidate_id = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
int candidate_id = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
|
||||
uint64_t candidate_log_index = xmlrpc_c::value_i8(paramList.getI8(3));
|
||||
unsigned int candidate_log_term = xmlrpc_c::value_int(paramList.getInt(4));
|
||||
@ -471,6 +471,14 @@ void ZoneVoteRequest::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
logdb->get_last_record_index(log_index, log_term);
|
||||
|
||||
if (candidate_id < 0)
|
||||
{
|
||||
att.resp_id = current_term;
|
||||
|
||||
failure_response(INTERNAL, att);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!att.is_oneadmin())
|
||||
{
|
||||
att.resp_id = current_term;
|
||||
|
Loading…
x
Reference in New Issue
Block a user