Skip to content

Commit

Permalink
Continue to check other snapshots when one snapshot has missing chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertchen committed Aug 7, 2018
1 parent 93cc632 commit e8b8922
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/duplicacy_snapshotmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe
}

snapshotIDIndex := 0
totalMissingChunks := 0
for snapshotID, _ = range snapshotMap {

revisions := revisionsToCheck
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e8b8922

Please sign in to comment.