Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/nodemap.py @ 47887:52018f8ef020 stable
persistent-nodemap: introduce a test to highlight possible race
Weakness in the current file caching of the changelog means that a writer can
end up using an outdated docket. This might result in "committed"
persistent-nodemap data from a previous writer to be overwritten by a later
writer. This break the strong "append only" assumption of the persistent nodemap
and can result in confused reader.
The race windows are quite narrow. See the test documentation for details.
The issues is fixed in the next changeset.
Differential Revision: https://phab.mercurial-scm.org/D11481
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 21 Sep 2021 21:18:50 +0200 |
parents | f70ca39d0ab8 |
children | 897aa0c4da4a |
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py Tue Sep 21 21:18:44 2021 +0200 +++ b/mercurial/revlogutils/nodemap.py Tue Sep 21 21:18:50 2021 +0200 @@ -26,6 +26,14 @@ raise error.RevlogError(b'unknown node: %s' % x) +def test_race_hook_1(): + """hook point for test + + This let tests to have things happens between the docket reading and the + data reading""" + pass + + def persisted_data(revlog): """read the nodemap for a revlog from disk""" if revlog._nodemap_file is None: @@ -50,6 +58,8 @@ filename = _rawdata_filepath(revlog, docket) use_mmap = revlog.opener.options.get(b"persistent-nodemap.mmap") + + test_race_hook_1() try: with revlog.opener(filename) as fd: if use_mmap: