From e8b8922754056f74b605c8deef0b834ab1c9d391 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Mon, 6 Aug 2018 21:20:04 -0400 Subject: [PATCH] Continue to check other snapshots when one snapshot has missing chunks --- src/duplicacy_snapshotmanager.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/duplicacy_snapshotmanager.go b/src/duplicacy_snapshotmanager.go index 6905c238..8042c85c 100644 --- a/src/duplicacy_snapshotmanager.go +++ b/src/duplicacy_snapshotmanager.go @@ -792,6 +792,7 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe } snapshotIDIndex := 0 + totalMissingChunks := 0 for snapshotID, _ = range snapshotMap { revisions := revisionsToCheck @@ -877,18 +878,23 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe } if missingChunks > 0 { - LOG_ERROR("SNAPSHOT_CHECK", "Some chunks referenced by snapshot %s at revision %d are missing", + LOG_WARN("SNAPSHOT_CHECK", "Some chunks referenced by snapshot %s at revision %d are missing", + snapshotID, revision) + totalMissingChunks += missingChunks + } else { + LOG_INFO("SNAPSHOT_CHECK", "All chunks referenced by snapshot %s at revision %d exist", snapshotID, revision) - return false } - - LOG_INFO("SNAPSHOT_CHECK", "All chunks referenced by snapshot %s at revision %d exist", - snapshotID, revision) } snapshotIDIndex += 1 } + if totalMissingChunks > 0 { + LOG_ERROR("SNAPSHOT_CHECK", "Some chunks referenced by some snapshots do not exist in the storage") + return false + } + if showTabular { manager.ShowStatisticsTabular(snapshotMap, chunkSizeMap, chunkUniqueMap, chunkSnapshotMap) } else if showStatistics {