add missing locking of ContentIdentifier database when writing
This is not super efficient; it would be better to lock the database once and build up a queue of changes and flush once. But, storeExportWithContentIdentifier is likely going to be the really expensive part, so let's do the simple thing and only optimise later if needed.
This commit is contained in:
parent
3f449f845e
commit
93025dd59f
2 changed files with 4 additions and 4 deletions
|
@ -19,6 +19,7 @@ import qualified Database.Export as Export
|
|||
import qualified Database.ContentIdentifier as ContentIdentifier
|
||||
import Annex.Export
|
||||
import Annex.Import
|
||||
import Annex.LockFile
|
||||
import Config
|
||||
import Git.Types (fromRef)
|
||||
import Logs.Export
|
||||
|
@ -155,7 +156,9 @@ adjustExportImport r = case M.lookup "exporttree" (config r) of
|
|||
storeExportWithContentIdentifier (importActions r') f k loc knowncids p >>= \case
|
||||
Nothing -> return False
|
||||
Just newcid -> do
|
||||
liftIO $ ContentIdentifier.recordContentIdentifier db (uuid r') newcid k
|
||||
withExclusiveLock gitAnnexContentIdentifierLock $ do
|
||||
liftIO $ ContentIdentifier.recordContentIdentifier db (uuid r') newcid k
|
||||
liftIO $ ContentIdentifier.flushDbQueue db
|
||||
recordContentIdentifier (uuid r') newcid k
|
||||
return True
|
||||
, removeExport = \k loc -> do
|
||||
|
|
|
@ -15,9 +15,6 @@ this.
|
|||
|
||||
Note that updating the db needs to write lock it.
|
||||
|
||||
* Remote.Helper.ExportImport calls recordContentIdentifier on a database
|
||||
that is not write locked.
|
||||
|
||||
* Need to support annex-tracking-branch configuration, which documentation
|
||||
says makes git-annex sync and assistant do imports.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue