check if object is modified before starting to send it
Fix bug that caused some transfers to incorrectly fail with "content changed while it was being sent", when the content was not changed. While I don't know how to reproduce the problem that several people reported, it is presumably due to the inode cache somehow being stale. So check isUnmodified', and if it's not modified, include the file's current inode cache in the set to accept, when checking for modification after the transfer. That seems like the right thing to do for another reason: The failure says the file changed while it was being sent, but if the object file was changed before the transfer started, that's wrong. So it needs to check before allowing the transfer at all if the file is modified. (Other calls to sameInodeCache or elemInodeCaches, when operating on inode caches from the database, could also be problimatic if the inode cache is somehow getting stale. This does not address such problems.) Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
ae015c2ab9
commit
3b5a3e168d
4 changed files with 43 additions and 10 deletions
|
@ -483,9 +483,18 @@ prepSendAnnex key = withObjectLoc key $ \f -> do
|
|||
fastDebug "Annex.Content" ("found no inode cache for " ++ show f)
|
||||
maybeToList <$>
|
||||
withTSDelta (liftIO . genInodeCache f)
|
||||
else do
|
||||
fastDebug "Annex.Content" ("found inode cache for " ++ show f)
|
||||
pure cache
|
||||
-- Verify that the object is not modified. Usually this
|
||||
-- only has to check the inode cache, but if the cache
|
||||
-- is somehow stale, it will fall back to verifying its
|
||||
-- content.
|
||||
else withTSDelta (liftIO . genInodeCache f) >>= \case
|
||||
Just fc -> ifM (isUnmodified' key f fc cache)
|
||||
( do
|
||||
fastDebug "Annex.Content" ("found inode cache for " ++ show f)
|
||||
return (fc:cache)
|
||||
, return []
|
||||
)
|
||||
Nothing -> return []
|
||||
return $ if null cache'
|
||||
then Nothing
|
||||
else Just (fromRawFilePath f, sameInodeCache f cache')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue