display new empty repos in maxsize table
A new repo that has no location log info yet, but has an entry in uuid.log has 0 size, so make RepoSize aware of that. Note that a new repo that does not yet appear in uuid.log will still not be displayed. When a remote is added but not synced with yet, it has no uuid.log entry. If git-annex maxsize is used to configure that remote, it needs to appear in the maxsize table, and the change to Command.MaxSize takes care of that.
This commit is contained in:
parent
a643699b7b
commit
3fe67744b1
3 changed files with 23 additions and 23 deletions
|
@ -126,7 +126,9 @@ diffBranchRepoSizes quiet oldsizemap oldbranchsha newbranchsha = do
|
||||||
newsizemap <- readpairs 100000 reader oldsizemap Nothing
|
newsizemap <- readpairs 100000 reader oldsizemap Nothing
|
||||||
liftIO $ wait feedtid
|
liftIO $ wait feedtid
|
||||||
ifM (liftIO cleanup)
|
ifM (liftIO cleanup)
|
||||||
( return (newsizemap, newbranchsha)
|
( do
|
||||||
|
newsizemap' <- addemptyrepos newsizemap
|
||||||
|
return (newsizemap', newbranchsha)
|
||||||
, return (oldsizemap, oldbranchsha)
|
, return (oldsizemap, oldbranchsha)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
@ -156,3 +158,10 @@ diffBranchRepoSizes quiet oldsizemap oldbranchsha newbranchsha = do
|
||||||
readpairs n' reader sizemap' Nothing
|
readpairs n' reader sizemap' Nothing
|
||||||
Nothing -> return sizemap
|
Nothing -> return sizemap
|
||||||
parselog = maybe mempty (S.fromList . parseLoggedLocationsWithoutClusters)
|
parselog = maybe mempty (S.fromList . parseLoggedLocationsWithoutClusters)
|
||||||
|
|
||||||
|
addemptyrepos newsizemap = do
|
||||||
|
knownuuids <- M.keys <$> uuidDescMap
|
||||||
|
return $ foldl'
|
||||||
|
(\m u -> M.insertWith (flip const) u (RepoSize 0) m)
|
||||||
|
newsizemap
|
||||||
|
knownuuids
|
||||||
|
|
|
@ -76,9 +76,16 @@ sizeOverview o = do
|
||||||
descmap <- Remote.uuidDescriptions
|
descmap <- Remote.uuidDescriptions
|
||||||
deadset <- S.fromList <$> trustGet DeadTrusted
|
deadset <- S.fromList <$> trustGet DeadTrusted
|
||||||
maxsizes <- getMaxSizes
|
maxsizes <- getMaxSizes
|
||||||
reposizes <- flip M.withoutKeys deadset <$> getRepoSizes True
|
reposizes <- getRepoSizes True
|
||||||
|
-- Add repos too new and empty to have a reposize,
|
||||||
|
-- whose maxsize has been set.
|
||||||
|
let reposizes' = foldl'
|
||||||
|
(\m u -> M.insertWith (flip const) u (RepoSize 0) m)
|
||||||
|
reposizes
|
||||||
|
(M.keys maxsizes)
|
||||||
|
let reposizes'' = flip M.withoutKeys deadset reposizes'
|
||||||
let l = reverse $ sortOn snd $ M.toList $
|
let l = reverse $ sortOn snd $ M.toList $
|
||||||
M.mapWithKey (gather maxsizes) reposizes
|
M.mapWithKey (gather maxsizes) reposizes''
|
||||||
v <- Remote.prettyPrintUUIDsWith' False (Just "size")
|
v <- Remote.prettyPrintUUIDsWith' False (Just "size")
|
||||||
"repositories" descmap showsizes l
|
"repositories" descmap showsizes l
|
||||||
showRaw $ encodeBS $ tablerow (zip widths headers)
|
showRaw $ encodeBS $ tablerow (zip widths headers)
|
||||||
|
@ -89,11 +96,10 @@ sizeOverview o = do
|
||||||
sizefield = "size" :: T.Text
|
sizefield = "size" :: T.Text
|
||||||
maxsizefield = "maxsize" :: T.Text
|
maxsizefield = "maxsize" :: T.Text
|
||||||
|
|
||||||
gather maxsizes u (RepoSize currsize) = Just $
|
gather maxsizes u (RepoSize currsize) = Just $ M.fromList
|
||||||
M.fromList
|
[ (sizefield, Just currsize)
|
||||||
[ (sizefield, Just currsize)
|
, (maxsizefield, fromMaxSize <$> M.lookup u maxsizes)
|
||||||
, (maxsizefield, fromMaxSize <$> M.lookup u maxsizes)
|
]
|
||||||
]
|
|
||||||
|
|
||||||
(widths, headers) = unzip
|
(widths, headers) = unzip
|
||||||
[ (7, "size")
|
[ (7, "size")
|
||||||
|
|
|
@ -35,21 +35,6 @@ Planned schedule of work:
|
||||||
* `git-annex assist --rebalance` of `balanced=foo:2`
|
* `git-annex assist --rebalance` of `balanced=foo:2`
|
||||||
sometimes needs several runs to stabalize.
|
sometimes needs several runs to stabalize.
|
||||||
|
|
||||||
* Bug:
|
|
||||||
|
|
||||||
git init foo
|
|
||||||
cd foo
|
|
||||||
git-annex init
|
|
||||||
git commit --allow-empty -m foo
|
|
||||||
cd ..
|
|
||||||
git clone foo bar
|
|
||||||
cd foo
|
|
||||||
git remote add bar ../bar
|
|
||||||
git-annex maxsize bar
|
|
||||||
|
|
||||||
Now `git-annex maxsize` will omit displaying bar. This is because the
|
|
||||||
DB got written without it.
|
|
||||||
|
|
||||||
* Concurrency issues with RepoSizes calculation and balanced content:
|
* Concurrency issues with RepoSizes calculation and balanced content:
|
||||||
|
|
||||||
* What if 2 concurrent threads are considering sending two different
|
* What if 2 concurrent threads are considering sending two different
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue