remotefilelog: increase incremental repack to pack 3 at once

Summary:
Previously we tried to keep incremental repacks small by only allowing 2 packs
to be repacked at once. This causes problems with treemanifest since hg pull
could create a pack file, which then gets repacked with a single other pack
file. This meant the total number of packs did not decrease. Let's increases the
number of files we pack at once to 3 so we can guarantee that a repack after
adding a pack still decreases the total number.

Test Plan:
Ran a local tree repack that was previously only causing two files to
be repacked. Now it repacked three files.

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5287238

Signature: t1:5287238:1497995177:54e229b564137ddc35ea28fd3d649a1085de0c72
This commit is contained in:
Durham Goode 2017-06-21 16:59:44 -07:00
parent fb10004ee8
commit cbc8579872

View File

@ -225,9 +225,10 @@ def _computeincrementalpack(ui, files, limits, packsuffix, indexsuffix,
# Find the largest generation with more than 2 packs and repack it.
for i, limit in enumerate(limits):
if len(generations[i]) > gencountlimit:
# Generally we only want to repack 2 things at once, but if the
# whole generation is small, let's just do it all!
count = 2
# Try to repack 3 things at once. This means if we run an
# incremental repack right after we add a new pack file, we'll still
# decrease the total number of pack files.
count = 3
if sum(sizes[n] for n in generations[i]) < repacksizelimit:
count = len(generations[i])
return sorted(generations[i], key=lambda x: sizes[x])[:count]