##// END OF EJS Templates
stream-clone: smoothly detect and handle a case were a revlog is split...
marmoute -
r51534:54604240 default
parent child Browse files
Show More
@@ -506,7 +506,7 b' class revlog:'
506 except FileNotFoundError:
506 except FileNotFoundError:
507 return b''
507 return b''
508
508
509 def get_streams(self, max_linkrev):
509 def get_streams(self, max_linkrev, force_inline=False):
510 n = len(self)
510 n = len(self)
511 index = self.index
511 index = self.index
512 while n > 0:
512 while n > 0:
@@ -547,6 +547,29 b' class revlog:'
547 return [
547 return [
548 (self._indexfile, inline_stream, index_size + data_size),
548 (self._indexfile, inline_stream, index_size + data_size),
549 ]
549 ]
550 elif force_inline:
551
552 def get_stream():
553 with self._datafp() as fp_d:
554 yield None
555
556 for rev in range(n):
557 idx = self.index.entry_binary(rev)
558 if rev == 0 and self._docket is None:
559 # re-inject the inline flag
560 header = self._format_flags
561 header |= self._format_version
562 header |= FLAG_INLINE_DATA
563 header = self.index.pack_header(header)
564 idx = header + idx
565 yield idx
566 yield self._getsegmentforrevs(rev, rev, df=fp_d)[1]
567
568 inline_stream = get_stream()
569 next(inline_stream)
570 return [
571 (self._indexfile, inline_stream, index_size + data_size),
572 ]
550 else:
573 else:
551
574
552 def get_index_stream():
575 def get_index_stream():
@@ -645,8 +645,11 b' class RevlogStoreEntry(BaseStoreEntry):'
645 if name_to_ext[f.unencoded_path] not in (b'.d', b'.i')
645 if name_to_ext[f.unencoded_path] not in (b'.d', b'.i')
646 ]
646 ]
647
647
648 is_inline = b'.d' not in self._details
649
648 rl = self.get_revlog_instance(repo).get_revlog()
650 rl = self.get_revlog_instance(repo).get_revlog()
649 rl_stream = rl.get_streams(max_changeset)
651 rl_stream = rl.get_streams(max_changeset, force_inline=is_inline)
652
650 for name, s, size in rl_stream:
653 for name, s, size in rl_stream:
651 if name_to_size.get(name, 0) != size:
654 if name_to_size.get(name, 0) != size:
652 msg = _(b"expected %d bytes but %d provided for %s")
655 msg = _(b"expected %d bytes but %d provided for %s")
@@ -17,6 +17,8 b' setup a repository for tests'
17 > [format]
17 > [format]
18 > # skip compression to make it easy to trigger a split
18 > # skip compression to make it easy to trigger a split
19 > revlog-compression=none
19 > revlog-compression=none
20 > [phases]
21 > publish=no
20 > EOF
22 > EOF
21
23
22 $ hg init server
24 $ hg init server
@@ -64,7 +66,11 b' Start the server'
64
66
65 Start a client doing a streaming clone
67 Start a client doing a streaming clone
66
68
67 $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone-while-split > client.log 2>&1; touch "$HG_TEST_STREAM_WALKED_FILE_3") &
69 $ ( \
70 > hg clone --debug --stream -U http://localhost:$HGPORT1 \
71 > clone-while-split > client.log 2>&1; \
72 > touch "$HG_TEST_STREAM_WALKED_FILE_3" \
73 > ) &
68
74
69 Wait for the server to be done collecting data
75 Wait for the server to be done collecting data
70
76
@@ -86,65 +92,84 b' wait for the client to be done cloning.'
86 Check everything is fine
92 Check everything is fine
87
93
88 $ cat client.log
94 $ cat client.log
89 remote: abort: unexpected error: expected 0 bytes but 1067 provided for data/some-file.d (known-bad-output !)
95 using http://localhost:$HGPORT1/
90 abort: pull failed on remote (known-bad-output !)
96 sending capabilities command
97 query 1; heads
98 sending batch command
99 streaming all changes
100 sending getbundle command
101 bundle2-input-bundle: with-transaction
102 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-bundle2-v2 !)
103 bundle2-input-part: "stream3-exp" (params: 3 mandatory) supported (stream-bundle2-v3 !)
104 applying stream bundle
105 7 files to transfer, 2.11 KB of data
106 adding [s] data/some-file.i (1.23 KB)
107 adding [s] phaseroots (43 bytes)
108 adding [s] 00manifest.i (348 bytes)
109 adding [s] 00changelog.i (381 bytes)
110 adding [c] branch2-served (94 bytes)
111 adding [c] rbc-names-v1 (7 bytes)
112 adding [c] rbc-revs-v1 (24 bytes)
113 updating the branch cache
114 transferred 2.11 KB in * seconds (* */sec) (glob)
115 bundle2-input-part: total payload size 2268
116 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
117 bundle2-input-bundle: 2 parts total
118 checking for updated bookmarks
119 updating the branch cache
120 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
91 $ tail -2 errors.log
121 $ tail -2 errors.log
92 mercurial.error.Abort: expected 0 bytes but 1067 provided for data/some-file.d (known-bad-output !)
93 (known-bad-output !)
94 $ hg -R clone-while-split verify
122 $ hg -R clone-while-split verify
95 checking changesets (missing-correct-output !)
123 checking changesets
96 checking manifests (missing-correct-output !)
124 checking manifests
97 crosschecking files in changesets and manifests (missing-correct-output !)
125 crosschecking files in changesets and manifests
98 checking files (missing-correct-output !)
126 checking files
99 checking dirstate (missing-correct-output !)
127 checking dirstate
100 checked 3 changesets with 3 changes to 1 files (missing-correct-output !)
128 checked 3 changesets with 3 changes to 1 files
101 abort: repository clone-while-split not found (known-bad-output !)
102 [255]
103 $ hg -R clone-while-split tip
129 $ hg -R clone-while-split tip
104 changeset: 2:dbd9854c38a6 (missing-correct-output !)
130 changeset: 2:dbd9854c38a6
105 tag: tip (missing-correct-output !)
131 tag: tip
106 user: test (missing-correct-output !)
132 user: test
107 date: Thu Jan 01 00:00:00 1970 +0000 (missing-correct-output !)
133 date: Thu Jan 01 00:00:00 1970 +0000
108 summary: c (missing-correct-output !)
134 summary: c
109 (missing-correct-output !)
135
110 abort: repository clone-while-split not found (known-bad-output !)
111 [255]
112 $ hg -R clone-while-split debug-revlog-index some-file
136 $ hg -R clone-while-split debug-revlog-index some-file
113 rev linkrev nodeid p1-nodeid p2-nodeid (missing-correct-output !)
137 rev linkrev nodeid p1-nodeid p2-nodeid
114 0 0 ed70cecbc103 000000000000 000000000000 (missing-correct-output !)
138 0 0 ed70cecbc103 000000000000 000000000000
115 1 1 7241018db64c ed70cecbc103 000000000000 (missing-correct-output !)
139 1 1 7241018db64c ed70cecbc103 000000000000
116 2 2 fa1120531cc1 7241018db64c 000000000000 (missing-correct-output !)
140 2 2 fa1120531cc1 7241018db64c 000000000000
117 abort: repository clone-while-split not found (known-bad-output !)
141 $ hg -R server phase --rev 'all()'
118 [255]
142 0: draft
143 1: draft
144 2: draft
145 3: draft
146 $ hg -R clone-while-split phase --rev 'all()'
147 0: draft
148 1: draft
149 2: draft
119
150
120 subsequent pull work
151 subsequent pull work
121
152
122 $ hg -R clone-while-split pull
153 $ hg -R clone-while-split pull
123 pulling from http://localhost:$HGPORT1/ (missing-correct-output !)
154 pulling from http://localhost:$HGPORT1/
124 searching for changes (missing-correct-output !)
155 searching for changes
125 adding changesets (missing-correct-output !)
156 adding changesets
126 adding manifests (missing-correct-output !)
157 adding manifests
127 adding file changes (missing-correct-output !)
158 adding file changes
128 added 1 changesets with 1 changes to 1 files (missing-correct-output !)
159 added 1 changesets with 1 changes to 1 files
129 new changesets df05c6cb1406 (missing-correct-output !)
160 new changesets df05c6cb1406 (1 drafts)
130 (run 'hg update' to get a working copy) (missing-correct-output !)
161 (run 'hg update' to get a working copy)
131 abort: repository clone-while-split not found (known-bad-output !)
132 [255]
133
162
134 $ hg -R clone-while-split debug-revlog-index some-file
163 $ hg -R clone-while-split debug-revlog-index some-file
135 rev linkrev nodeid p1-nodeid p2-nodeid (missing-correct-output !)
164 rev linkrev nodeid p1-nodeid p2-nodeid
136 0 0 ed70cecbc103 000000000000 000000000000 (missing-correct-output !)
165 0 0 ed70cecbc103 000000000000 000000000000
137 1 1 7241018db64c ed70cecbc103 000000000000 (missing-correct-output !)
166 1 1 7241018db64c ed70cecbc103 000000000000
138 2 2 fa1120531cc1 7241018db64c 000000000000 (missing-correct-output !)
167 2 2 fa1120531cc1 7241018db64c 000000000000
139 3 3 a631378adaa3 fa1120531cc1 000000000000 (missing-correct-output !)
168 3 3 a631378adaa3 fa1120531cc1 000000000000
140 abort: repository clone-while-split not found (known-bad-output !)
141 [255]
142 $ hg -R clone-while-split verify
169 $ hg -R clone-while-split verify
143 checking changesets (missing-correct-output !)
170 checking changesets
144 checking manifests (missing-correct-output !)
171 checking manifests
145 crosschecking files in changesets and manifests (missing-correct-output !)
172 crosschecking files in changesets and manifests
146 checking files (missing-correct-output !)
173 checking files
147 checking dirstate (missing-correct-output !)
174 checking dirstate
148 checked 4 changesets with 4 changes to 1 files (missing-correct-output !)
175 checked 4 changesets with 4 changes to 1 files
149 abort: repository clone-while-split not found (known-bad-output !)
150 [255]
General Comments 0
You need to be logged in to leave comments. Login now