mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-13 12:58:17 +03:00
F #4809: Better cancellatin of replica threads
This commit is contained in:
parent
46725391be
commit
c98457ae15
@ -605,7 +605,7 @@ void RaftManager::replicate_success(int follower_id)
|
||||
}
|
||||
}
|
||||
|
||||
if ( db_last_index > replicated_index )
|
||||
if ((db_last_index > replicated_index) && (state == LEADER))
|
||||
{
|
||||
replica_manager.replicate(follower_id);
|
||||
}
|
||||
@ -632,7 +632,10 @@ void RaftManager::replicate_failure(int follower_id)
|
||||
}
|
||||
}
|
||||
|
||||
replica_manager.replicate(follower_id);
|
||||
if ( state == LEADER )
|
||||
{
|
||||
replica_manager.replicate(follower_id);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
@ -59,10 +59,6 @@ void ReplicaManager::stop_replica_threads()
|
||||
for ( it = thread_pool.begin() ; it != thread_pool.end() ; ++it )
|
||||
{
|
||||
it->second->finalize();
|
||||
|
||||
pthread_cancel(it->second->thread_id());
|
||||
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
thread_pool.clear();
|
||||
@ -110,10 +106,6 @@ void ReplicaManager::delete_replica_thread(int follower_id)
|
||||
|
||||
it->second->finalize();
|
||||
|
||||
NebulaLog::log("RCM", Log::INFO, "Replication thread stopped");
|
||||
|
||||
delete it->second;
|
||||
|
||||
thread_pool.erase(it);
|
||||
};
|
||||
|
||||
|
@ -55,6 +55,10 @@ extern "C" void * replication_thread(void *arg)
|
||||
|
||||
rt->do_replication();
|
||||
|
||||
NebulaLog::log("RCM", Log::INFO, "Replication thread stopped");
|
||||
|
||||
delete rt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user