Mercurial > hg
comparison tests/test-clonebundles.t @ 50346:54f68495ab2a stable
revlog-split: show manifest data loss situation when using clonebundle
After the commit of the transaction from applying the clone bundle, changes to
the manifest from the subsequent pull would write index data in the wrong file.
This lead to data being "lost" after the pull and the repository to be
corrupted. We add a test checking this specific scenario.
In practice, the issue only affects the manifest but we also test the issue with a file for future proofing things up.
See test documentation and failure for details.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 18 Apr 2023 01:12:00 +0200 |
parents | de3ac3d2c60b |
children | f952be90b051 |
comparison
equal
deleted
inserted
replaced
50345:ae9a15267315 | 50346:54f68495ab2a |
---|---|
636 2 local changesets published | 636 2 local changesets published |
637 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles | 637 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles |
638 updating the branch cache | 638 updating the branch cache |
639 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob) | 639 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob) |
640 $ killdaemons.py | 640 $ killdaemons.py |
641 | |
642 Testing a clone bundles that involves revlog splitting (issue6811) | |
643 ================================================================== | |
644 | |
645 $ cat >> $HGRCPATH << EOF | |
646 > [format] | |
647 > revlog-compression=none | |
648 > use-persistent-nodemap=no | |
649 > EOF | |
650 | |
651 $ hg init server-revlog-split/ | |
652 $ cd server-revlog-split | |
653 $ cat >> .hg/hgrc << EOF | |
654 > [extensions] | |
655 > clonebundles = | |
656 > EOF | |
657 $ echo foo > A | |
658 $ hg add A | |
659 $ hg commit -m 'initial commit' | |
660 IMPORTANT: the revlogs must not be split | |
661 $ ls -1 .hg/store/00manifest.* | |
662 .hg/store/00manifest.i | |
663 $ ls -1 .hg/store/data/_a.* | |
664 .hg/store/data/_a.i | |
665 | |
666 do big enough update to split the revlogs | |
667 | |
668 $ $TESTDIR/seq.py 100000 > A | |
669 $ mkdir foo | |
670 $ cd foo | |
671 $ touch `$TESTDIR/seq.py 10000` | |
672 $ cd .. | |
673 $ hg add -q foo | |
674 $ hg commit -m 'split the manifest and one filelog' | |
675 | |
676 IMPORTANT: now the revlogs must be split | |
677 $ ls -1 .hg/store/00manifest.* | |
678 .hg/store/00manifest.d | |
679 .hg/store/00manifest.i | |
680 $ ls -1 .hg/store/data/_a.* | |
681 .hg/store/data/_a.d | |
682 .hg/store/data/_a.i | |
683 | |
684 Add an extra commit on top of that | |
685 | |
686 $ echo foo >> A | |
687 $ hg commit -m 'one extra commit' | |
688 | |
689 $ cd .. | |
690 | |
691 Do a bundle that contains the split, but not the update | |
692 | |
693 $ hg bundle --exact --rev '::(default~1)' -R server-revlog-split/ --type gzip-v2 split-test.hg | |
694 2 changesets found | |
695 | |
696 $ cat > server-revlog-split/.hg/clonebundles.manifest << EOF | |
697 > http://localhost:$HGPORT1/split-test.hg BUNDLESPEC=gzip-v2 | |
698 > EOF | |
699 | |
700 start the necessary server | |
701 | |
702 $ "$PYTHON" $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid | |
703 $ cat http.pid >> $DAEMON_PIDS | |
704 $ hg -R server-revlog-split serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log | |
705 $ cat hg.pid >> $DAEMON_PIDS | |
706 | |
707 Check that clone works fine | |
708 =========================== | |
709 | |
710 Here, the initial clone will trigger a revlog split (which is a bit clowny it | |
711 itself, but whatever). The split revlogs will see additionnal data added to | |
712 them in the subsequent pull. This should not be a problem | |
713 | |
714 $ hg clone http://localhost:$HGPORT revlog-split-in-the-bundle | |
715 applying clone bundle from http://localhost:$HGPORT1/split-test.hg | |
716 adding changesets | |
717 adding manifests | |
718 adding file changes | |
719 added 2 changesets with 10002 changes to 10001 files | |
720 finished applying clone bundle | |
721 searching for changes | |
722 adding changesets | |
723 adding manifests | |
724 adding file changes | |
725 added 1 changesets with 1 changes to 1 files | |
726 new changesets e3879eaa1db7 | |
727 2 local changesets published | |
728 updating to branch default | |
729 10001 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
730 | |
731 check the results | |
732 | |
733 $ cd revlog-split-in-the-bundle | |
734 $ f --size .hg/store/00manifest.* | |
735 .hg/store/00manifest.d: size=499037 | |
736 .hg/store/00manifest.i: size=192 (missing-correct-output !) | |
737 .hg/store/00manifest.i: size=128 (known-bad-output !) | |
738 .hg/store/00manifest.i.s: size=64 (known-bad-output !) | |
739 $ f --size .hg/store/data/_a.* | |
740 .hg/store/data/_a.d: size=588917 | |
741 .hg/store/data/_a.i: size=192 | |
742 | |
743 manifest should work | |
744 | |
745 $ hg files -r tip | wc -l | |
746 \s*10001 (re) (missing-correct-output !) | |
747 abort: 00manifest@4941afd6b8e298d932227572c5c303cbc14301bd: no node (known-bad-output !) | |
748 0 (known-bad-output !) | |
749 | |
750 file content should work | |
751 | |
752 $ hg cat -r tip A | wc -l | |
753 \s*100001 (re) (missing-correct-output !) | |
754 abort: 00manifest@4941afd6b8e298d932227572c5c303cbc14301bd: no node (known-bad-output !) | |
755 0 (known-bad-output !) | |
756 | |
757 |