##// END OF EJS Templates
merge with stable
Yuya Nishihara -
r42912:863e9e7f merge default
parent child Browse files
Show More
@@ -485,7 +485,9 b' def synchronize_hg(source_path: pathlib.'
485 485 'python2.7', str(hg_bin),
486 486 '--config', 'ui.ssh=ssh -F %s' % ssh_config,
487 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 491 'ssh://%s//hgwork/src' % public_ip,
490 492 ]
491 493
@@ -176,7 +176,9 b' def synchronize_hg(hg_repo: pathlib.Path'
176 176 'python2.7', hg_bin,
177 177 '--config', 'ui.ssh=ssh -F %s' % ssh_config,
178 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 182 'ssh://%s/c:/hgdev/src' % public_ip,
181 183 ]
182 184
@@ -1227,6 +1227,55 b' class localrepository(object):'
1227 1227 @mixedrepostorecache(('bookmarks', 'plain'), ('bookmarks.current', 'plain'),
1228 1228 ('bookmarks', ''), ('00changelog.i', ''))
1229 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 1279 return bookmarks.bmstore(self)
1231 1280
1232 1281 def _refreshchangelog(self):
@@ -109,6 +109,9 b' def strip(ui, repo, nodelist, backup=Tru'
109 109 repo = repo.unfiltered()
110 110 repo.destroying()
111 111 vfs = repo.vfs
112 # load bookmark before changelog to avoid side effect from outdated
113 # changelog (see repo._refreshchangelog)
114 repo._bookmarks
112 115 cl = repo.changelog
113 116
114 117 # TODO handle undo of merge sets
@@ -200,6 +200,7 b' Check raced push output.'
200 200 $ cat push-output.txt
201 201 pushing to ssh://user@dummy/bookrace-server
202 202 searching for changes
203 remote has heads on branch 'default' that are not known locally: f26c3b5167d1
203 204 remote: setting raced push up
204 205 remote: adding changesets
205 206 remote: adding manifests
@@ -219,7 +220,7 b' Check result of the push.'
219 220 | summary: A1
220 221 |
221 222 | o changeset: 3:f26c3b5167d1
222 | | bookmark: book-B (false !)
223 | | bookmark: book-B
223 224 | | user: test
224 225 | | date: Thu Jan 01 00:00:00 1970 +0000
225 226 | | summary: B1
@@ -242,4 +243,4 b' Check result of the push.'
242 243
243 244 $ hg -R bookrace-server book
244 245 book-A 4:9ce3b28c16de
245 book-B 3:f26c3b5167d1 (false !)
246 book-B 3:f26c3b5167d1
@@ -9,10 +9,10 b''
9 9 $ teststrip() {
10 10 > hg up -C $1
11 11 > echo % before update $1, strip $2
12 > hg parents
12 > hg log -G -T '{rev}:{node}'
13 13 > hg --traceback strip $2
14 14 > echo % after update $1, strip $2
15 > hg parents
15 > hg log -G -T '{rev}:{node}'
16 16 > restore
17 17 > }
18 18
@@ -70,95 +70,136 b''
70 70 $ teststrip 4 4
71 71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 72 % before update 4, strip 4
73 changeset: 4:443431ffac4f
74 tag: tip
75 user: test
76 date: Thu Jan 01 00:00:00 1970 +0000
77 summary: e
73 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
74 |
75 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
76 |
77 | o 2:264128213d290d868c54642d13aeaa3675551a78
78 |/
79 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
80 |
81 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
78 82
79 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 84 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
81 85 % after update 4, strip 4
82 changeset: 3:65bd5f99a4a3
83 tag: tip
84 parent: 1:ef3a871183d7
85 user: test
86 date: Thu Jan 01 00:00:00 1970 +0000
87 summary: d
86 @ 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
87 |
88 | o 2:264128213d290d868c54642d13aeaa3675551a78
89 |/
90 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
91 |
92 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
88 93
89 94 $ teststrip 4 3
90 95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 96 % before update 4, strip 3
92 changeset: 4:443431ffac4f
93 tag: tip
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: e
97 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
98 |
99 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
100 |
101 | o 2:264128213d290d868c54642d13aeaa3675551a78
102 |/
103 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
104 |
105 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
97 106
98 107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 108 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
100 109 % after update 4, strip 3
101 changeset: 1:ef3a871183d7
102 user: test
103 date: Thu Jan 01 00:00:00 1970 +0000
104 summary: b
110 o 2:264128213d290d868c54642d13aeaa3675551a78
111 |
112 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
113 |
114 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
105 115
106 116 $ teststrip 1 4
107 117 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 118 % before update 1, strip 4
109 changeset: 1:ef3a871183d7
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: b
119 o 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
120 |
121 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
122 |
123 | o 2:264128213d290d868c54642d13aeaa3675551a78
124 |/
125 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
126 |
127 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
113 128
114 129 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
115 130 % after update 1, strip 4
116 changeset: 1:ef3a871183d7
117 user: test
118 date: Thu Jan 01 00:00:00 1970 +0000
119 summary: b
131 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
132 |
133 | o 2:264128213d290d868c54642d13aeaa3675551a78
134 |/
135 @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a
136 |
137 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
120 138
121 139 $ teststrip 4 2
122 140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 141 % before update 4, strip 2
124 changeset: 4:443431ffac4f
125 tag: tip
126 user: test
127 date: Thu Jan 01 00:00:00 1970 +0000
128 summary: e
142 @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
143 |
144 o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64
145 |
146 | o 2:264128213d290d868c54642d13aeaa3675551a78
147 |/
148 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
149 |
150 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
129 151
130 152 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
131 153 % after update 4, strip 2
132 changeset: 3:443431ffac4f
133 tag: tip
134 user: test
135 date: Thu Jan 01 00:00:00 1970 +0000
136 summary: e
154 @ 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
155 |
156 o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
157 |
158 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
159 |
160 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
137 161
138 162 $ teststrip 4 1
139 163 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 164 % before update 4, strip 1
141 changeset: 4:264128213d29
142 tag: tip
143 parent: 1:ef3a871183d7
144 user: test
145 date: Thu Jan 01 00:00:00 1970 +0000
146 summary: c
165 @ 4:264128213d290d868c54642d13aeaa3675551a78
166 |
167 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
168 | |
169 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64
170 |/
171 o 1:ef3a871183d7199c541cc140218298bbfcc6c28a
172 |
173 o 0:9ab35a2d17cb64271241ea881efcc19dd953215b
147 174
148 175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 176 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
150 177 % after update 4, strip 1
151 changeset: 0:9ab35a2d17cb
152 tag: tip
153 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: a
178 @ 0:9ab35a2d17cb64271241ea881efcc19dd953215b
156 179
157 180 $ teststrip null 4
158 181 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 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 193 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
161 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 205 changeset: 4:264128213d29
General Comments 0
You need to be logged in to leave comments. Login now