interrupted export recovery bugfixes
When an export was interrupted, the sqlite database won't have been committed necessarily. Also, the interrupted export might have been run in an entirely different repository. There's not a significant speed benefit in checking getExportLocation in this case anyway, so avoid it. Also, remove the old filename from the export database. Recovery from interrupted exports is now tested working. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
a48b52c056
commit
cd5f405623
1 changed files with 11 additions and 6 deletions
|
@ -96,7 +96,9 @@ seek o = do
|
||||||
-- temp files. Diff from the incomplete tree to the new tree,
|
-- temp files. Diff from the incomplete tree to the new tree,
|
||||||
-- and delete any temp files that the new tree can't use.
|
-- and delete any temp files that the new tree can't use.
|
||||||
forM_ (concatMap incompleteExportedTreeish old) $ \incomplete ->
|
forM_ (concatMap incompleteExportedTreeish old) $ \incomplete ->
|
||||||
mapdiff (startUnexportTempName r db . Git.DiffTree.srcsha) incomplete new
|
mapdiff (\diff -> startRecoverIncomplete r db (Git.DiffTree.srcsha diff) (Git.DiffTree.file diff))
|
||||||
|
incomplete
|
||||||
|
new
|
||||||
|
|
||||||
-- Diff the old and new trees, and delete or rename to new name all
|
-- Diff the old and new trees, and delete or rename to new name all
|
||||||
-- changed files in the export. After this, every file that remains
|
-- changed files in the export. After this, every file that remains
|
||||||
|
@ -264,15 +266,18 @@ cleanupUnexport r db eks loc = do
|
||||||
logChange (asKey ek) (uuid r) InfoMissing
|
logChange (asKey ek) (uuid r) InfoMissing
|
||||||
return True
|
return True
|
||||||
|
|
||||||
startUnexportTempName :: Remote -> ExportHandle -> Git.Sha -> CommandStart
|
startRecoverIncomplete :: Remote -> ExportHandle -> Git.Sha -> TopFilePath -> CommandStart
|
||||||
startUnexportTempName r db sha
|
startRecoverIncomplete r db sha oldf
|
||||||
| sha == nullSha = stop
|
| sha == nullSha = stop
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
ek <- exportKey sha
|
ek <- exportKey sha
|
||||||
let loc@(ExportLocation f) = exportTempName ek
|
let loc@(ExportLocation f) = exportTempName ek
|
||||||
stopUnless (liftIO $ elem loc <$> getExportLocation db (asKey ek)) $ do
|
showStart "unexport" f
|
||||||
showStart "unexport" f
|
liftIO $ removeExportLocation db (asKey ek) oldloc
|
||||||
next $ performUnexport r db [ek] loc
|
next $ performUnexport r db [ek] loc
|
||||||
|
where
|
||||||
|
oldloc = ExportLocation $ toInternalGitPath oldf'
|
||||||
|
oldf' = getTopFilePath oldf
|
||||||
|
|
||||||
startMoveToTempName :: Remote -> ExportHandle -> TopFilePath -> ExportKey -> CommandStart
|
startMoveToTempName :: Remote -> ExportHandle -> TopFilePath -> ExportKey -> CommandStart
|
||||||
startMoveToTempName r db f ek = do
|
startMoveToTempName r db f ek = do
|
||||||
|
|
Loading…
Reference in a new issue