comparison tests/test-branches.t @ 29744:0d588332ad2c

branchmap: acquires lock before writting the rev branch cache We now attempt to acquire a lock and write the branch cache within that lock. This would prevent cache corruption when multiple processes try to write the cache at the same time.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 05 Aug 2016 14:57:16 +0200
parents a2a380e2750f
children 034412ca28c3
comparison
equal deleted inserted replaced
29743:9f3c49ee4486 29744:0d588332ad2c
551 $ mkdir .hg/cache/rbc-revs-v1 551 $ mkdir .hg/cache/rbc-revs-v1
552 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' 552 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
553 5 553 5
554 $ rmdir .hg/cache/rbc-revs-v1 554 $ rmdir .hg/cache/rbc-revs-v1
555 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1 555 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
556
557 no errors when wlock cannot be acquired
558
559 #if unix-permissions
560 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
561 $ rm -f .hg/cache/branch*
562 $ chmod 555 .hg
563 $ hg head a -T '{rev}\n'
564 5
565 $ chmod 755 .hg
566 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
567 #endif
556 568
557 recovery from invalid cache revs file with trailing data 569 recovery from invalid cache revs file with trailing data
558 $ echo >> .hg/cache/rbc-revs-v1 570 $ echo >> .hg/cache/rbc-revs-v1
559 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug 571 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
560 5 572 5