1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

Remove replication requests for 1 server clusters

(cherry picked from commit 7c916ebe600da9e0da77104ce4dfc06d70cae6bd)
This commit is contained in:
Ruben S. Montero 2018-08-24 17:56:14 +02:00
parent c79efd20c4
commit da5501e23d
2 changed files with 22 additions and 0 deletions

View File

@ -195,6 +195,24 @@ public:
pthread_mutex_unlock(&mutex);
}
/**
* Remove a replication request associated to this index
* @param rindex of the request
*/
void remove(int rindex)
{
pthread_mutex_lock(&mutex);
std::map<int, ReplicaRequest *>::iterator it = requests.find(rindex);
if ( it != requests.end() )
{
requests.erase(it);
}
pthread_mutex_unlock(&mutex);
}
/**
* Notify all writers and clear the replica map
*/

View File

@ -582,6 +582,8 @@ void RaftManager::replicate_log(ReplicaRequest * request)
{
request->notify();
requests.remove(request->index());
pthread_mutex_unlock(&mutex);
return;
}
@ -594,6 +596,8 @@ void RaftManager::replicate_log(ReplicaRequest * request)
request->timeout = false;
commit = request->index();
requests.remove(request->index());
}
else
{