B #2189: Store NEXT_SNAPSHOT id in the snapshot metadata to not reuse ID's

This commit is contained in:
Ruben S. Montero committed 2018-06-26 10:07:17 +02:00
1 parent 5ba5fad974
commit fbb1ba8d18
2 files changed
+6 -6

No files matched your search

-1
View File
@@ -106,7 +106,6 @@ public:
*/
void clear()
{
next_snapshot = 0;
active = -1;
disk_id = -1;
+6 -5
View File
@@ -33,6 +33,8 @@ Snapshots::Snapshots(int _disk_id, bool _orphans):
}
snapshot_template.add("ALLOW_ORPHANS", _orphans);
snapshot_template.add("NEXT_SNAPSHOT", 0);
};
Snapshots::Snapshots(const Snapshots& s):
@@ -105,11 +107,6 @@ void Snapshots::init()
active = id;
}
if (id >= next_snapshot)
{
next_snapshot = id + 1;
}
snapshot_pool.insert(pair<int, VectorAttribute *>(id, snap[i]));
}
@@ -120,6 +117,8 @@ void Snapshots::init()
disk_id = did;
}
snapshot_template.get("NEXT_SNAPSHOT", next_snapshot);
if ( snapshot_template.get("ALLOW_ORPHANS", orphans) == false )
{
orphans = false;
@@ -177,6 +176,8 @@ int Snapshots::create_snapshot(const string& name, long long size_mb)
snapshot->replace("PARENT", "-1");
}
snapshot_template.replace("NEXT_SNAPSHOST", next_snapshot + 1);
snapshot_template.set(snapshot);
snapshot_pool.insert(