Patchwork D9001: tags: take lock instead of wlock before writing hgtagsfnodes1 cache

login
register
mail settings
Submitter phabricator
Date Sept. 8, 2020, 2:12 p.m.
Message ID <differential-rev-PHID-DREV-rgjzomi7udcn7wvxpplg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47109/
State Superseded
Headers show

Comments

phabricator - Sept. 8, 2020, 2:12 p.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This cache is shared across stores and hence we should take store lock before
  writing to it. Otherwise there will be race where one share with wlock is
  writing to this cache and other share with wlock is trying to read it
  simultaneously.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9001

AFFECTED FILES
  mercurial/tags.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -838,7 +838,7 @@ 
         repo = self._repo
 
         try:
-            lock = repo.wlock(wait=False)
+            lock = repo.lock(wait=False)
         except error.LockError:
             repo.ui.log(
                 b'tagscache',