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:
parent
3fdf93d892
commit
b315b71009
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user