git-annex/doc/todo/delete_old_misctmp_files.mdwn
Joey Hess d5f2463702
misctmp cleanup
* Switch to using .git/annex/othertmp for tmp files other than partial
  downloads, and make stale files left in that directory when git-annex
  is interrupted be cleaned up promptly by subsequent git-annex processes.
* The .git/annex/misctmp directory is no longer used and git-annex will
  delete anything lingering in there after it's 1 week old.

Also, in Annex.Ingest, made the filename it uses in the tmp dir be
prefixed with "ingest-" to avoid potentially using a filename used by
some other code.
2019-01-17 16:02:22 -04:00

24 lines
1 KiB
Markdown

Files can be left in .git/annex/misctmp when git-annex is interrupted in
the middle of an operation that uses it. Especially with `git annex add`
being interrupted can leave a large file hard linked in there, which can
become a problem for the user.
While it would be possible to hook SIGINT and clean up the files, that
wouldn't catch every way git-annex could be interrupted; ie power failure.
The assistant has some code that deletes misctmp files there older than 1
day. Perhaps when git-annex uses the misctmp directory it should first
perform such a cleanup pass.
A 1 day timeout is not ideal.. Imagine a git-annex add of a really big file
where the checksum takes more than 1 day.
Let's use a lock file. There can be a single one for the whole misctmp
directory. When it's being used, a shared lock is held. Take an exclusive
lock before cleaning it.
Since old versions of git-annex could still be in use and using the misctmp
directory, let's rename the directory that new versions of git-annex
use to .git/annex/othertmp.
[[done]] --[[Joey]]