races: load bookmarks earlier in no-sync cases

Summary:
In the past we've introduced code into hgsql that tries to load bookmarks into
memory very early in the process, so there's no chance of the bookmarks being
out of sync with the changelog. When we added the synclimiter short circuit code
path, we lost the ordered loading which has caused the master bookmark to seem
to disappear when users were doing a pull and the bookmark file changed after
they had already loaded the changelog.

A real fix should go upstream, but since hgsql wraps the repo object so tightly
(before anything else gets a chance to operate on it), putting a work around
here is a simple, high impact fix.

Test Plan: Ran the tests, but really the tests won't catch anything here.

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phabricator.intern.facebook.com/D4121849

Signature: t1:4121849:1478133009:3cad7decdc866e68872c93b884467dfbc17f850c
This commit is contained in:
Durham Goode 2016-11-03 10:22:46 -07:00
parent 27925e5fef
commit d61aae9385

View File

@ -552,6 +552,15 @@ def wraprepo(repo):
# Someone else is already checking and updating the repo
self.ui.debug("skipping database sync because another "
"process is already syncing\n")
# It's important that we load bookmarks before the
# changelog. This way we know that the bookmarks point to
# valid nodes. Otherwise, the bookmarks might change between
# us reading the changelog and the bookmark file. Normally
# this would be done in needsync(), but since we're skipping
# the sync, we can do it here. Accessing self._bookmarks
# loads both the bookmarks and the changelog.
self._bookmarks
return
try: