changeset 43462:612b4b63fb22 stable

remotefilelog: remove the `ensurestart` usage The option does not seems to do what we want since it does not wait on the background process actually starting (eg: taking the lock). And the race have been dealt with another way anyway. This effectively back out changeset 2c74337e6483. Differential Revision: https://phab.mercurial-scm.org/D7590
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 09 Dec 2019 12:29:46 +0100
parents 4f40dc190f63
children 37cbf45bb858 5606e1cb4685
files hgext/remotefilelog/__init__.py hgext/remotefilelog/repack.py hgext/remotefilelog/shallowrepo.py tests/test-remotefilelog-bgprefetch.t tests/test-remotefilelog-repack-fast.t tests/test-remotefilelog-repack.t
diffstat 6 files changed, 9 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/__init__.py	Mon Dec 09 11:26:53 2019 +0100
+++ b/hgext/remotefilelog/__init__.py	Mon Dec 09 12:29:46 2019 +0100
@@ -229,7 +229,6 @@
 configitem(b'packs', b'maxpacksize', default=0)
 configitem(b'packs', b'maxchainlen', default=1000)
 
-configitem(b'devel', b'remotefilelog.ensurestart', default=False)
 configitem(b'devel', b'remotefilelog.bg-wait', default=False)
 
 #  default TTL limit is 30 days
@@ -1085,26 +1084,19 @@
         prefetchrevset = ui.config(b'remotefilelog', b'pullprefetch')
         bgrepack = repo.ui.configbool(b'remotefilelog', b'backgroundrepack')
         bgprefetch = repo.ui.configbool(b'remotefilelog', b'backgroundprefetch')
-        ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart')
 
         if prefetchrevset:
             ui.status(_(b"prefetching file contents\n"))
             revs = scmutil.revrange(repo, [prefetchrevset])
             base = repo[b'.'].rev()
             if bgprefetch:
-                repo.backgroundprefetch(
-                    prefetchrevset, repack=bgrepack, ensurestart=ensurestart
-                )
+                repo.backgroundprefetch(prefetchrevset, repack=bgrepack)
             else:
                 repo.prefetch(revs, base=base)
                 if bgrepack:
-                    repackmod.backgroundrepack(
-                        repo, incremental=True, ensurestart=ensurestart
-                    )
+                    repackmod.backgroundrepack(repo, incremental=True)
         elif bgrepack:
-            repackmod.backgroundrepack(
-                repo, incremental=True, ensurestart=ensurestart
-            )
+            repackmod.backgroundrepack(repo, incremental=True)
 
     return result
 
@@ -1255,13 +1247,9 @@
     revs = scmutil.revrange(repo, opts.get(b'rev'))
     repo.prefetch(revs, opts.get(b'base'), pats, opts)
 
-    ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart')
-
     # Run repack in background
     if opts.get(b'repack'):
-        repackmod.backgroundrepack(
-            repo, incremental=True, ensurestart=ensurestart
-        )
+        repackmod.backgroundrepack(repo, incremental=True)
 
 
 @command(
@@ -1281,12 +1269,10 @@
 )
 def repack_(ui, repo, *pats, **opts):
     if opts.get(r'background'):
-        ensurestart = repo.ui.configbool(b'devel', b'remotefilelog.ensurestart')
         repackmod.backgroundrepack(
             repo,
             incremental=opts.get(r'incremental'),
             packsonly=opts.get(r'packsonly', False),
-            ensurestart=ensurestart,
         )
         return
 
--- a/hgext/remotefilelog/repack.py	Mon Dec 09 11:26:53 2019 +0100
+++ b/hgext/remotefilelog/repack.py	Mon Dec 09 12:29:46 2019 +0100
@@ -36,9 +36,7 @@
     pass
 
 
-def backgroundrepack(
-    repo, incremental=True, packsonly=False, ensurestart=False
-):
+def backgroundrepack(repo, incremental=True, packsonly=False):
     cmd = [procutil.hgexecutable(), b'-R', repo.origroot, b'repack']
     msg = _(b"(running background repack)\n")
     if incremental:
@@ -52,9 +50,7 @@
     if repo.ui.configbool(b'devel', b'remotefilelog.bg-wait'):
         kwargs['record_wait'] = repo.ui.atexit
 
-    procutil.runbgcommand(
-        cmd, encoding.environ, ensurestart=ensurestart, **kwargs
-    )
+    procutil.runbgcommand(cmd, encoding.environ, ensurestart=False, **kwargs)
 
 
 def fullrepack(repo, options=None):
--- a/hgext/remotefilelog/shallowrepo.py	Mon Dec 09 11:26:53 2019 +0100
+++ b/hgext/remotefilelog/shallowrepo.py	Mon Dec 09 12:29:46 2019 +0100
@@ -215,13 +215,7 @@
             )
 
         def backgroundprefetch(
-            self,
-            revs,
-            base=None,
-            repack=False,
-            pats=None,
-            opts=None,
-            ensurestart=False,
+            self, revs, base=None, repack=False, pats=None, opts=None
         ):
             """Runs prefetch in background with optional repack
             """
@@ -237,7 +231,7 @@
                 kwargs['record_wait'] = repo.ui.atexit
 
             procutil.runbgcommand(
-                cmd, encoding.environ, ensurestart=ensurestart, **kwargs
+                cmd, encoding.environ, ensurestart=False, **kwargs
             )
 
         def prefetch(self, revs, base=None, pats=None, opts=None):
--- a/tests/test-remotefilelog-bgprefetch.t	Mon Dec 09 11:26:53 2019 +0100
+++ b/tests/test-remotefilelog-bgprefetch.t	Mon Dec 09 12:29:46 2019 +0100
@@ -1,11 +1,8 @@
 #require no-windows
 
   $ . "$TESTDIR/remotefilelog-library.sh"
-# devel.remotefilelog.ensurestart: reduce race condition with
-# waiton{repack/prefetch}
   $ cat >> $HGRCPATH <<EOF
   > [devel]
-  > remotefilelog.ensurestart=True
   > remotefilelog.bg-wait=True
   > EOF
 
--- a/tests/test-remotefilelog-repack-fast.t	Mon Dec 09 11:26:53 2019 +0100
+++ b/tests/test-remotefilelog-repack-fast.t	Mon Dec 09 12:29:46 2019 +0100
@@ -1,13 +1,11 @@
 #require no-windows
 
   $ . "$TESTDIR/remotefilelog-library.sh"
-# devel.remotefilelog.ensurestart: reduce race condition with
-# waiton{repack/prefetch}
+
   $ cat >> $HGRCPATH <<EOF
   > [remotefilelog]
   > fastdatapack=True
   > [devel]
-  > remotefilelog.ensurestart=True
   > remotefilelog.bg-wait=True
   > EOF
 
--- a/tests/test-remotefilelog-repack.t	Mon Dec 09 11:26:53 2019 +0100
+++ b/tests/test-remotefilelog-repack.t	Mon Dec 09 12:29:46 2019 +0100
@@ -1,11 +1,8 @@
 #require no-windows
 
   $ . "$TESTDIR/remotefilelog-library.sh"
-# devel.remotefilelog.ensurestart: reduce race condition with
-# waiton{repack/prefetch}
   $ cat >> $HGRCPATH <<EOF
   > [devel]
-  > remotefilelog.ensurestart=True
   > remotefilelog.bg-wait=True
   > EOF