Bugfix to getting content from an export remote with -J, when the export database was not yet populated.
(cherry picked from commit e520341500
)
This commit is contained in:
parent
8af6d2c3c5
commit
e535da621c
4 changed files with 37 additions and 18 deletions
|
@ -7,6 +7,8 @@ git-annex (7.20200226) upstream; urgency=high
|
||||||
any content that git-annex has stored on them that is not encrypted!
|
any content that git-annex has stored on them that is not encrypted!
|
||||||
* info: Fix display of the encryption value.
|
* info: Fix display of the encryption value.
|
||||||
(Some debugging junk had crept in.)
|
(Some debugging junk had crept in.)
|
||||||
|
* Bugfix to getting content from an export remote with -J, when the
|
||||||
|
export database was not yet populated.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 26 Feb 2020 17:18:16 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 26 Feb 2020 17:18:16 -0400
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,6 @@ adjustExportImport r rs = case getRemoteConfigValue exportTreeField (config r) o
|
||||||
{ storeExport = \f k loc p -> do
|
{ storeExport = \f k loc p -> do
|
||||||
db <- getciddb ciddbv
|
db <- getciddb ciddbv
|
||||||
exportdb <- getexportdb exportdbv
|
exportdb <- getexportdb exportdbv
|
||||||
updateexportdb exportdb exportdbv
|
|
||||||
oldks <- liftIO $ Export.getExportTreeKey exportdb loc
|
oldks <- liftIO $ Export.getExportTreeKey exportdb loc
|
||||||
oldcids <- liftIO $ concat
|
oldcids <- liftIO $ concat
|
||||||
<$> mapM (ContentIdentifier.getContentIdentifiers db rs) oldks
|
<$> mapM (ContentIdentifier.getContentIdentifiers db rs) oldks
|
||||||
|
@ -265,8 +264,7 @@ adjustExportImport r rs = case getRemoteConfigValue exportTreeField (config r) o
|
||||||
lcklckv <- liftIO newEmptyTMVarIO
|
lcklckv <- liftIO newEmptyTMVarIO
|
||||||
dbv <- liftIO newEmptyTMVarIO
|
dbv <- liftIO newEmptyTMVarIO
|
||||||
exportinconflict <- liftIO $ newTVarIO False
|
exportinconflict <- liftIO $ newTVarIO False
|
||||||
exportupdated <- liftIO $ newTMVarIO ()
|
return (dbv, lcklckv, exportinconflict)
|
||||||
return (dbv, lcklckv, exportinconflict, exportupdated)
|
|
||||||
|
|
||||||
-- Only open the database once it's needed.
|
-- Only open the database once it's needed.
|
||||||
getciddb (dbtv, lcklckv) =
|
getciddb (dbtv, lcklckv) =
|
||||||
|
@ -288,13 +286,18 @@ adjustExportImport r rs = case getRemoteConfigValue exportTreeField (config r) o
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Only open the database once it's needed.
|
-- Only open the database once it's needed.
|
||||||
getexportdb (dbv, lcklckv, _, _) =
|
--
|
||||||
|
-- After opening the database, check if the export log is
|
||||||
|
-- different than the database, and update the database, to notice
|
||||||
|
-- when an export has been updated from another repository.
|
||||||
|
getexportdb (dbv, lcklckv, exportinconflict) =
|
||||||
liftIO (atomically (tryReadTMVar dbv)) >>= \case
|
liftIO (atomically (tryReadTMVar dbv)) >>= \case
|
||||||
Just db -> return db
|
Just db -> return db
|
||||||
-- let only one thread take the lock
|
-- let only one thread take the lock
|
||||||
Nothing -> ifM (liftIO $ atomically $ tryPutTMVar lcklckv ())
|
Nothing -> ifM (liftIO $ atomically $ tryPutTMVar lcklckv ())
|
||||||
( do
|
( do
|
||||||
db <- Export.openDb (uuid r)
|
db <- Export.openDb (uuid r)
|
||||||
|
updateexportdb db exportinconflict
|
||||||
liftIO $ atomically $ putTMVar dbv db
|
liftIO $ atomically $ putTMVar dbv db
|
||||||
return db
|
return db
|
||||||
-- loser waits for winner to open the db and
|
-- loser waits for winner to open the db and
|
||||||
|
@ -302,24 +305,18 @@ adjustExportImport r rs = case getRemoteConfigValue exportTreeField (config r) o
|
||||||
, liftIO $ atomically (readTMVar dbv)
|
, liftIO $ atomically (readTMVar dbv)
|
||||||
)
|
)
|
||||||
|
|
||||||
getexportinconflict (_, _, v, _) = v
|
getexportinconflict (_, _, v) = v
|
||||||
|
|
||||||
-- Check once if the export log is different than the database and
|
updateexportdb db exportinconflict =
|
||||||
-- updates the database, to notice when an export has been
|
Export.updateExportTreeFromLog db >>= \case
|
||||||
-- updated from another repository.
|
Export.ExportUpdateSuccess -> return ()
|
||||||
updateexportdb db (_, _, exportinconflict, exportupdated) =
|
Export.ExportUpdateConflict -> do
|
||||||
liftIO (atomically (tryTakeTMVar exportupdated)) >>= \case
|
warnExportImportConflict r
|
||||||
Just () -> Export.updateExportTreeFromLog db >>= \case
|
liftIO $ atomically $
|
||||||
Export.ExportUpdateSuccess -> return ()
|
writeTVar exportinconflict True
|
||||||
Export.ExportUpdateConflict -> do
|
|
||||||
warnExportImportConflict r
|
|
||||||
liftIO $ atomically $
|
|
||||||
writeTVar exportinconflict True
|
|
||||||
Nothing -> return ()
|
|
||||||
|
|
||||||
getexportlocs dbv k = do
|
getexportlocs dbv k = do
|
||||||
db <- getexportdb dbv
|
db <- getexportdb dbv
|
||||||
updateexportdb db dbv
|
|
||||||
liftIO $ Export.getExportTree db k
|
liftIO $ Export.getExportTree db k
|
||||||
|
|
||||||
retrieveKeyFileFromExport dbv k _af dest p = unVerified $
|
retrieveKeyFileFromExport dbv k _af dest p = unVerified $
|
||||||
|
|
|
@ -89,3 +89,5 @@ get sub-01/meg/sub-01_task-audiovisual_run-01_meg.fif (from s3-PUBLIC...)
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
[[!tag projects/repronim]]
|
[[!tag projects/repronim]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 4"""
|
||||||
|
date="2020-02-26T18:22:46Z"
|
||||||
|
content="""
|
||||||
|
How do I produce such a repo, I thought that git-annex has fixed the
|
||||||
|
problem that made it not include the S3 versioning information?
|
||||||
|
I don't want to see a lot of repos being created with that information
|
||||||
|
missing.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
Anyway, the S3 version is is a red herring, the failure is actually
|
||||||
|
caused by the export db not getting populated from the git-annex branch
|
||||||
|
before some threads try to use it. Remote.Helper.ExportImport has a
|
||||||
|
updateexportdb that lets one thread update the db, but other threads
|
||||||
|
don't block waiting for it. Easily fixed.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue