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
F14055755: D15986.diff
Sat, Nov 16, 3:25 PM
F14002578: D15986.diff
Fri, Oct 25, 8:14 PM
F13999555: D15986.diff
Thu, Oct 24, 3:33 PM
F13973993: D15986.diff
Oct 18 2024, 3:34 AM
F13969941: D15986.id38481.diff
Oct 17 2024, 4:48 AM
F13961282: D15986.id38488.diff
Oct 15 2024, 4:11 AM
F13960774: D15986.diff
Oct 15 2024, 1:18 AM
Unknown Object (File)
Oct 10 2024, 3:52 AM
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
Branch
rv1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 12359
Build 15636: Run Core Tests
Build 15635: arc lint + arc unit

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.