replication resync: fix queueing (#17775)

Assign resync of all versions of object to the same worker to avoid locking
contention. Fixes parallel resync implementation in #16707
This commit is contained in:
Poorna
2023-08-01 11:51:15 -07:00
committed by GitHub
parent b0f0e53bba
commit 311380f8cb
4 changed files with 112 additions and 77 deletions

View File

@@ -292,22 +292,22 @@ func siteResyncStatus(currSt ResyncStatusType, m map[string]ResyncStatusType) Re
}
// update resync metrics per object
func (sm *siteResyncMetrics) updateMetric(roi ReplicateObjectInfo, success bool, resyncID string) {
func (sm *siteResyncMetrics) updateMetric(r TargetReplicationResyncStatus, resyncID string) {
if !globalSiteReplicationSys.isEnabled() {
return
}
sm.Lock()
defer sm.Unlock()
s := sm.resyncStatus[resyncID]
if success {
if r.ReplicatedCount > 0 {
s.ReplicatedCount++
s.ReplicatedSize += roi.Size
s.ReplicatedSize += r.ReplicatedSize
} else {
s.FailedCount++
s.FailedSize += roi.Size
s.FailedSize += r.FailedSize
}
s.Bucket = roi.Bucket
s.Object = roi.Name
s.Bucket = r.Bucket
s.Object = r.Object
s.LastUpdate = UTCNow()
sm.resyncStatus[resyncID] = s
}