1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-13 12:58:17 +03:00

F #4809: Fix race condition updating next index in federated log.

This commit is contained in:
Ruben S. Montero 2017-07-12 13:46:19 +02:00
parent 3fdf93d892
commit b315b71009

View File

@ -290,15 +290,22 @@ int FedReplicaManager::get_next_record(int zone_id, std::string& zedp,
zedp = zs->endpoint;
//Initialize next index for the zone
if ( zs->next == -1 )
{
zs->next= logdb->last_federated();
}
//Update the next index for zone if already reaplicated
if ( zs->last == zs->next )
{
pthread_mutex_unlock(&mutex);
return -1;
zs->next = logdb->next_federated(zs->next);
if ( zs->last == zs->next ) //no new records
{
pthread_mutex_unlock(&mutex);
return -1;
}
}
int rc = logdb->get_log_record(zs->next, lr);