This is an archive of the discontinued Mercurial Phabricator instance.

branchcache: add attributes to track which nodes are verified
ClosedPublic

Authored by pulkit on Mar 19 2019, 9:40 AM.

Details

Summary

Half of the cost of loading branchcache comes from verifiying all the nodes it
has. We don't need to verify all the nodes in all the cases. Sometimes we need
to verify only a set of nodes for a set of branches. We can ignore nodes of
other branches as we are not going to read them.

This patch introduces two attributes to branchcache class. _verifiedbranches is
a set which will tell the branches for which it's head nodes are verified.
_closedverified is a boolean which will tell whether all closednodes are
verified or not.

Another idea which I had was to keep a set of nodes which are verified, but it
will be more ugly and difficult to track things on node level.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Mar 19 2019, 9:40 AM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Mar 23 2019, 9:26 PM

@@ -231,8 +235,10 @@

    raise ValueError(
        r'node %s does not exist' % pycompat.sysstr(hex(node)))
self._entries.setdefault(label, []).append(node)

+ self._verifiedbranches.add(label)

Can we expect that we'll rewrite this load() logic to handle verification
state of multiple nodes (i.e. heads) correctly? It's unclear to me how lazy
verification will be implemented.