fix: delete marker permanent delete replication (#11581)

master
Poorna Krishnamoorthy 4 years ago committed by GitHub
parent f28b063091
commit 2dce5d9442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      cmd/bucket-replication.go

@ -179,6 +179,14 @@ func checkReplicateDelete(ctx context.Context, bucket string, dobj ObjectToDelet
if err != nil || rcfg == nil { if err != nil || rcfg == nil {
return false, false, sync return false, false, sync
} }
opts := replication.ObjectOpts{
Name: dobj.ObjectName,
SSEC: crypto.SSEC.IsEncrypted(oi.UserDefined),
UserTags: oi.UserTags,
DeleteMarker: oi.DeleteMarker,
VersionID: dobj.VersionID,
}
replicate = rcfg.Replicate(opts)
// when incoming delete is removal of a delete marker( a.k.a versioned delete), // when incoming delete is removal of a delete marker( a.k.a versioned delete),
// GetObjectInfo returns extra information even though it returns errFileNotFound // GetObjectInfo returns extra information even though it returns errFileNotFound
if gerr != nil { if gerr != nil {
@ -187,7 +195,7 @@ func checkReplicateDelete(ctx context.Context, bucket string, dobj ObjectToDelet
case replication.Pending, replication.Completed, replication.Failed: case replication.Pending, replication.Completed, replication.Failed:
validReplStatus = true validReplStatus = true
} }
if oi.DeleteMarker && validReplStatus { if oi.DeleteMarker && (validReplStatus || replicate) {
return oi.DeleteMarker, true, sync return oi.DeleteMarker, true, sync
} }
// can be the case that other cluster is down and duplicate `mc rm --vid` // can be the case that other cluster is down and duplicate `mc rm --vid`
@ -200,14 +208,7 @@ func checkReplicateDelete(ctx context.Context, bucket string, dobj ObjectToDelet
if tgt == nil { if tgt == nil {
return oi.DeleteMarker, false, false return oi.DeleteMarker, false, false
} }
opts := replication.ObjectOpts{ return oi.DeleteMarker, replicate, tgt.replicateSync
Name: dobj.ObjectName,
SSEC: crypto.SSEC.IsEncrypted(oi.UserDefined),
UserTags: oi.UserTags,
DeleteMarker: oi.DeleteMarker,
VersionID: dobj.VersionID,
}
return oi.DeleteMarker, rcfg.Replicate(opts), tgt.replicateSync
} }
// replicate deletes to the designated replication target if replication configuration // replicate deletes to the designated replication target if replication configuration

Loading…
Cancel
Save