Patchwork [Bug,4855] New: phasesets cache not cleared after strip by another process

login
register
mail settings
Submitter mercurial-bugs@selenic.com
Date Sept. 28, 2015, 2:30 p.m.
Message ID <bug-4855-285@http.bz.selenic.com/>
Download mbox | patch
Permalink /patch/10671/
State Not Applicable
Headers show

Comments

mercurial-bugs@selenic.com - Sept. 28, 2015, 2:30 p.m.
http://bz.selenic.com/show_bug.cgi?id=4855

            Bug ID: 4855
           Summary: phasesets cache not cleared after strip by another
                    process
           Product: Mercurial
           Version: 3.5.1
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Keywords: regression
          Severity: bug
          Priority: urgent
         Component: Mercurial
          Assignee: bugzilla@selenic.com
          Reporter: yuya@tcha.org
                CC: mercurial-devel@selenic.com

In-memory _phasesets cache may contain invalid revisions if repository
was stripped by another process. It can cause "unknown revision" exception
in command-server session.

The following test works on 3.4.2, but fails on 3.5.1, so this is a
regression.

This is somewhat similar to the bug 3827.

Test:

Patch

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -367,6 +367,38 @@  check that local configs for the cached 
   *** runcommand status -i -u
   I ignored-file

+BROKEN: cache of non-public revisions must be invalidated if repository is
+stripped by another process:
+
+  >>> import os
+  >>> from hgclient import readchannel, runcommand, check
+  >>> @check
+  ... def phasesetscacheafterstrip(server):
+  ...     readchannel(server)
+  ...     # create draft commits that will be stripped later
+  ...     for i in xrange(5, 7):
+  ...         f = open('a', 'ab')
+  ...         f.write('a\n')
+  ...         f.close()
+  ...         runcommand(server, ['commit', '-Aqm%d' % i])
+  ...     # load _phasecache._phaserevs and _phasesets
+  ...     runcommand(server, ['log', '-Gqr', 'draft()'])
+  ...     # strip cached revisions by another process
+  ...     os.system('hg --config extensions.strip= strip -q 5')
+  ...     # shouldn't abort by "unknown revision '6'"
+  ...     runcommand(server, ['log', '-qr', 'draft()'])
+  *** runcommand commit -Aqm5
+  *** runcommand commit -Aqm6
+  *** runcommand log -Gqr draft()
+  @  6:10501e202c35
+  |
+  o  5:41f6602d1c4f
+  |
+  o  4:7966c8e3734d
+  |
+  *** runcommand log -qr draft()
+  4:7966c8e3734d
+
   >>> import os
   >>> from hgclient import readchannel, sep, runcommand, check
   >>> @check


Test result on 3.5.1:

--- tests/test-commandserver.t
+++ tests/test-commandserver.t.err
@@ -398,6 +398,9 @@ 
   |
   *** runcommand log -qr draft()
   4:7966c8e3734d
+  5:000000000000
+  abort: unknown revision '6'!
+   [255]

-- 
You are receiving this mail because:
You are on the CC list for the bug.