add restage log
When pointer files need to be restaged, they're first written to the log, and then when the restage operation runs, it reads the log. This way, if the git-annex process is interrupted before it can do the restaging, a later git-annex process can do it. Currently, this lets a git-annex get/drop command be interrupted and then re-ran, and as long as it gets/drops additional files, it will clean up after the interrupted command. But more changes are needed to make it easier to restage after an interrupted process. Kept using the git queue to run the restage action, even though the list of files that it builds up for that action is not actually used by the action. This could perhaps be simplified to make restaging a cleanup action that gets registered, rather than using the git queue for it. But I wasn't sure if that would cause visible behavior changes, when eg dropping a large number of files, currently the git queue flushes periodically, and so it restages incrementally, rather than all at the end. In restagePointerFiles, it reads the restage log twice, once to get the number of files and size, and a second time to process it. This seemed better than reading the whole file into memory, since potentially a huge number of files could be in there. Probably the OS will cache the file in memory and there will not be much performance impact. It might be better to keep running tallies in another file though. But updating that atomically with the log seems hard. Also note that it's possible for calcRestageLog to see a different file than streamRestageLog does. More files may be added to the log in between. That is ok, it will only cause the filterprocessfaster heuristic to operate with slightly out of date information, so it may make the wrong choice for the files that got added and be a little slower than ideal. Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
parent
9c76e503cf
commit
6a3bd283b8
9 changed files with 148 additions and 71 deletions
|
@ -53,11 +53,11 @@ data Action m
|
|||
- those will be run before the FlushAction is. -}
|
||||
| FlushAction
|
||||
{ getFlushActionRunner :: FlushActionRunner m
|
||||
, getFlushActionFiles :: [(RawFilePath, IO Bool, FileSize)]
|
||||
, getFlushActionFiles :: [RawFilePath]
|
||||
}
|
||||
|
||||
{- The String must be unique for each flush action. -}
|
||||
data FlushActionRunner m = FlushActionRunner String (Repo -> [(RawFilePath, IO Bool, FileSize)] -> m ())
|
||||
data FlushActionRunner m = FlushActionRunner String (Repo -> [RawFilePath] -> m ())
|
||||
|
||||
instance Eq (FlushActionRunner m) where
|
||||
FlushActionRunner s1 _ == FlushActionRunner s2 _ = s1 == s2
|
||||
|
@ -140,7 +140,7 @@ addCommand commonparams subcommand params files q repo =
|
|||
{- Adds an flush action to the queue. This can co-exist with anything else
|
||||
- that gets added to the queue, and when the queue is eventually flushed,
|
||||
- it will be run after the other things in the queue. -}
|
||||
addFlushAction :: MonadIO m => FlushActionRunner m -> [(RawFilePath, IO Bool, FileSize)] -> Queue m -> Repo -> m (Queue m)
|
||||
addFlushAction :: MonadIO m => FlushActionRunner m -> [RawFilePath] -> Queue m -> Repo -> m (Queue m)
|
||||
addFlushAction runner files q repo =
|
||||
updateQueue action (const False) (length files) q repo
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue