Skip to content

Commit

Permalink
Download a fossil directly instead of turning it back to a chunk first
Browse files Browse the repository at this point in the history
This is to avoid the read-after-rename consistency issue where the effect
of renaming may not be observed by the subsequent attempt to download the
just renamed chunk.
  • Loading branch information
gilbertchen committed Oct 8, 2021
1 parent e43e848 commit cacf661
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/duplicacy_chunkdownloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,10 @@ func (downloader *ChunkDownloader) Download(threadIndex int, task ChunkDownloadT
return false
}

// We can't download the fossil directly. We have to turn it back into a regular chunk and try
// downloading again.
err = downloader.storage.MoveFile(threadIndex, fossilPath, chunkPath)
if err != nil {
completeFailedChunk(chunk)
LOG_WERROR(downloader.allowFailures, "DOWNLOAD_CHUNK", "Failed to resurrect chunk %s: %v", chunkID, err)
return false
}

LOG_WARN("DOWNLOAD_RESURRECT", "Fossil %s has been resurrected", chunkID)
continue
// Don't try to resurrect the fossil as we did before. This is to avoid the potential read-after-rename
// consistency issue. Instead, download the fossil directly; resurrection should be taken care of later.
chunkPath = fossilPath
LOG_WARN("DOWNLOAD_FOSSIL", "Chunk %s is a fossil", chunkID)
}

err = downloader.storage.DownloadFile(threadIndex, chunkPath, chunk)
Expand Down

1 comment on commit cacf661

@gilbertchen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Duplicacy Forum. There might be relevant details there:

https://forum.duplicacy.com/t/deleting-snapshot-from-google-drive-fails/5599/9

Please sign in to comment.