##// END OF EJS Templates
nodemap: add a test about racy commit during stream clone...
marmoute -
r47749:d70319c3 default
parent child Browse files
Show More
@@ -809,10 +809,15 b' Check that Mercurial reaction to this ev'
809
809
810
810
811 stream clone
811 stream clone
812 ------------
812 ============
813
813
814 The persistent nodemap should exist after a streaming clone
814 The persistent nodemap should exist after a streaming clone
815
815
816 Simple case
817 -----------
818
819 No race condition
820
816 $ hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone --debug | egrep '00(changelog|manifest)'
821 $ hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone --debug | egrep '00(changelog|manifest)'
817 adding [s] 00manifest.n (70 bytes)
822 adding [s] 00manifest.n (70 bytes)
818 adding [s] 00manifest.d (452 KB) (no-zstd !)
823 adding [s] 00manifest.d (452 KB) (no-zstd !)
@@ -836,3 +841,128 b' The persistent nodemap should exist afte'
836 data-length: 121088
841 data-length: 121088
837 data-unused: 0
842 data-unused: 0
838 data-unused: 0.000%
843 data-unused: 0.000%
844
845 new data appened
846 -----------------
847
848 Other commit happening on the server during the stream clone
849
850 setup the step-by-step stream cloning
851
852 $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1"
853 $ export HG_TEST_STREAM_WALKED_FILE_1
854 $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2"
855 $ export HG_TEST_STREAM_WALKED_FILE_2
856 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3"
857 $ export HG_TEST_STREAM_WALKED_FILE_3
858 $ cat << EOF >> test-repo/.hg/hgrc
859 > [extensions]
860 > steps=$RUNTESTDIR/testlib/ext-stream-clone-steps.py
861 > EOF
862
863 Check and record file state beforehand
864
865 $ f --size test-repo/.hg/store/00changelog*
866 test-repo/.hg/store/00changelog-*.nd: size=121088 (glob)
867 test-repo/.hg/store/00changelog.d: size=376891 (zstd !)
868 test-repo/.hg/store/00changelog.d: size=368890 (no-zstd !)
869 test-repo/.hg/store/00changelog.i: size=320384
870 test-repo/.hg/store/00changelog.n: size=70
871 $ hg -R test-repo debugnodemap --metadata | tee server-metadata.txt
872 uid: * (glob)
873 tip-rev: 5005
874 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
875 data-length: 121088
876 data-unused: 0
877 data-unused: 0.000%
878
879 Prepare a commit
880
881 $ echo foo >> test-repo/foo
882 $ hg -R test-repo/ add test-repo/foo
883
884 Do a mix of clone and commit at the same time so that the file listed on disk differ at actual transfer time.
885
886 $ (hg clone -U --stream --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/test-repo stream-clone-race-1 --debug 2>> clone-output | egrep '00(changelog|manifest)' >> clone-output; touch $HG_TEST_STREAM_WALKED_FILE_3) &
887 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1
888 $ hg -R test-repo/ commit -m foo
889 $ touch $HG_TEST_STREAM_WALKED_FILE_2
890 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3
891 $ cat clone-output
892 remote: abort: unexpected error: [Errno 2] $ENOENT$: *'$TESTTMP/test-repo/.hg/store/00manifest-*.nd' (glob) (known-bad-output no-rust no-pure !)
893 abort: pull failed on remote (known-bad-output no-rust no-pure !)
894 adding [s] 00manifest.n (70 bytes)
895 adding [s] 00manifest.d (491 KB) (zstd !)
896 adding [s] 00manifest.d (452 KB) (no-zstd !)
897 remote: abort: $ENOENT$: '$TESTTMP/test-repo/.hg/store/00manifest-*.nd' (glob) (known-bad-output no-rust no-pure !)
898 adding [s] 00manifest-*.nd (118 KB) (glob) (rust !)
899 adding [s] 00changelog.n (70 bytes) (rust !)
900 adding [s] 00changelog.d (368 KB) (zstd rust !)
901 adding [s] 00changelog-*.nd (118 KB) (glob) (rust !)
902 adding [s] 00manifest.i (313 KB) (rust !)
903 adding [s] 00changelog.i (313 KB) (rust !)
904 adding [s] 00manifest-*.nd (118 KB) (glob) (pure !)
905 adding [s] 00changelog.n (70 bytes) (pure !)
906 adding [s] 00changelog.d (360 KB) (no-zstd !)
907 adding [s] 00changelog-*.nd (118 KB) (glob) (pure !)
908 adding [s] 00manifest.i (313 KB) (pure !)
909 adding [s] 00changelog.i (313 KB) (pure !)
910
911 Check the result state
912
913 $ f --size stream-clone-race-1/.hg/store/00changelog*
914 stream-clone-race-1/.hg/store/00changelog*: file not found (known-bad-output no-rust no-pure !)
915 stream-clone-race-1/.hg/store/00changelog-*.nd: size=121088 (glob) (rust !)
916 stream-clone-race-1/.hg/store/00changelog.d: size=376891 (zstd rust !)
917 stream-clone-race-1/.hg/store/00changelog.i: size=320384 (rust !)
918 stream-clone-race-1/.hg/store/00changelog.n: size=70 (rust !)
919 stream-clone-race-1/.hg/store/00changelog-*.nd: size=121088 (glob) (pure !)
920 stream-clone-race-1/.hg/store/00changelog.d: size=368890 (no-zstd pure !)
921 stream-clone-race-1/.hg/store/00changelog.i: size=320384 (pure !)
922 stream-clone-race-1/.hg/store/00changelog.n: size=70 (pure !)
923
924 $ hg -R stream-clone-race-1 debugnodemap --metadata | tee client-metadata.txt
925 abort: repository stream-clone-race-1 not found (known-bad-output no-rust no-pure !)
926 uid: * (glob) (rust !)
927 tip-rev: 5005 (rust !)
928 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe (rust !)
929 data-length: 121088 (rust !)
930 data-unused: 0 (rust !)
931 data-unused: 0.000% (rust !)
932 uid: * (glob) (pure !)
933 tip-rev: 5005 (pure !)
934 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe (pure !)
935 data-length: 121088 (pure !)
936 data-unused: 0 (pure !)
937 data-unused: 0.000% (pure !)
938
939 We get a usable nodemap, so no rewrite would be needed and the metadata should be identical
940 (ie: the following diff should be empty)
941
942 $ diff -u server-metadata.txt client-metadata.txt
943 --- server-metadata.txt * (glob) (known-bad-output !)
944 +++ client-metadata.txt * (glob) (known-bad-output !)
945 @@ -1,4 +1,4 @@ (known-bad-output rust !)
946 @@ -1,4 +1,4 @@ (known-bad-output pure !)
947 @@ -1,6 +0,0 @@ (known-bad-output no-rust no-pure !)
948 -uid: * (glob) (known-bad-output !)
949 +uid: * (glob) (known-bad-output rust !)
950 tip-rev: 5005 (known-bad-output rust !)
951 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe (known-bad-output rust !)
952 data-length: 121088 (known-bad-output rust !)
953 +uid: * (glob) (known-bad-output pure !)
954 tip-rev: 5005 (known-bad-output pure !)
955 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe (known-bad-output pure !)
956 data-length: 121088 (known-bad-output pure !)
957 -tip-rev: 5005 (known-bad-output no-rust no-pure !)
958 -tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe (known-bad-output no-rust no-pure !)
959 -data-length: 121088 (known-bad-output no-rust no-pure !)
960 -data-unused: 0 (known-bad-output no-rust no-pure !)
961 -data-unused: 0.000% (known-bad-output no-rust no-pure !)
962 [1]
963
964 Clean up after the test.
965
966 $ rm -f "$HG_TEST_STREAM_WALKED_FILE_1"
967 $ rm -f "$HG_TEST_STREAM_WALKED_FILE_2"
968 $ rm -f "$HG_TEST_STREAM_WALKED_FILE_3"
General Comments 0
You need to be logged in to leave comments. Login now