avoid using renameExport on import remotes

This commit is contained in:
Joey Hess 2019-03-05 14:57:48 -04:00
parent 9df9a3f82b
commit fd2a1aaa17
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 6 additions and 15 deletions

View file

@ -173,6 +173,12 @@ adjustExportImport r = case M.lookup "exporttree" (config r) of
removeExportWithContentIdentifier (importActions r') k loc
=<< getknowncids db loc
, removeExportDirectory = removeExportDirectoryWhenEmpty (importActions r')
-- renameExport is optional, and the
-- remote's implementation may
-- lose modifications to the file
-- (by eg copying and then deleting)
-- so don't use it
, renameExport = \_ _ _ -> return False
}
}

View file

@ -15,21 +15,6 @@ this.
and so startExport does the wrong thing. Seems to indicate checkPresentExport
needs to be replaced too.
* Is renameExport safe to use with an import?
When a rename() is done, it could result in a modified file being
renamed. But this would not result in data loss; the next import would
see the modification and import it from the new name. The only
potentially confusing thing is that there was essentially a conflict, and
it got resolved in a way the user may not expect.
But.. S3 implements rename as a copy followed by a
delete. But if there's a race, that means that the modified content does
get deleted.
So, it seems it's not safe.
Probably simplest to just make it not be provided for import remotes.
* Should the ContentIdentifier db be multiwriter? It would simplify
the situation with the long-lived lock of it in adjustExportImport