Show More
@@ -485,7 +485,9 b' def synchronize_hg(source_path: pathlib.' | |||||
485 | 'python2.7', str(hg_bin), |
|
485 | 'python2.7', str(hg_bin), | |
486 | '--config', 'ui.ssh=ssh -F %s' % ssh_config, |
|
486 | '--config', 'ui.ssh=ssh -F %s' % ssh_config, | |
487 | '--config', 'ui.remotecmd=/hgdev/venv-bootstrap/bin/hg', |
|
487 | '--config', 'ui.remotecmd=/hgdev/venv-bootstrap/bin/hg', | |
488 | 'push', '-f', '-r', full_revision, |
|
488 | # Also ensure .hgtags changes are present so auto version | |
|
489 | # calculation works. | |||
|
490 | 'push', '-f', '-r', full_revision, '-r', 'file(.hgtags)', | |||
489 | 'ssh://%s//hgwork/src' % public_ip, |
|
491 | 'ssh://%s//hgwork/src' % public_ip, | |
490 | ] |
|
492 | ] | |
491 |
|
493 |
@@ -176,7 +176,9 b' def synchronize_hg(hg_repo: pathlib.Path' | |||||
176 | 'python2.7', hg_bin, |
|
176 | 'python2.7', hg_bin, | |
177 | '--config', 'ui.ssh=ssh -F %s' % ssh_config, |
|
177 | '--config', 'ui.ssh=ssh -F %s' % ssh_config, | |
178 | '--config', 'ui.remotecmd=c:/hgdev/venv-bootstrap/Scripts/hg.exe', |
|
178 | '--config', 'ui.remotecmd=c:/hgdev/venv-bootstrap/Scripts/hg.exe', | |
179 | 'push', '-f', '-r', full_revision, |
|
179 | # Also ensure .hgtags changes are present so auto version | |
|
180 | # calculation works. | |||
|
181 | 'push', '-f', '-r', full_revision, '-r', 'file(.hgtags)', | |||
180 | 'ssh://%s/c:/hgdev/src' % public_ip, |
|
182 | 'ssh://%s/c:/hgdev/src' % public_ip, | |
181 | ] |
|
183 | ] | |
182 |
|
184 |
@@ -1227,6 +1227,55 b' class localrepository(object):' | |||||
1227 | @mixedrepostorecache(('bookmarks', 'plain'), ('bookmarks.current', 'plain'), |
|
1227 | @mixedrepostorecache(('bookmarks', 'plain'), ('bookmarks.current', 'plain'), | |
1228 | ('bookmarks', ''), ('00changelog.i', '')) |
|
1228 | ('bookmarks', ''), ('00changelog.i', '')) | |
1229 | def _bookmarks(self): |
|
1229 | def _bookmarks(self): | |
|
1230 | # Since the multiple files involved in the transaction cannot be | |||
|
1231 | # written atomically (with current repository format), there is a race | |||
|
1232 | # condition here. | |||
|
1233 | # | |||
|
1234 | # 1) changelog content A is read | |||
|
1235 | # 2) outside transaction update changelog to content B | |||
|
1236 | # 3) outside transaction update bookmark file referring to content B | |||
|
1237 | # 4) bookmarks file content is read and filtered against changelog-A | |||
|
1238 | # | |||
|
1239 | # When this happens, bookmarks against nodes missing from A are dropped. | |||
|
1240 | # | |||
|
1241 | # Having this happening during read is not great, but it become worse | |||
|
1242 | # when this happen during write because the bookmarks to the "unknown" | |||
|
1243 | # nodes will be dropped for good. However, writes happen within locks. | |||
|
1244 | # This locking makes it possible to have a race free consistent read. | |||
|
1245 | # For this purpose data read from disc before locking are | |||
|
1246 | # "invalidated" right after the locks are taken. This invalidations are | |||
|
1247 | # "light", the `filecache` mechanism keep the data in memory and will | |||
|
1248 | # reuse them if the underlying files did not changed. Not parsing the | |||
|
1249 | # same data multiple times helps performances. | |||
|
1250 | # | |||
|
1251 | # Unfortunately in the case describe above, the files tracked by the | |||
|
1252 | # bookmarks file cache might not have changed, but the in-memory | |||
|
1253 | # content is still "wrong" because we used an older changelog content | |||
|
1254 | # to process the on-disk data. So after locking, the changelog would be | |||
|
1255 | # refreshed but `_bookmarks` would be preserved. | |||
|
1256 | # Adding `00changelog.i` to the list of tracked file is not | |||
|
1257 | # enough, because at the time we build the content for `_bookmarks` in | |||
|
1258 | # (4), the changelog file has already diverged from the content used | |||
|
1259 | # for loading `changelog` in (1) | |||
|
1260 | # | |||
|
1261 | # To prevent the issue, we force the changelog to be explicitly | |||
|
1262 | # reloaded while computing `_bookmarks`. The data race can still happen | |||
|
1263 | # without the lock (with a narrower window), but it would no longer go | |||
|
1264 | # undetected during the lock time refresh. | |||
|
1265 | # | |||
|
1266 | # The new schedule is as follow | |||
|
1267 | # | |||
|
1268 | # 1) filecache logic detect that `_bookmarks` needs to be computed | |||
|
1269 | # 2) cachestat for `bookmarks` and `changelog` are captured (for book) | |||
|
1270 | # 3) We force `changelog` filecache to be tested | |||
|
1271 | # 4) cachestat for `changelog` are captured (for changelog) | |||
|
1272 | # 5) `_bookmarks` is computed and cached | |||
|
1273 | # | |||
|
1274 | # The step in (3) ensure we have a changelog at least as recent as the | |||
|
1275 | # cache stat computed in (1). As a result at locking time: | |||
|
1276 | # * if the changelog did not changed since (1) -> we can reuse the data | |||
|
1277 | # * otherwise -> the bookmarks get refreshed. | |||
|
1278 | self._refreshchangelog() | |||
1230 | return bookmarks.bmstore(self) |
|
1279 | return bookmarks.bmstore(self) | |
1231 |
|
1280 | |||
1232 | def _refreshchangelog(self): |
|
1281 | def _refreshchangelog(self): |
@@ -109,6 +109,9 b' def strip(ui, repo, nodelist, backup=Tru' | |||||
109 | repo = repo.unfiltered() |
|
109 | repo = repo.unfiltered() | |
110 | repo.destroying() |
|
110 | repo.destroying() | |
111 | vfs = repo.vfs |
|
111 | vfs = repo.vfs | |
|
112 | # load bookmark before changelog to avoid side effect from outdated | |||
|
113 | # changelog (see repo._refreshchangelog) | |||
|
114 | repo._bookmarks | |||
112 | cl = repo.changelog |
|
115 | cl = repo.changelog | |
113 |
|
116 | |||
114 | # TODO handle undo of merge sets |
|
117 | # TODO handle undo of merge sets |
@@ -200,6 +200,7 b' Check raced push output.' | |||||
200 | $ cat push-output.txt |
|
200 | $ cat push-output.txt | |
201 | pushing to ssh://user@dummy/bookrace-server |
|
201 | pushing to ssh://user@dummy/bookrace-server | |
202 | searching for changes |
|
202 | searching for changes | |
|
203 | remote has heads on branch 'default' that are not known locally: f26c3b5167d1 | |||
203 | remote: setting raced push up |
|
204 | remote: setting raced push up | |
204 | remote: adding changesets |
|
205 | remote: adding changesets | |
205 | remote: adding manifests |
|
206 | remote: adding manifests | |
@@ -219,7 +220,7 b' Check result of the push.' | |||||
219 | | summary: A1 |
|
220 | | summary: A1 | |
220 | | |
|
221 | | | |
221 | | o changeset: 3:f26c3b5167d1 |
|
222 | | o changeset: 3:f26c3b5167d1 | |
222 |
| | bookmark: book-B |
|
223 | | | bookmark: book-B | |
223 | | | user: test |
|
224 | | | user: test | |
224 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
225 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
225 | | | summary: B1 |
|
226 | | | summary: B1 | |
@@ -242,4 +243,4 b' Check result of the push.' | |||||
242 |
|
243 | |||
243 | $ hg -R bookrace-server book |
|
244 | $ hg -R bookrace-server book | |
244 | book-A 4:9ce3b28c16de |
|
245 | book-A 4:9ce3b28c16de | |
245 |
book-B 3:f26c3b5167d1 |
|
246 | book-B 3:f26c3b5167d1 |
@@ -9,10 +9,10 b'' | |||||
9 | $ teststrip() { |
|
9 | $ teststrip() { | |
10 | > hg up -C $1 |
|
10 | > hg up -C $1 | |
11 | > echo % before update $1, strip $2 |
|
11 | > echo % before update $1, strip $2 | |
12 | > hg parents |
|
12 | > hg log -G -T '{rev}:{node}' | |
13 | > hg --traceback strip $2 |
|
13 | > hg --traceback strip $2 | |
14 | > echo % after update $1, strip $2 |
|
14 | > echo % after update $1, strip $2 | |
15 | > hg parents |
|
15 | > hg log -G -T '{rev}:{node}' | |
16 | > restore |
|
16 | > restore | |
17 | > } |
|
17 | > } | |
18 |
|
18 | |||
@@ -70,95 +70,136 b'' | |||||
70 | $ teststrip 4 4 |
|
70 | $ teststrip 4 4 | |
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
72 | % before update 4, strip 4 |
|
72 | % before update 4, strip 4 | |
73 | changeset: 4:443431ffac4f |
|
73 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
74 | tag: tip |
|
74 | | | |
75 | user: test |
|
75 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
76 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
76 | | | |
77 | summary: e |
|
77 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
|
78 | |/ | |||
|
79 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
80 | | | |||
|
81 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
78 |
|
82 | |||
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
80 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
84 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
81 | % after update 4, strip 4 |
|
85 | % after update 4, strip 4 | |
82 | changeset: 3:65bd5f99a4a3 |
|
86 | @ 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
83 | tag: tip |
|
87 | | | |
84 | parent: 1:ef3a871183d7 |
|
88 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
85 | user: test |
|
89 | |/ | |
86 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
90 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |
87 | summary: d |
|
91 | | | |
|
92 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
88 |
|
93 | |||
89 |
$ |
|
94 | $ teststrip 4 3 | |
90 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
95 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
91 | % before update 4, strip 3 |
|
96 | % before update 4, strip 3 | |
92 | changeset: 4:443431ffac4f |
|
97 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
93 | tag: tip |
|
98 | | | |
94 | user: test |
|
99 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
95 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
100 | | | |
96 | summary: e |
|
101 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
|
102 | |/ | |||
|
103 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
104 | | | |||
|
105 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
97 |
|
106 | |||
98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
108 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
100 | % after update 4, strip 3 |
|
109 | % after update 4, strip 3 | |
101 | changeset: 1:ef3a871183d7 |
|
110 | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
102 | user: test |
|
111 | | | |
103 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
112 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |
104 | summary: b |
|
113 | | | |
|
114 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
105 |
|
115 | |||
106 |
$ |
|
116 | $ teststrip 1 4 | |
107 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
117 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
108 | % before update 1, strip 4 |
|
118 | % before update 1, strip 4 | |
109 | changeset: 1:ef3a871183d7 |
|
119 | o 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
110 | user: test |
|
120 | | | |
111 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
121 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
112 | summary: b |
|
122 | | | |
|
123 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |||
|
124 | |/ | |||
|
125 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
126 | | | |||
|
127 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
113 |
|
128 | |||
114 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
129 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
115 | % after update 1, strip 4 |
|
130 | % after update 1, strip 4 | |
116 | changeset: 1:ef3a871183d7 |
|
131 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
117 | user: test |
|
132 | | | |
118 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
133 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
119 | summary: b |
|
134 | |/ | |
|
135 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
136 | | | |||
|
137 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
120 |
|
138 | |||
121 |
$ |
|
139 | $ teststrip 4 2 | |
122 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
140 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
123 | % before update 4, strip 2 |
|
141 | % before update 4, strip 2 | |
124 | changeset: 4:443431ffac4f |
|
142 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
125 | tag: tip |
|
143 | | | |
126 | user: test |
|
144 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
127 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
145 | | | |
128 | summary: e |
|
146 | | o 2:264128213d290d868c54642d13aeaa3675551a78 | |
|
147 | |/ | |||
|
148 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
149 | | | |||
|
150 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
129 |
|
151 | |||
130 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
152 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
131 | % after update 4, strip 2 |
|
153 | % after update 4, strip 2 | |
132 | changeset: 3:443431ffac4f |
|
154 | @ 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
133 | tag: tip |
|
155 | | | |
134 | user: test |
|
156 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
135 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
157 | | | |
136 | summary: e |
|
158 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |
|
159 | | | |||
|
160 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
137 |
|
161 | |||
138 |
$ |
|
162 | $ teststrip 4 1 | |
139 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
163 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
140 | % before update 4, strip 1 |
|
164 | % before update 4, strip 1 | |
141 | changeset: 4:264128213d29 |
|
165 | @ 4:264128213d290d868c54642d13aeaa3675551a78 | |
142 | tag: tip |
|
166 | | | |
143 | parent: 1:ef3a871183d7 |
|
167 | | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |
144 | user: test |
|
168 | | | | |
145 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
169 | | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |
146 | summary: c |
|
170 | |/ | |
|
171 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
172 | | | |||
|
173 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
147 |
|
174 | |||
148 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
149 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
176 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
150 | % after update 4, strip 1 |
|
177 | % after update 4, strip 1 | |
151 | changeset: 0:9ab35a2d17cb |
|
178 | @ 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |
152 | tag: tip |
|
|||
153 | user: test |
|
|||
154 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
|||
155 | summary: a |
|
|||
156 |
|
179 | |||
157 |
$ |
|
180 | $ teststrip null 4 | |
158 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
181 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
159 | % before update null, strip 4 |
|
182 | % before update null, strip 4 | |
|
183 | o 4:264128213d290d868c54642d13aeaa3675551a78 | |||
|
184 | | | |||
|
185 | | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |||
|
186 | | | | |||
|
187 | | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |||
|
188 | |/ | |||
|
189 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
190 | | | |||
|
191 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
|
192 | ||||
160 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
193 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
161 | % after update null, strip 4 |
|
194 | % after update null, strip 4 | |
|
195 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce | |||
|
196 | | | |||
|
197 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 | |||
|
198 | | | |||
|
199 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a | |||
|
200 | | | |||
|
201 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b | |||
|
202 | ||||
162 |
|
203 | |||
163 |
$ |
|
204 | $ hg log | |
164 | changeset: 4:264128213d29 |
|
205 | changeset: 4:264128213d29 |
General Comments 0
You need to be logged in to leave comments.
Login now