1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-13 15:28:35 +01:00
phorge-phorge/src/applications/diffusion/query
epriestley f5f784f4c1 Version clustered, observed repositories in a reasonable way (by largest discovered HEAD)
Summary:
Ref T4292. For hosted, clustered repositories we have a good way to increment the internal version of the repository: every time a user pushes something, we increment the version by 1.

We don't have a great way to do this for observed/remote repositories because when we `git fetch` we might get nothing, or we might get some changes, and we can't easily tell //what// changes we got.

For example, if we see that another node is at "version 97", and we do a fetch and see some changes, we don't know if we're in sync with them (i.e., also at "version 97") or ahead of them (at "version 98").

This implements a simple way to version an observed repository:

  - Take the head of every branch/tag.
  - Look them up.
  - Pick the biggest internal ID number.

This will work //except// when branches are deleted, which could cause the version to go backward if the "biggest commit" is the one that was deleted. This should be OK, since it's rare and the effects are minor and the repository will "self-heal" on the next actual push.

Test Plan:
  - Created an observed repository.
  - Ran `bin/repository update` and observed a sensible version number appear in the version table.
  - Pushed to the remote, did another update, saw a sensible update.
  - Did an update with no push, saw no effect on version number.
  - Toggled repository to hosted, saw the version reset.
  - Simulated read traffic to out-of-sync node, saw it do a remote fetch.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4292

Differential Revision: https://secure.phabricator.com/D15986
2016-05-30 09:53:01 -07:00
..
blame Use a path digest when building blame cache keys 2016-01-06 19:12:57 -08:00
filecontent Allow diffusion.filecontentquery to load data for arbitrarily large files 2016-01-21 09:52:43 -08:00
lowlevel Version clustered, observed repositories in a reasonable way (by largest discovered HEAD) 2016-05-30 09:53:01 -07:00
pathchange Extend from Phobject 2015-06-15 18:02:27 +10:00
pathid Fix a few more undeclared properties 2015-06-15 19:39:04 +10:00
rawdiff Change double quotes to single quotes. 2014-06-09 11:36:50 -07:00
DiffusionCachedResolveRefsQuery.php phtize all the things 2015-05-22 21:16:39 +10:00
DiffusionCommitQuery.php Fix resolution of commits in SVN repositories without callsigns 2016-04-04 09:44:36 -07:00
DiffusionDiffInlineCommentQuery.php Extend TransactionCommentQuery for Diffusion 2015-03-09 14:11:22 -07:00
DiffusionLintCountQuery.php Use PhutilInvalidStateException 2015-05-14 07:53:52 +10:00
DiffusionPathQuery.php Extend from Phobject 2015-06-15 18:02:27 +10:00
DiffusionQuery.php Move various other callsites away from callsigns 2016-01-04 06:54:42 -08:00
DiffusionRenameHistoryQuery.php Extend from Phobject 2015-06-15 18:02:27 +10:00
DiffusionResolveUserQuery.php Provide a standalone query for resolution of commit author/committer into Phabricator users 2013-12-19 11:05:17 -08:00
DiffusionSymbolQuery.php Only link symbols if there might be any 2015-05-21 08:25:35 -07:00