Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 14365:a8e3931e3fb5
revlog: linearize created changegroups in generaldelta revlogs
This greatly improves the speed of the bundling process, and often reduces the
bundle size considerably. (Although if the repository is already ordered, this
has little effect on both time and bundle size.)
For non-generaldelta clients, the reduced bundle size translates to a reduced
repository size, similar to shrinking the revlogs (which uses the exact same
algorithm). For generaldelta clients the difference is minor.
When the new bundle format comes, reordering will not be necessary since we
can then store the deltaparent relationsships directly. The eventual default
behavior for clients and servers is presented in the table below, where "new"
implies support for GD as well as the new bundle format:
old client new client
old server old bundle, no reorder old bundle, no reorder
new server, non-GD old bundle, no reorder[1] old bundle, no reorder[2]
new server, GD old bundle, reorder[3] new bundle, no reorder[4]
[1] reordering is expensive on the server in this case, skip it
[2] client can choose to do its own redelta here
[3] reordering is needed because otherwise the pull does a lot of extra
work on the server
[4] reordering isn't needed because client can get deltabase in bundle
format
Currently, the default is to reorder on GD-servers, and not otherwise. A new
setting, bundle.reorder, has been added to override the default reordering
behavior. It can be set to either 'auto' (the default), or any true or false
value as a standard boolean setting, to either force the reordering on or off
regardless of generaldelta.
Some timing data from a relatively branch test repository follows. All
bundling is done with --all --type none options.
Non-generaldelta, non-shrunk repo:
-----------------------------------
Size: 276M
Without reorder (default):
Bundle time: 14.4 seconds
Bundle size: 939M
With reorder:
Bundle time: 1 minute, 29.3 seconds
Bundle size: 381M
Generaldelta, non-shrunk repo:
-----------------------------------
Size: 87M
Without reorder:
Bundle time: 2 minutes, 1.4 seconds
Bundle size: 939M
With reorder (default):
Bundle time: 25.5 seconds
Bundle size: 381M
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Wed, 18 May 2011 23:26:26 +0200 |
parents | 82f3b0f3f0a5 |
children | cc8c09855d19 |
comparison
equal
deleted
inserted
replaced
14364:a3b9f1bddab1 | 14365:a8e3931e3fb5 |
---|---|
1542 _('bundling'), count[0], item=fstate[0], | 1542 _('bundling'), count[0], item=fstate[0], |
1543 unit=_('files'), total=len(changedfiles)) | 1543 unit=_('files'), total=len(changedfiles)) |
1544 return fstate[1][x] | 1544 return fstate[1][x] |
1545 | 1545 |
1546 bundler = changegroup.bundle10(lookup) | 1546 bundler = changegroup.bundle10(lookup) |
1547 reorder = self.ui.config('bundle', 'reorder', 'auto') | |
1548 if reorder == 'auto': | |
1549 reorder = None | |
1550 else: | |
1551 reorder = util.parsebool(reorder) | |
1547 | 1552 |
1548 def gengroup(): | 1553 def gengroup(): |
1549 # Create a changenode group generator that will call our functions | 1554 # Create a changenode group generator that will call our functions |
1550 # back to lookup the owning changenode and collect information. | 1555 # back to lookup the owning changenode and collect information. |
1551 for chunk in cl.group(csets, bundler): | 1556 for chunk in cl.group(csets, bundler, reorder=reorder): |
1552 yield chunk | 1557 yield chunk |
1553 self.ui.progress(_('bundling'), None) | 1558 self.ui.progress(_('bundling'), None) |
1554 | 1559 |
1555 # Create a generator for the manifestnodes that calls our lookup | 1560 # Create a generator for the manifestnodes that calls our lookup |
1556 # and data collection functions back. | 1561 # and data collection functions back. |
1557 count[0] = 0 | 1562 count[0] = 0 |
1558 for chunk in mf.group(prune(mf, mfs), bundler): | 1563 for chunk in mf.group(prune(mf, mfs), bundler, reorder=reorder): |
1559 yield chunk | 1564 yield chunk |
1560 self.ui.progress(_('bundling'), None) | 1565 self.ui.progress(_('bundling'), None) |
1561 | 1566 |
1562 mfs.clear() | 1567 mfs.clear() |
1563 | 1568 |
1570 fstate[0] = fname | 1575 fstate[0] = fname |
1571 fstate[1] = fnodes.pop(fname, {}) | 1576 fstate[1] = fnodes.pop(fname, {}) |
1572 first = True | 1577 first = True |
1573 | 1578 |
1574 for chunk in filerevlog.group(prune(filerevlog, fstate[1]), | 1579 for chunk in filerevlog.group(prune(filerevlog, fstate[1]), |
1575 bundler): | 1580 bundler, reorder=reorder): |
1576 if first: | 1581 if first: |
1577 if chunk == bundler.close(): | 1582 if chunk == bundler.close(): |
1578 break | 1583 break |
1579 count[0] += 1 | 1584 count[0] += 1 |
1580 yield bundler.fileheader(fname) | 1585 yield bundler.fileheader(fname) |
1638 _('bundling'), count[0], item=fstate[0], | 1643 _('bundling'), count[0], item=fstate[0], |
1639 total=len(changedfiles), unit=_('files')) | 1644 total=len(changedfiles), unit=_('files')) |
1640 return cl.node(revlog.linkrev(revlog.rev(x))) | 1645 return cl.node(revlog.linkrev(revlog.rev(x))) |
1641 | 1646 |
1642 bundler = changegroup.bundle10(lookup) | 1647 bundler = changegroup.bundle10(lookup) |
1648 reorder = self.ui.config('bundle', 'reorder', 'auto') | |
1649 if reorder == 'auto': | |
1650 reorder = None | |
1651 else: | |
1652 reorder = util.parsebool(reorder) | |
1643 | 1653 |
1644 def gengroup(): | 1654 def gengroup(): |
1645 '''yield a sequence of changegroup chunks (strings)''' | 1655 '''yield a sequence of changegroup chunks (strings)''' |
1646 # construct a list of all changed files | 1656 # construct a list of all changed files |
1647 | 1657 |
1648 for chunk in cl.group(nodes, bundler): | 1658 for chunk in cl.group(nodes, bundler, reorder=reorder): |
1649 yield chunk | 1659 yield chunk |
1650 self.ui.progress(_('bundling'), None) | 1660 self.ui.progress(_('bundling'), None) |
1651 | 1661 |
1652 count[0] = 0 | 1662 count[0] = 0 |
1653 for chunk in mf.group(gennodelst(mf), bundler): | 1663 for chunk in mf.group(gennodelst(mf), bundler, reorder=reorder): |
1654 yield chunk | 1664 yield chunk |
1655 self.ui.progress(_('bundling'), None) | 1665 self.ui.progress(_('bundling'), None) |
1656 | 1666 |
1657 count[0] = 0 | 1667 count[0] = 0 |
1658 for fname in sorted(changedfiles): | 1668 for fname in sorted(changedfiles): |
1659 filerevlog = self.file(fname) | 1669 filerevlog = self.file(fname) |
1660 if not len(filerevlog): | 1670 if not len(filerevlog): |
1661 raise util.Abort(_("empty or missing revlog for %s") % fname) | 1671 raise util.Abort(_("empty or missing revlog for %s") % fname) |
1662 fstate[0] = fname | 1672 fstate[0] = fname |
1663 first = True | 1673 first = True |
1664 for chunk in filerevlog.group(gennodelst(filerevlog), bundler): | 1674 for chunk in filerevlog.group(gennodelst(filerevlog), bundler, |
1675 reorder=reorder): | |
1665 if first: | 1676 if first: |
1666 if chunk == bundler.close(): | 1677 if chunk == bundler.close(): |
1667 break | 1678 break |
1668 count[0] += 1 | 1679 count[0] += 1 |
1669 yield bundler.fileheader(fname) | 1680 yield bundler.fileheader(fname) |