add annex.dbdir (WIP)

WIP: This is mostly complete, but there is a problem: createDirectoryUnder
throws an error when annex.dbdir is set to outside the git repo.

annex.dbdir is a workaround for filesystems where sqlite does not work,
due to eg, the filesystem not properly supporting locking.

It's intended to be set before initializing the repository. Changing it
in an existing repository can be done, but would be the same as making a
new repository and moving all the annexed objects into it. While the
databases get recreated from the git-annex branch in that situation, any
information that is in the databases but not stored in the branch gets
lost. It may be that no information ever gets stored in the databases
that cannot be reconstructed from the branch, but I have not verified
that.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-08-11 16:57:44 -04:00
parent 425deaf615
commit e60766543f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
26 changed files with 152 additions and 104 deletions

View file

@ -375,12 +375,14 @@ logMove srcuuid destuuid deststartedwithcopy key a = go =<< setup
setup = do
logf <- fromRepo gitAnnexMoveLog
lckf <- fromRepo gitAnnexMoveLock
-- Only log when there was no copy.
unless deststartedwithcopy $
appendLogFile logf gitAnnexMoveLock logline
appendLogFile logf lckf logline
return logf
cleanup logf = do
lck <- fromRepo gitAnnexMoveLock
-- This buffers the log file content in memory.
-- The log file length is limited to the number of
-- concurrent jobs, times the number of times a move
@ -388,13 +390,14 @@ logMove srcuuid destuuid deststartedwithcopy key a = go =<< setup
-- That could grow without bounds given enough time,
-- so the log is also truncated to the most recent
-- 100 items.
modifyLogFile logf gitAnnexMoveLock
modifyLogFile logf lck
(filter (/= logline) . reverse . take 100 . reverse)
go logf
-- Only need to check log when there is a copy.
| deststartedwithcopy = do
wasnocopy <- checkLogFile (fromRawFilePath logf) gitAnnexMoveLock
lck <- fromRepo gitAnnexMoveLock
wasnocopy <- checkLogFile (fromRawFilePath logf) lck
(== logline)
if wasnocopy
then go' logf False