use new name for new format content identifier db

It will be populated automatically by the next command that needs data
from it, the same way it gets populated in a fresh clone. That may be a
little expensive, but it's a one time cost, and no slower than in a
fresh clone.
This commit is contained in:
Joey Hess 2019-11-06 16:43:52 -04:00
parent 1b5f4b67b5
commit 3b820f08f7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 20 additions and 2 deletions

View file

@ -375,7 +375,7 @@ gitAnnexExportExcludeLog u r = gitAnnexDir r </> "export.ex" </> fromUUID u
- need to be rebuilt with a new name.)
-}
gitAnnexContentIdentifierDbDir :: Git.Repo -> FilePath
gitAnnexContentIdentifierDbDir r = gitAnnexDir r </> "cids"
gitAnnexContentIdentifierDbDir r = gitAnnexDir r </> "cidsdb"
{- Lock file for writing to the content id database. -}
gitAnnexContentIdentifierLock :: Git.Repo -> FilePath

View file

@ -13,6 +13,7 @@ import Annex.Common
import Annex.CatFile
import qualified Database.Keys
import qualified Database.Keys.SQL
import qualified Database.ContentIdentifier
import qualified Git.LsFiles as LsFiles
import qualified Git
import Git.FilePath
@ -23,10 +24,17 @@ upgrade automatic = do
showAction "v7 to v8"
populateKeysDb
-- The fsck databases are not transitioned here; any running
-- incremental fsck can continue to write to the old database.
-- The next time an incremental fsck is started, it will delete the
-- old database, and just re-fsck the files.
-- The old content identifier database is deleted here, but the
-- new database is not populated. It will be automatically
-- populated from the git-annex branch the next time it is used.
removeOldDb gitAnnexContentIdentifierDbDirOld
liftIO . nukeFile =<< fromRepo gitAnnexContentIdentifierLockOld
removeOldDb gitAnnexKeysDbOld
liftIO . nukeFile =<< fromRepo gitAnnexKeysDbIndexCacheOld
@ -43,6 +51,12 @@ gitAnnexKeysDbLockOld r = gitAnnexKeysDbOld r ++ ".lck"
gitAnnexKeysDbIndexCacheOld :: Git.Repo -> FilePath
gitAnnexKeysDbIndexCacheOld r = gitAnnexKeysDbOld r ++ ".cache"
gitAnnexContentIdentifierDbDirOld :: Git.Repo -> FilePath
gitAnnexContentIdentifierDbDirOld r = gitAnnexDir r </> "cids"
gitAnnexContentIdentifierLockOld :: Git.Repo -> FilePath
gitAnnexContentIdentifierLockOld r = gitAnnexContentIdentifierDbDirOld r ++ ".lck"
removeOldDb :: (Git.Repo -> FilePath) -> Annex ()
removeOldDb getdb = do
db <- fromRepo getdb
@ -91,3 +105,4 @@ populateKeysDb = do
Database.Keys.SQL.addInodeCaches k [ic] h
liftIO $ void cleanup
Database.Keys.closeDb

View file

@ -98,8 +98,11 @@ remaining todo:
> (done)
> * ContentIdentifier (IKey)
> rebuild with updateFromLog, would need to diff from empty tree to
> rebuild with updateFromLog, will need to diff from empty tree to
> current git-annex branch, may be expensive to do!
(done; will be done automatically by the first command that needs to
use the db)
>
> * Export (IKey, SFilePath)
> difficult to rebuild, what if in the middle of an interrupted