Patchwork D9000: localrepo: warn if we are writing to cache without a lock

login
register
mail settings
Submitter phabricator
Date Sept. 8, 2020, 2:12 p.m.
Message ID <differential-rev-PHID-DREV-3ltzqp7hg6ym6kb2zjez-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47110/
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
  From quite sometime we have two types of cache, `cache` and `wcache`. The later
  one is a working copy cache and the first one is a store cache.
  
  Let's add a check for warning if we are missing store lock while writing to
  these caches.
  
  This is inspired from some tag cache breakage which is observed when multiple
  shares are in play.
  
  The interesting part is that although we are still taking wlock to write store
  caches at many places, but still the test pases.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1250,7 +1250,12 @@ 
                 msg = b'accessing cache with vfs instead of cachevfs: "%s"'
                 repo.ui.develwarn(msg % path, stacklevel=3, config=b"cache-vfs")
             # path prefixes covered by 'lock'
-            vfs_path_prefixes = (b'journal.', b'undo.', b'strip-backup/')
+            vfs_path_prefixes = (
+                b'journal.',
+                b'undo.',
+                b'strip-backup/',
+                b'cache/',
+            )
             if any(path.startswith(prefix) for prefix in vfs_path_prefixes):
                 if repo._currentlock(repo._lockref) is None:
                     repo.ui.develwarn(