Mercurial > hg
diff tests/test-dirstate-status-write-race.t @ 50244:07d030b38097 stable
rust-dirstate-v2: don't write dirstate if data file has changed
This fixes the following race:
- process A reads the dirstate
- process B reads and writes the dirstate
- process A writes the dirstate
This either resulted in losing what process B had just written or a crash
because the `uuid` had changed and we were trying to write to a file that
doesn't exist. More explanations inside.
This doesn't fix the issue for dirstate-v1, a later patch addresses it.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 28 Feb 2023 17:58:15 +0100 |
parents | 53ca3e3bc013 |
children | dbe09fb038fc |
line wrap: on
line diff
--- a/tests/test-dirstate-status-write-race.t Mon Dec 12 17:08:12 2022 +0100 +++ b/tests/test-dirstate-status-write-race.t Tue Feb 28 17:58:15 2023 +0100 @@ -242,12 +242,12 @@ The file should in a "added" state $ hg status - A dir/n (no-rhg !) - A dir/n (rhg dirstate-v2-rewrite !) + A dir/n (no-rhg dirstate-v1 !) + A dir/n (no-dirstate-v1 !) A dir/n (missing-correct-output rhg dirstate-v1 !) A dir/o R dir/nested/m - ? dir/n (known-bad-output rhg no-dirstate-v2-rewrite !) + ? dir/n (known-bad-output rhg dirstate-v1 !) ? p ? q @@ -260,7 +260,6 @@ ? p ? q $ cat $TESTTMP/status-race-lock.log - abort: when writing $TESTTMP/race-with-add/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !) final cleanup @@ -291,20 +290,7 @@ The parent must change and the status should be clean # XXX rhg misbehaves here -#if no-rhg - $ hg summary - parent: 2:2e3b442a2fd4 tip - created-during-status - branch: default - commit: 1 removed, 3 unknown - update: (current) - phases: 3 draft - $ hg status - R dir/nested/m - ? dir/n - ? p - ? q -#else +#if rhg dirstate-v1 $ hg summary parent: 1:c349430a1631 more files to have two commits @@ -318,6 +304,19 @@ ? dir/n ? p ? q +#else + $ hg summary + parent: 2:2e3b442a2fd4 tip + created-during-status + branch: default + commit: 1 removed, 3 unknown + update: (current) + phases: 3 draft + $ hg status + R dir/nested/m + ? dir/n + ? p + ? q #endif The status process should return a consistent result and not crash. @@ -329,7 +328,6 @@ ? p ? q $ cat $TESTTMP/status-race-lock.log - abort: when removing $TESTTMP/race-with-commit/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !) final cleanup @@ -418,9 +416,9 @@ the first update should be on disk $ hg debugstate --all | grep "g" + n 644 0 2000-01-01 00:10:00 g (known-bad-output rhg dirstate-v1 !) + n 644 0 2000-01-01 00:25:00 g (rhg no-dirstate-v1 !) n 644 0 2000-01-01 00:25:00 g (no-rhg !) - n 644 0 2000-01-01 00:25:00 g (missing-correct-output rhg !) - n 644 0 2000-01-01 00:10:00 g (known-bad-output rhg !) The status process should return a consistent result and not crash. @@ -431,7 +429,6 @@ ? p ? q $ cat $TESTTMP/status-race-lock.log - abort: when removing $TESTTMP/race-with-status/.hg/dirstate.*: $ENOENT$ (glob) (known-bad-output rhg dirstate-v2-rewrite !) final cleanup