Page MenuHomePhabricator

Version clustered, observed repositories in a reasonable way (by largest discovered HEAD)
ClosedPublic

Authored by epriestley on May 30 2016, 2:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 2:50 PM
Unknown Object (File)
Thu, Dec 19, 12:22 PM
Unknown Object (File)
Sun, Dec 15, 10:21 AM
Unknown Object (File)
Mon, Dec 9, 8:09 PM
Unknown Object (File)
Sun, Dec 8, 6:04 PM
Unknown Object (File)
Tue, Dec 3, 11:04 AM
Unknown Object (File)
Tue, Dec 3, 3:46 AM
Unknown Object (File)
Sun, Dec 1, 5:28 PM
Subscribers
None

Details

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.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Version clustered, observed repositories in a reasonable way (by largest discovered HEAD).
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.

Oh, I've also made a very small foray into T6878 here, replacing isOriginBranch() and isTag() with a more modern withRefTypes(). Fixing this completely requires some additional changes which I didn't pursue.

  • Fix a comment typo ("some fo" -> "some of").
chad edited edge metadata.
This revision is now accepted and ready to land.May 30 2016, 3:57 PM
This revision was automatically updated to reflect the committed changes.