Mercurial > hg
comparison tests/test-branches.t @ 29615:a2a380e2750f stable
rbc: fix superfluous rebuilding from scratch - don't abuse self._rbcnamescount
The code used self._rbcnamescount as if it was the length of self._names ...
but actually it is just the number of good entries on disk. This caused the
cache to be populated inefficiently. In some cases very inefficiently.
Instead of checking the length before lookup, just try a lookup in self._names
- that is also in most cases faster.
Comments and debug messages are tweaked to help understanding the issue
and the fix.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 18 Jul 2016 22:25:09 +0200 |
parents | 5c79bae8166f |
children | 0d588332ad2c |
comparison
equal
deleted
inserted
replaced
29614:5c79bae8166f | 29615:a2a380e2750f |
---|---|
585 .hg/cache/rbc-revs-v1: size=8 | 585 .hg/cache/rbc-revs-v1: size=8 |
586 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1 | 586 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1 |
587 $ f --size .hg/cache/rbc-revs* | 587 $ f --size .hg/cache/rbc-revs* |
588 .hg/cache/rbc-revs-v1: size=120 | 588 .hg/cache/rbc-revs-v1: size=120 |
589 $ hg log -r 'branch(.)' -T '{rev} ' --debug | 589 $ hg log -r 'branch(.)' -T '{rev} ' --debug |
590 history modification detected - truncating revision branch cache to revision 13 | |
591 history modification detected - truncating revision branch cache to revision 1 | |
590 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8 | 592 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8 |
591 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug | 593 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug |
592 5 | 594 5 |
593 truncating cache/rbc-revs-v1 to 104 | 595 truncating cache/rbc-revs-v1 to 104 |
594 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs* | 596 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs* |
630 .hg/cache/rbc-revs-v1: size=112 | 632 .hg/cache/rbc-revs-v1: size=112 |
631 | 633 |
632 cache is rebuilt when corruption is detected | 634 cache is rebuilt when corruption is detected |
633 $ echo > .hg/cache/rbc-names-v1 | 635 $ echo > .hg/cache/rbc-names-v1 |
634 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug | 636 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug |
635 rebuilding corrupted revision branch cache | 637 referenced branch names not found - rebuilding revision branch cache from scratch |
636 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40 | 638 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40 |
637 $ f --size --hexdump .hg/cache/rbc-* | 639 $ f --size --hexdump .hg/cache/rbc-* |
638 .hg/cache/rbc-names-v1: size=79 | 640 .hg/cache/rbc-names-v1: size=79 |
639 0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n| | 641 0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n| |
640 0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer | | 642 0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer | |
686 .hg/cache/rbc-revs-v1: size=24 | 688 .hg/cache/rbc-revs-v1: size=24 |
687 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......| | 689 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......| |
688 0010: 56 46 78 69 00 00 00 01 |VFxi....| | 690 0010: 56 46 78 69 00 00 00 01 |VFxi....| |
689 $ : > .hg/cache/rbc-revs-v1 | 691 $ : > .hg/cache/rbc-revs-v1 |
690 | 692 |
693 No superfluous rebuilding of cache: | |
691 $ hg log -r "branch(null)&branch(branch)" --debug | 694 $ hg log -r "branch(null)&branch(branch)" --debug |
692 rebuilding corrupted revision branch cache | |
693 rebuilding corrupted revision branch cache | |
694 truncating cache/rbc-revs-v1 to 8 | |
695 BUG: the cache was declared corrupt multiple times and not fully rebuilt: | |
696 $ f --size --hexdump .hg/cache/rbc-* | 695 $ f --size --hexdump .hg/cache/rbc-* |
697 .hg/cache/rbc-names-v1: size=14 | 696 .hg/cache/rbc-names-v1: size=14 |
698 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch| | 697 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch| |
699 .hg/cache/rbc-revs-v1: size=24 | 698 .hg/cache/rbc-revs-v1: size=24 |
700 0000: 00 00 00 00 00 00 00 00 fa 4c 04 e5 00 00 00 00 |.........L......| | 699 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......| |
701 0010: 56 46 78 69 00 00 00 01 |VFxi....| | 700 0010: 56 46 78 69 00 00 00 01 |VFxi....| |
702 | 701 |
703 $ cd .. | 702 $ cd .. |