diff --git a/cmd/syncComparator.go b/cmd/syncComparator.go index 3ee817c4c..76601f120 100644 --- a/cmd/syncComparator.go +++ b/cmd/syncComparator.go @@ -21,6 +21,7 @@ package cmd import ( + "fmt" "github.com/Azure/azure-pipeline-go/pipeline" "github.com/Azure/azure-storage-azcopy/v10/common" "reflect" @@ -73,15 +74,21 @@ func (f *syncDestinationComparator) processIfNecessary(destinationObject StoredO switch f.comparisonHashType { case common.ESyncHashType.MD5(): if !reflect.DeepEqual(sourceObjectInMap.md5, destinationObject.md5) { + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s overwritten due to differing hash.", destinationObject.relativePath)) // hash inequality = source "newer" in this model. return f.copyTransferScheduler(sourceObjectInMap) } default: panic("sanity check: unsupported hash type " + f.comparisonHashType.String()) } + + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s skipped due to same hash.", destinationObject.relativePath)) + return nil } else if sourceObjectInMap.isMoreRecentThan(destinationObject) { return f.copyTransferScheduler(sourceObjectInMap) } + + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s skipped due to destination being newer", destinationObject.relativePath)) } else { // purposefully ignore the error from destinationCleaner // it's a tolerable error, since it just means some extra destination object might hang around a bit longer @@ -137,17 +144,21 @@ func (f *syncSourceComparator) processIfNecessary(sourceObject StoredObject) err case common.ESyncHashType.MD5(): if !reflect.DeepEqual(sourceObject.md5, destinationObjectInMap.md5) { // hash inequality = source "newer" in this model. + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s overwritten due to differing hash.", sourceObject.relativePath)) return f.copyTransferScheduler(sourceObject) } default: panic("sanity check: unsupported hash type " + f.comparisonHashType.String()) } + + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s skipped due to same hash.", sourceObject.relativePath)) + return nil } else if sourceObject.isMoreRecentThan(destinationObjectInMap) { // if destination is stale, schedule source return f.copyTransferScheduler(sourceObject) } - azcopyScanningLogger.Log(pipeline.LogDebug, "Object "+sourceObject.name+" skipped") + azcopyScanningLogger.Log(pipeline.LogDebug, fmt.Sprintf("File %s skipped due to destination being newer", sourceObject.relativePath)) // skip if dest is more recent return nil }