comparison tests/test-dirstate-read-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 3ddff85fa2c8
children e6532a7336d0
comparison
equal deleted inserted replaced
50243:6cce0afc1454 50244:07d030b38097
310 310
311 $ hg $d2args update --merge ".~1" 311 $ hg $d2args update --merge ".~1"
312 0 files updated, 0 files merged, 6 files removed, 0 files unresolved 312 0 files updated, 0 files merged, 6 files removed, 0 files unresolved
313 $ touch $TESTTMP/status-race-lock 313 $ touch $TESTTMP/status-race-lock
314 $ wait 314 $ wait
315 #if rhg dirstate-v2-append pre-some-read
316 $ hg log -GT '{node|short} {desc}\n' 315 $ hg log -GT '{node|short} {desc}\n'
317 @ 9a86dcbfb938 more files to have two commit 316 o 9a86dcbfb938 more files to have two commit
318 | 317 |
319 o 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append 318 @ 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append
320 319
321 $ hg status 320 $ hg status
321 A dir/o
322 ? dir/n
323 ? p
324 ? q
325
326 The status process should return a consistent result and not crash.
327
328 #if rhg dirstate-v2-append pre-some-read
329 $ cat $TESTTMP/status-race-lock.out
322 A dir/o 330 A dir/o
323 R dir/nested/m 331 R dir/nested/m
324 ! dir/i 332 ! dir/i
325 ! dir/j 333 ! dir/j
326 ! dir/nested/h 334 ! dir/nested/h
329 ! g 337 ! g
330 ? dir/n 338 ? dir/n
331 ? p 339 ? p
332 ? q 340 ? q
333 #else 341 #else
334 $ hg log -GT '{node|short} {desc}\n' 342 #if rust no-rhg dirstate-v2-append
335 o 9a86dcbfb938 more files to have two commit
336 |
337 @ 4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append
338
339 $ hg status
340 A dir/o
341 ? dir/n
342 ? p
343 ? q
344 #endif
345
346 The status process should return a consistent result and not crash.
347
348 #if rhg dirstate-v2-append pre-some-read
349 $ cat $TESTTMP/status-race-lock.out 343 $ cat $TESTTMP/status-race-lock.out
350 A dir/o 344 A dir/o
351 R dir/nested/m 345 R dir/nested/m
352 ! dir/i 346 ! dir/i
353 ! dir/j 347 ! dir/j
357 ! g 351 ! g
358 ? dir/n 352 ? dir/n
359 ? p 353 ? p
360 ? q 354 ? q
361 #else 355 #else
362 #if rust no-rhg dirstate-v2-append
363 $ cat $TESTTMP/status-race-lock.out
364 A dir/o
365 R dir/nested/m
366 ! dir/i
367 ! dir/j
368 ! dir/nested/h
369 ! dir2/k
370 ! dir2/l
371 ! g
372 ? dir/n
373 ? p
374 ? q
375 #else
376 $ cat $TESTTMP/status-race-lock.out 356 $ cat $TESTTMP/status-race-lock.out
377 A dir/o 357 A dir/o
378 ? dir/n 358 ? dir/n
379 ? p 359 ? p
380 ? q 360 ? q