diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 6cfe0469fc..725415c23a 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -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 diff --git a/Upgrade/V7.hs b/Upgrade/V7.hs index 0d06614b26..a3199f57c4 100644 --- a/Upgrade/V7.hs +++ b/Upgrade/V7.hs @@ -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 + diff --git a/doc/todo/sqlite_database_improvements.mdwn b/doc/todo/sqlite_database_improvements.mdwn index 17997d6d43..acc12ebf99 100644 --- a/doc/todo/sqlite_database_improvements.mdwn +++ b/doc/todo/sqlite_database_improvements.mdwn @@ -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