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

F #4809: Pre-allocate lastoid to prevent stale id's in the pool in case

of leader failure
This commit is contained in:
Ruben S. Montero 2017-06-30 17:02:59 +02:00
parent 3378c9a2f0
commit cfd2983058

View File

@ -137,6 +137,8 @@ int PoolSQL::allocate(PoolObjectSQL *objsql, string& error_str)
objsql->oid = ++lastOID;
_set_lastOID(lastOID, db, table);
rc = objsql->insert(db, error_str);
if ( rc != 0 )
@ -151,9 +153,9 @@ int PoolSQL::allocate(PoolObjectSQL *objsql, string& error_str)
delete objsql;
if( rc != -1 )
if( rc == -1 )
{
_set_lastOID(lastOID, db, table);
_set_lastOID(--lastOID, db, table);
}
unlock();