From 1ea7826c0e50b7526577f69059b0ad51dd25df4a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 25 Aug 2023 15:31:15 -0700 Subject: [PATCH] do not have to consider replicationTimestamp for healing and quorum (#17922) replicationTimestamp might differ if there were retries in replication and the retried attempt overwrote in quorum but enough shards with newer timestamp causing the existing timestamps on xl.meta to be invalid, we do not rely on this value for anything external. this is purely a hint for debugging purposes, but there is no real value in it considering the object itself is in-tact we do not have to spend time healing this situation. we may consider healing this situation in future but that needs to be decoupled to make sure that we do not over calculate how much we have to heal. --- cmd/bucket-replication-utils.go | 7 ++++--- cmd/erasure-metadata.go | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/bucket-replication-utils.go b/cmd/bucket-replication-utils.go index f5a88eb41..3024740be 100644 --- a/cmd/bucket-replication-utils.go +++ b/cmd/bucket-replication-utils.go @@ -349,8 +349,6 @@ type ReplicationState struct { // Equal returns true if replication state is identical for version purge statuses and (replica)tion statuses. func (rs *ReplicationState) Equal(o ReplicationState) bool { return rs.ReplicaStatus == o.ReplicaStatus && - rs.ReplicaTimeStamp.Equal(o.ReplicaTimeStamp) && - rs.ReplicationTimeStamp.Equal(o.ReplicationTimeStamp) && rs.ReplicationStatusInternal == o.ReplicationStatusInternal && rs.VersionPurgeStatusInternal == o.VersionPurgeStatusInternal } @@ -366,7 +364,10 @@ func (rs *ReplicationState) CompositeReplicationStatus() (st replication.StatusT replStatus := getCompositeReplicationStatus(rs.Targets) // return REPLICA status if replica received timestamp is later than replication timestamp // provided object replication completed for all targets. - if !rs.ReplicaTimeStamp.Equal(timeSentinel) && replStatus == replication.Completed && rs.ReplicaTimeStamp.After(rs.ReplicationTimeStamp) { + if rs.ReplicaTimeStamp.Equal(timeSentinel) || rs.ReplicaTimeStamp.IsZero() { + return replStatus + } + if replStatus == replication.Completed && rs.ReplicaTimeStamp.After(rs.ReplicationTimeStamp) { return rs.ReplicaStatus } return replStatus diff --git a/cmd/erasure-metadata.go b/cmd/erasure-metadata.go index 5b24467fc..929988c4d 100644 --- a/cmd/erasure-metadata.go +++ b/cmd/erasure-metadata.go @@ -21,7 +21,6 @@ import ( "context" "encoding/hex" "fmt" - "net/http" "sort" "strconv" "strings" @@ -365,8 +364,6 @@ func findFileInfoInQuorum(ctx context.Context, metaArr []FileInfo, modTime time. // Server-side replication fields fmt.Fprintf(h, "%v", meta.MarkDeleted) fmt.Fprint(h, meta.Metadata[string(meta.ReplicationState.ReplicaStatus)]) - fmt.Fprint(h, meta.Metadata[meta.ReplicationState.ReplicationTimeStamp.Format(http.TimeFormat)]) - fmt.Fprint(h, meta.Metadata[meta.ReplicationState.ReplicaTimeStamp.Format(http.TimeFormat)]) fmt.Fprint(h, meta.Metadata[meta.ReplicationState.ReplicationStatusInternal]) fmt.Fprint(h, meta.Metadata[meta.ReplicationState.VersionPurgeStatusInternal])