Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync overwrite logging #2372

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions cmd/syncComparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ import (
)

const (
syncSkipReasonTime = "the source has an older LMT than the destination"
syncSkipReasonMissingHash = "the source lacks an associated hash; please upload with --put-md5"
syncSkipReasonSameHash = "the source has the same hash"
syncSkipReasonTime = "the source has an older LMT than the destination"
syncSkipReasonMissingHash = "the source lacks an associated hash; please upload with --put-md5"
syncSkipReasonSameHash = "the source has the same hash"
syncOverwriteReasonNewerHash = "the source has a differing hash"
syncOverwriteResaonNewerLMT = "the source is more recent than the destination"
syncStatusSkipped = "skipped"
syncStatusOverwritten = "overwritten"
syncOverwriteResaonNewerLMT = "the source is more recent than the destination"
syncStatusSkipped = "skipped"
syncStatusOverwritten = "overwritten"
)

func syncComparatorLog(fileName, status, skipReason string, stdout bool) {
Expand Down Expand Up @@ -64,7 +64,7 @@ type syncDestinationComparator struct {

comparisonHashType common.SyncHashType

preferSMBTime bool
preferSMBTime bool
disableComparison bool
}

Expand Down Expand Up @@ -113,10 +113,9 @@ func (f *syncDestinationComparator) processIfNecessary(destinationObject StoredO
syncComparatorLog(sourceObjectInMap.relativePath, syncStatusSkipped, syncSkipReasonSameHash, false)
return nil
} else if sourceObjectInMap.isMoreRecentThan(destinationObject, f.preferSMBTime) {
syncComparatorLog(sourceObjectInMap.relativePath, syncStatusOverwritten, syncOverwriteResaonNewerLMT, false)
return f.copyTransferScheduler(sourceObjectInMap)
}

syncComparatorLog(sourceObjectInMap.relativePath, syncStatusOverwritten, syncOverwriteResaonNewerLMT, false)
} 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
Expand All @@ -138,7 +137,7 @@ type syncSourceComparator struct {

comparisonHashType common.SyncHashType

preferSMBTime bool
preferSMBTime bool
disableComparison bool
}

Expand All @@ -164,7 +163,7 @@ func (f *syncSourceComparator) processIfNecessary(sourceObject StoredObject) err
if present {
defer delete(f.destinationIndex.indexMap, relPath)

// if destination is stale, schedule source for transfer
// if destination is stale, schedule source for transfer
if f.disableComparison {
return f.copyTransferScheduler(sourceObject)
}
Expand Down
Loading