consistently omit clusters when calculating RepoSizes
updateRepoSize is only called on the UUID of a repository, not any cluster it might be a node of. But overLocationLogs and overLocationLogsJournal were inclusing cluster UUIDs. So it was inconsistent. Currently I don't see any reason to calculate RepoSize for a cluster. It's not even clear what it should mean, the total size of all nodes, or the amount of information stored in the cluster in total?
This commit is contained in:
parent
61d95627f3
commit
8239824d92
4 changed files with 30 additions and 13 deletions
|
@ -85,7 +85,7 @@ calcBranchRepoSizes :: Annex (M.Map UUID RepoSize, Sha)
|
||||||
calcBranchRepoSizes = do
|
calcBranchRepoSizes = do
|
||||||
knownuuids <- M.keys <$> uuidDescMap
|
knownuuids <- M.keys <$> uuidDescMap
|
||||||
let startmap = M.fromList $ map (\u -> (u, RepoSize 0)) knownuuids
|
let startmap = M.fromList $ map (\u -> (u, RepoSize 0)) knownuuids
|
||||||
overLocationLogs True startmap accumsizes >>= \case
|
overLocationLogs True True startmap accumsizes >>= \case
|
||||||
UnmergedBranches v -> return v
|
UnmergedBranches v -> return v
|
||||||
NoUnmergedBranches v -> return v
|
NoUnmergedBranches v -> return v
|
||||||
where
|
where
|
||||||
|
@ -100,7 +100,7 @@ calcJournalledRepoSizes
|
||||||
-> Sha
|
-> Sha
|
||||||
-> Annex (M.Map UUID RepoSize)
|
-> Annex (M.Map UUID RepoSize)
|
||||||
calcJournalledRepoSizes startmap branchsha =
|
calcJournalledRepoSizes startmap branchsha =
|
||||||
overLocationLogsJournal startmap branchsha accumsizes
|
overLocationLogsJournal startmap branchsha accumsizes Nothing
|
||||||
where
|
where
|
||||||
accumsizes k (newlocs, removedlocs) m = return $
|
accumsizes k (newlocs, removedlocs) m = return $
|
||||||
let m' = foldl' (flip $ M.alter $ addKeyRepoSize k) m newlocs
|
let m' = foldl' (flip $ M.alter $ addKeyRepoSize k) m newlocs
|
||||||
|
|
|
@ -284,7 +284,7 @@ withKeyOptions' ko auto mkkeyaction fallbackaction worktreeitems = do
|
||||||
let discard reader = reader >>= \case
|
let discard reader = reader >>= \case
|
||||||
Nothing -> noop
|
Nothing -> noop
|
||||||
Just _ -> discard reader
|
Just _ -> discard reader
|
||||||
overLocationLogs' False ()
|
overLocationLogs' False False ()
|
||||||
(\reader cont -> checktimelimit (discard reader) cont)
|
(\reader cont -> checktimelimit (discard reader) cont)
|
||||||
(\k _ () -> keyaction Nothing (SeekInput [], k, mkActionItem k))
|
(\k _ () -> keyaction Nothing (SeekInput [], k, mkActionItem k))
|
||||||
>>= \case
|
>>= \case
|
||||||
|
|
|
@ -641,7 +641,7 @@ cachedAllRepoData = do
|
||||||
Just _ -> return s
|
Just _ -> return s
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
matcher <- lift getKeyOnlyMatcher
|
matcher <- lift getKeyOnlyMatcher
|
||||||
r <- lift $ overLocationLogs False (emptyKeyInfo, mempty) $ \k locs (d, rd) -> do
|
r <- lift $ overLocationLogs False False (emptyKeyInfo, mempty) $ \k locs (d, rd) -> do
|
||||||
ifM (matchOnKey matcher k)
|
ifM (matchOnKey matcher k)
|
||||||
( do
|
( do
|
||||||
alivelocs <- snd
|
alivelocs <- snd
|
||||||
|
|
|
@ -112,7 +112,11 @@ loggedLocationsRef ref = map (toUUID . fromLogInfo) . getLog <$> catObject ref
|
||||||
|
|
||||||
{- Parses the content of a log file and gets the locations in it. -}
|
{- Parses the content of a log file and gets the locations in it. -}
|
||||||
parseLoggedLocations :: Clusters -> L.ByteString -> [UUID]
|
parseLoggedLocations :: Clusters -> L.ByteString -> [UUID]
|
||||||
parseLoggedLocations clusters l = addClusterUUIDs clusters $
|
parseLoggedLocations clusters =
|
||||||
|
addClusterUUIDs clusters . parseLoggedLocationsWithoutClusters
|
||||||
|
|
||||||
|
parseLoggedLocationsWithoutClusters :: L.ByteString -> [UUID]
|
||||||
|
parseLoggedLocationsWithoutClusters l =
|
||||||
map (toUUID . fromLogInfo . info)
|
map (toUUID . fromLogInfo . info)
|
||||||
(filterPresent (parseLog l))
|
(filterPresent (parseLog l))
|
||||||
|
|
||||||
|
@ -226,23 +230,30 @@ loggedKeysFor' u = loggedKeys' isthere
|
||||||
{- This is much faster than loggedKeys. -}
|
{- This is much faster than loggedKeys. -}
|
||||||
overLocationLogs
|
overLocationLogs
|
||||||
:: Bool
|
:: Bool
|
||||||
|
-> Bool
|
||||||
-> v
|
-> v
|
||||||
-> (Key -> [UUID] -> v -> Annex v)
|
-> (Key -> [UUID] -> v -> Annex v)
|
||||||
-> Annex (Annex.Branch.UnmergedBranches (v, Sha))
|
-> Annex (Annex.Branch.UnmergedBranches (v, Sha))
|
||||||
overLocationLogs ignorejournal v =
|
overLocationLogs ignorejournal noclusters v =
|
||||||
overLocationLogs' ignorejournal v (flip const)
|
overLocationLogs' ignorejournal noclusters v (flip const)
|
||||||
|
|
||||||
overLocationLogs'
|
overLocationLogs'
|
||||||
:: Bool
|
:: Bool
|
||||||
|
-> Bool
|
||||||
-> v
|
-> v
|
||||||
-> (Annex (FileContents Key Bool) -> Annex v -> Annex v)
|
-> (Annex (FileContents Key Bool) -> Annex v -> Annex v)
|
||||||
-> (Key -> [UUID] -> v -> Annex v)
|
-> (Key -> [UUID] -> v -> Annex v)
|
||||||
-> Annex (Annex.Branch.UnmergedBranches (v, Sha))
|
-> Annex (Annex.Branch.UnmergedBranches (v, Sha))
|
||||||
overLocationLogs' ignorejournal =
|
overLocationLogs' ignorejournal noclusters iv discarder keyaction = do
|
||||||
|
mclusters <- if noclusters then pure Nothing else Just <$> getClusters
|
||||||
overLocationLogsHelper
|
overLocationLogsHelper
|
||||||
(Annex.Branch.overBranchFileContents ignorejournal)
|
(Annex.Branch.overBranchFileContents ignorejournal)
|
||||||
(\locparser _ _ content -> pure (locparser (fst <$> content)))
|
(\locparser _ _ content -> pure (locparser (fst <$> content)))
|
||||||
True
|
True
|
||||||
|
iv
|
||||||
|
discarder
|
||||||
|
keyaction
|
||||||
|
mclusters
|
||||||
|
|
||||||
type LocChanges =
|
type LocChanges =
|
||||||
( S.Set UUID
|
( S.Set UUID
|
||||||
|
@ -260,14 +271,16 @@ overLocationLogsJournal
|
||||||
:: v
|
:: v
|
||||||
-> Sha
|
-> Sha
|
||||||
-> (Key -> LocChanges -> v -> Annex v)
|
-> (Key -> LocChanges -> v -> Annex v)
|
||||||
|
-> Maybe Clusters
|
||||||
-> Annex v
|
-> Annex v
|
||||||
overLocationLogsJournal v branchsha keyaction =
|
overLocationLogsJournal v branchsha keyaction mclusters =
|
||||||
overLocationLogsHelper
|
overLocationLogsHelper
|
||||||
(Annex.Branch.overJournalFileContents handlestale)
|
(Annex.Branch.overJournalFileContents handlestale)
|
||||||
changedlocs
|
changedlocs
|
||||||
False
|
False
|
||||||
-- ^ do not precache journalled content, which may be stale
|
-- ^ do not precache journalled content, which may be stale
|
||||||
v (flip const) keyaction
|
v (flip const) keyaction
|
||||||
|
mclusters
|
||||||
where
|
where
|
||||||
handlestale _ journalcontent = return (journalcontent, Just True)
|
handlestale _ journalcontent = return (journalcontent, Just True)
|
||||||
|
|
||||||
|
@ -291,12 +304,16 @@ overLocationLogsHelper
|
||||||
-> v
|
-> v
|
||||||
-> (Annex (FileContents Key b) -> Annex v -> Annex v)
|
-> (Annex (FileContents Key b) -> Annex v -> Annex v)
|
||||||
-> (Key -> u -> v -> Annex v)
|
-> (Key -> u -> v -> Annex v)
|
||||||
|
-> (Maybe Clusters)
|
||||||
-> Annex a
|
-> Annex a
|
||||||
overLocationLogsHelper runner locparserrunner canprecache iv discarder keyaction = do
|
overLocationLogsHelper runner locparserrunner canprecache iv discarder keyaction mclusters = do
|
||||||
config <- Annex.getGitConfig
|
config <- Annex.getGitConfig
|
||||||
clusters <- getClusters
|
|
||||||
|
|
||||||
let locparser = maybe [] (parseLoggedLocations clusters)
|
let locparser = maybe
|
||||||
|
parseLoggedLocationsWithoutClusters
|
||||||
|
parseLoggedLocations
|
||||||
|
mclusters
|
||||||
|
let locparser' = maybe [] locparser
|
||||||
let getk = locationLogFileKey config
|
let getk = locationLogFileKey config
|
||||||
let go v reader = reader >>= \case
|
let go v reader = reader >>= \case
|
||||||
Just (k, f, content) -> discarder reader $ do
|
Just (k, f, content) -> discarder reader $ do
|
||||||
|
@ -307,7 +324,7 @@ overLocationLogsHelper runner locparserrunner canprecache iv discarder keyaction
|
||||||
ifM (checkDead k)
|
ifM (checkDead k)
|
||||||
( go v reader
|
( go v reader
|
||||||
, do
|
, do
|
||||||
!locs <- locparserrunner locparser k f content
|
!locs <- locparserrunner locparser' k f content
|
||||||
!v' <- keyaction k locs v
|
!v' <- keyaction k locs v
|
||||||
go v' reader
|
go v' reader
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue