Allow delete marker replication from replica (#11566)

in the case of active-active replication.

This PR also has the following changes:

- add docs on replication design
- fix corner case of completing versioned delete on a delete marker
  when the target is down and `mc rm --vid` is performed repeatedly. Instead
  the version should still be retained in the `PENDING|FAILED` state until
  replication sync completes.
- remove `s3:Replication:OperationCompletedReplication` and
   `s3:Replication:OperationFailedReplication` from ObjectCreated 
  events type
This commit is contained in:
Poorna Krishnamoorthy
2021-02-18 00:33:51 -08:00
committed by GitHub
parent 95e0acbb26
commit 8e8a792d9d
5 changed files with 95 additions and 13 deletions

View File

@@ -184,19 +184,15 @@ func checkReplicateDelete(ctx context.Context, bucket string, dobj ObjectToDelet
if gerr != nil {
validReplStatus := false
switch oi.ReplicationStatus {
// Point to note: even if two way replication with Deletemarker or Delete sync is enabled,
// deletion of a REPLICA object/deletemarker will not trigger a replication to the other cluster.
case replication.Pending, replication.Completed, replication.Failed:
validReplStatus = true
}
if oi.DeleteMarker && validReplStatus {
return oi.DeleteMarker, true, sync
}
return oi.DeleteMarker, false, sync
}
if oi.ReplicationStatus == replication.Replica {
// avoid replicating a replica in bi-directional replication
return oi.DeleteMarker, false, sync
// can be the case that other cluster is down and duplicate `mc rm --vid`
// is issued - this still needs to be replicated back to the other target
return oi.DeleteMarker, oi.VersionPurgeStatus == Pending || oi.VersionPurgeStatus == Failed, sync
}
tgt := globalBucketTargetSys.GetRemoteTargetClient(ctx, rcfg.RoleArn)
// the target online status should not be used here while deciding