reset container if deleted in flight, not delete (#1924)
## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change - [x] 🐹 Trivial/Minor ## Issue(s) * #1923 ## Test Plan - [x] 💚 E2E
This commit is contained in:
parent
d0093fdb17
commit
b6a2227acc
@ -97,13 +97,15 @@ func filterContainersAndFillCollections(
|
|||||||
|
|
||||||
jobs, newDelta, err := getJobs(ctx, service, qp.ResourceOwner, cID, prevDelta)
|
jobs, newDelta, err := getJobs(ctx, service, qp.ResourceOwner, cID, prevDelta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// race conditions happen, containers might get deleted while
|
|
||||||
// this process is in flight. If it was deleted, we remake the
|
|
||||||
// tombstone, just to be sure it gets deleted from storage.
|
|
||||||
if graph.IsErrDeletedInFlight(err) == nil {
|
if graph.IsErrDeletedInFlight(err) == nil {
|
||||||
errs = support.WrapAndAppend(qp.ResourceOwner, err, errs)
|
errs = support.WrapAndAppend(qp.ResourceOwner, err, errs)
|
||||||
} else {
|
} else {
|
||||||
tombstones[cID] = dp.path
|
// race conditions happen, containers might get deleted while
|
||||||
|
// this process is in flight. If that happens, force the collection
|
||||||
|
// to reset which will prevent any old items from being retained in
|
||||||
|
// storage. If the container (or its children) are sill missing
|
||||||
|
// on the next backup, they'll get tombstoned.
|
||||||
|
newDelta = deltaUpdate{reset: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
@ -132,13 +134,10 @@ func filterContainersAndFillCollections(
|
|||||||
currPaths[cID] = currPath.String()
|
currPaths[cID] = currPath.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// A tombstone is a collection path that needs to be marked for deletion.
|
// A tombstone is a folder that needs to be marked for deletion.
|
||||||
// Tombstones can occur for a number of reasons: the delta token expired,
|
// The only situation where a tombstone should appear is if the folder exists
|
||||||
// the container was deleted in flight, or the user deleted the container
|
// in the `previousPath` set, but does not exist in the current container
|
||||||
// between backup runs. If events combine to both delete and write content
|
// resolver (which contains all the resource owners' current containers).
|
||||||
// to the same container (ex: container_1 gets deleted, then container_2
|
|
||||||
// gets created with the same name), it is assumed that the backup consumer
|
|
||||||
// processes deletions before creations, making the combined operation safe.
|
|
||||||
for id, p := range tombstones {
|
for id, p := range tombstones {
|
||||||
service, err := createService(qp.Credentials)
|
service, err := createService(qp.Credentials)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user