[PATCH 2 of 2] tags: take lock while writing `tags2` cache
Pulkit Goyal
7895pulkit at gmail.com
Mon Sep 14 08:09:48 UTC 2020
On Sat, Sep 12, 2020 at 8:31 AM Yuya Nishihara <yuya at tcha.org> wrote:
>
> On Fri, 11 Sep 2020 12:34:01 +0530, Pulkit Goyal wrote:
> > # HG changeset patch
> > # User Pulkit Goyal <7895pulkit at gmail.com>
> > # Date 1599727895 -19800
> > # Thu Sep 10 14:21:35 2020 +0530
> > # Node ID 3eae3d3a1b44b0fe10e00766e1113c50d48ed086
> > # Parent 3095d36efcaf9ce835249c9312e892b0d54aac78
> > # EXP-Topic tags-fix
> > tags: take lock while writing `tags2` cache
> >
> > Before this patch, we were not taking lock while writing the cache. This cache
> > is shared one and hence multiple writes can happen at same time. So let's take a
> > lock before writing it. We don't wait for lock because outdated cache is still
> > fine.
> >
> > diff --git a/mercurial/tags.py b/mercurial/tags.py
> > --- a/mercurial/tags.py
> > +++ b/mercurial/tags.py
> > @@ -514,38 +514,47 @@ def _getfnodes(ui, repo, nodes):
> >
> > def _writetagcache(ui, repo, valid, cachetags):
> > filename = _filename(repo)
> > +
> > try:
> > - cachefile = repo.cachevfs(filename, b'w', atomictemp=True)
>
> Write race should be dealt with atomictemp. This wouldn't need a lock.
Missed it thanks.
More information about the Mercurial-devel
mailing list