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:
parent
1b5f4b67b5
commit
3b820f08f7
3 changed files with 20 additions and 2 deletions
|
@ -375,7 +375,7 @@ gitAnnexExportExcludeLog u r = gitAnnexDir r </> "export.ex" </> fromUUID u
|
||||||
- need to be rebuilt with a new name.)
|
- need to be rebuilt with a new name.)
|
||||||
-}
|
-}
|
||||||
gitAnnexContentIdentifierDbDir :: Git.Repo -> FilePath
|
gitAnnexContentIdentifierDbDir :: Git.Repo -> FilePath
|
||||||
gitAnnexContentIdentifierDbDir r = gitAnnexDir r </> "cids"
|
gitAnnexContentIdentifierDbDir r = gitAnnexDir r </> "cidsdb"
|
||||||
|
|
||||||
{- Lock file for writing to the content id database. -}
|
{- Lock file for writing to the content id database. -}
|
||||||
gitAnnexContentIdentifierLock :: Git.Repo -> FilePath
|
gitAnnexContentIdentifierLock :: Git.Repo -> FilePath
|
||||||
|
|
|
@ -13,6 +13,7 @@ import Annex.Common
|
||||||
import Annex.CatFile
|
import Annex.CatFile
|
||||||
import qualified Database.Keys
|
import qualified Database.Keys
|
||||||
import qualified Database.Keys.SQL
|
import qualified Database.Keys.SQL
|
||||||
|
import qualified Database.ContentIdentifier
|
||||||
import qualified Git.LsFiles as LsFiles
|
import qualified Git.LsFiles as LsFiles
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import Git.FilePath
|
import Git.FilePath
|
||||||
|
@ -23,10 +24,17 @@ upgrade automatic = do
|
||||||
showAction "v7 to v8"
|
showAction "v7 to v8"
|
||||||
|
|
||||||
populateKeysDb
|
populateKeysDb
|
||||||
|
|
||||||
-- The fsck databases are not transitioned here; any running
|
-- The fsck databases are not transitioned here; any running
|
||||||
-- incremental fsck can continue to write to the old database.
|
-- incremental fsck can continue to write to the old database.
|
||||||
-- The next time an incremental fsck is started, it will delete the
|
-- The next time an incremental fsck is started, it will delete the
|
||||||
-- old database, and just re-fsck the files.
|
-- 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
|
removeOldDb gitAnnexKeysDbOld
|
||||||
liftIO . nukeFile =<< fromRepo gitAnnexKeysDbIndexCacheOld
|
liftIO . nukeFile =<< fromRepo gitAnnexKeysDbIndexCacheOld
|
||||||
|
@ -43,6 +51,12 @@ gitAnnexKeysDbLockOld r = gitAnnexKeysDbOld r ++ ".lck"
|
||||||
gitAnnexKeysDbIndexCacheOld :: Git.Repo -> FilePath
|
gitAnnexKeysDbIndexCacheOld :: Git.Repo -> FilePath
|
||||||
gitAnnexKeysDbIndexCacheOld r = gitAnnexKeysDbOld r ++ ".cache"
|
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 :: (Git.Repo -> FilePath) -> Annex ()
|
||||||
removeOldDb getdb = do
|
removeOldDb getdb = do
|
||||||
db <- fromRepo getdb
|
db <- fromRepo getdb
|
||||||
|
@ -91,3 +105,4 @@ populateKeysDb = do
|
||||||
Database.Keys.SQL.addInodeCaches k [ic] h
|
Database.Keys.SQL.addInodeCaches k [ic] h
|
||||||
liftIO $ void cleanup
|
liftIO $ void cleanup
|
||||||
Database.Keys.closeDb
|
Database.Keys.closeDb
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,11 @@ remaining todo:
|
||||||
> (done)
|
> (done)
|
||||||
|
|
||||||
> * ContentIdentifier (IKey)
|
> * 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!
|
> 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)
|
> * Export (IKey, SFilePath)
|
||||||
> difficult to rebuild, what if in the middle of an interrupted
|
> difficult to rebuild, what if in the middle of an interrupted
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue