1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

F #4809: Fix replication on failed zones, adjust timeout for replication

This commit is contained in:
Ruben S. Montero 2017-06-21 21:42:55 +02:00
parent 92c86e8f48
commit e42802060e
3 changed files with 11 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class ReplicaThread
{
public:
ReplicaThread(int _follower_id):follower_id(_follower_id), _finalize(false),
_pending_requests(false), retry_timeout(2)
_pending_requests(false), retry_timeout(1e8)
{
pthread_mutex_init(&mutex, 0);

View File

@ -509,6 +509,12 @@ int FedReplicaManager::xmlrpc_replicate_log(int zone_id, bool& success,
return -1;
}
if ( zservers.size() == 0 )
{
error = "No servers defined in the zone";
return -1;
}
// -------------------------------------------------------------------------
// Get parameters to call append entries on follower
// -------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
const time_t ReplicaThread::max_retry_timeout = 300;
const time_t ReplicaThread::max_retry_timeout = 2.5e9;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
@ -79,8 +79,8 @@ void ReplicaThread::do_replication()
{
struct timespec timeout;
timeout.tv_sec = time(NULL) + retry_timeout;
timeout.tv_nsec = 0;
timeout.tv_sec = time(NULL);
timeout.tv_nsec = retry_timeout;
if ( pthread_cond_timedwait(&cond, &mutex, &timeout) == ETIMEDOUT )
{
@ -110,7 +110,7 @@ void ReplicaThread::do_replication()
}
else
{
retry_timeout = 2;
retry_timeout = 1e8;
retry_request = false;
}
}