summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceGrid/Database.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index 7717b72907e..8adffcc3f37 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -2664,35 +2664,31 @@ Database::finishUpdating(const string& name)
Ice::Long
Database::getSerial(const IceDB::Txn& txn, const string& dbName)
{
- Ice::Long serial;
- if(!_serials.get(txn, dbName, serial))
- {
- return 1;
- }
+ Ice::Long serial = 1;
+ _serials.get(txn, dbName, serial);
return serial;
}
Ice::Long
Database::updateSerial(const IceDB::ReadWriteTxn& txn, const string& dbName, Ice::Long serial)
{
- if(serial == -1) // Master doesn't support serials.
+ if(serial == -1) // The master we are talking to doesn't support serials (old IceGrid versions)
{
return -1;
}
//
- // If a serial number is provided, just update the serial number from the database,
+ // If a serial number is set, just update the serial number from the database,
// otherwise if the serial is 0, we increment the serial from the database.
//
- Ice::Long dbSerial;
- if(!_serials.get(txn, dbName, dbSerial))
+ if(serial > 0)
{
- _serials.put(txn, dbName, serial == 0 ? 1 : serial);
- return 1;
+ _serials.put(txn, dbName, serial);
+ return serial;
}
else
{
- dbSerial = (serial == 0 ? dbSerial + 1 : serial);
+ Ice::Long dbSerial = getSerial(txn, dbName) + 1;
_serials.put(txn, dbName, dbSerial);
return dbSerial;
}