@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve performance when marking commits as unreachable after multiple ref deletions

Summary:
See PHI1688. If many refs with a large amount of shared ancestry are deleted from a repository, we can spend much longer than necessary marking their mutual ancestors as unreachable over and over again.

For example, if refs A, B and C all point near the head of an obsolete "develop" branch and have about 1K shared commits reachable from no other refs, deleting all three refs will lead to us performing 3,000 mark-as-unreachable operations (once for each "<ref, commit>" pair).

Instead, we can stop exploring history once we reach an already-unreachable commit.

Test Plan:
- Destroyed 7 similar refs simultaneously.
- Ran `bin/repository refs`, saw 7 entries appear in the `oldref` table.
- Ran `bin/repository discover` with some debugging statements added, saw sensible-seeming behavior which didn't double-mark any newly-unreachable refs.

Differential Revision: https://secure.phabricator.com/D21056

+7
+7
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 840 840 841 841 $seen[$target_identifier] = true; 842 842 843 + // See PHI1688. If this commit is already marked as unreachable, we don't 844 + // need to consider its ancestors. This may skip a lot of work if many 845 + // branches with a lot of shared ancestry are deleted at the same time. 846 + if ($target->isUnreachable()) { 847 + continue; 848 + } 849 + 843 850 try { 844 851 $stream->getCommitDate($target_identifier); 845 852 $reachable = true;