[PATCH] transaction: move changelog finalizer to be before bookmark finalizer

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Mar 18 21:07:52 EDT 2016

On 03/16/2016 11:31 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1458196059 25200
> #      Wed Mar 16 23:27:39 2016 -0700
> # Node ID cdf4a94fdc46d27196f5411fc7a4008690834fba
> # Parent  ed75909c4c670a7d9db4a2bef9817a0d5f0b4d9c
> transaction: move changelog finalizer to be before bookmark finalizer
> Previously, transaction close would run the file generators before running the
> finalizers (see the list below for what is in each). Since file generators
> contain the bookmarks and the dirstate, this meant we made the dirstate and
> bookmarks visible to external readers before we actually wrote the commits into
> the changelog, which could result in missing bookmarks and missing working copy
> parents (especially on servers with high commit throughput, since pulls might
> fail to see certain bookmarks in this situation).
> By moving the changelog writing to be before the bookmark/dirstate writing, we
> ensure the commits are present before they are referenced.
> For reference, file generators currently consist of: bookmarks, dirstate, and
> phases. Finalizers currently consist of: changelog, revbranchcache, and fncache.
> All of the former reference the latter, so therefore the latter should be
> written first.
> Technically there's still plenty of race conditions (can the order of finalizers
> affect how external readers see the repo?), but this is a step forward at least.

Can we get a more complete analyse on the race condition we have here 
and which ones we are trading for which others one?

For example, this changes could result in phase root being visible after 
the changesets, making public being seen public while they are not.

I would like to have a clear idea of where we are walking there and what 
tradeoff we are performing.

Pierre-Yves David

More information about the Mercurial-devel mailing list