Show More
@@ -37,6 +37,9 b' WRITE_MODE_FORCE_NEW = 1' | |||||
37 | WRITE_MODE_FORCE_APPEND = 2 |
|
37 | WRITE_MODE_FORCE_APPEND = 2 | |
38 |
|
38 | |||
39 |
|
39 | |||
|
40 | V2_MAX_READ_ATTEMPTS = 5 | |||
|
41 | ||||
|
42 | ||||
40 | class _dirstatemapcommon: |
|
43 | class _dirstatemapcommon: | |
41 | """ |
|
44 | """ | |
42 | Methods that are identical for both implementations of the dirstatemap |
|
45 | Methods that are identical for both implementations of the dirstatemap | |
@@ -125,6 +128,21 b' class _dirstatemapcommon:' | |||||
125 | return self._docket |
|
128 | return self._docket | |
126 |
|
129 | |||
127 | def _read_v2_data(self): |
|
130 | def _read_v2_data(self): | |
|
131 | data = None | |||
|
132 | attempts = 0 | |||
|
133 | while attempts < V2_MAX_READ_ATTEMPTS: | |||
|
134 | attempts += 1 | |||
|
135 | try: | |||
|
136 | data = self._opener.read(self.docket.data_filename()) | |||
|
137 | except FileNotFoundError: | |||
|
138 | # read race detected between docket and data file | |||
|
139 | # reload the docket and retry | |||
|
140 | self._docket = None | |||
|
141 | if data is None: | |||
|
142 | assert attempts >= V2_MAX_READ_ATTEMPTS | |||
|
143 | msg = b"dirstate read race happened %d times in a row" | |||
|
144 | msg %= attempts | |||
|
145 | raise error.Abort(msg) | |||
128 | return self._opener.read(self.docket.data_filename()) |
|
146 | return self._opener.read(self.docket.data_filename()) | |
129 |
|
147 | |||
130 | def write_v2_no_append(self, tr, st, meta, packed): |
|
148 | def write_v2_no_append(self, tr, st, meta, packed): |
@@ -217,8 +217,12 b' The status process should return a consi' | |||||
217 | #endif |
|
217 | #endif | |
218 | #else |
|
218 | #else | |
219 | $ cat $TESTTMP/status-race-lock.out |
|
219 | $ cat $TESTTMP/status-race-lock.out | |
|
220 | A dir/n | |||
|
221 | A dir/o | |||
|
222 | R dir/nested/m | |||
|
223 | ? p | |||
|
224 | ? q | |||
220 | $ cat $TESTTMP/status-race-lock.log |
|
225 | $ cat $TESTTMP/status-race-lock.log | |
221 | abort: $ENOENT$: '$TESTTMP/race-with-add/.hg/dirstate.* (glob) |
|
|||
222 |
|
|
226 | #endif | |
223 |
|
|
227 | #endif | |
224 |
|
|
228 | #endif | |
@@ -318,8 +322,12 b' The status process should return a consi' | |||||
318 | #endif |
|
322 | #endif | |
319 | #else |
|
323 | #else | |
320 | $ cat $TESTTMP/status-race-lock.out |
|
324 | $ cat $TESTTMP/status-race-lock.out | |
|
325 | M dir/o | |||
|
326 | ? dir/n | |||
|
327 | ? p | |||
|
328 | ? q | |||
321 | $ cat $TESTTMP/status-race-lock.log |
|
329 | $ cat $TESTTMP/status-race-lock.log | |
322 | abort: $ENOENT$: '$TESTTMP/race-with-commit/.hg/dirstate.* (glob) |
|
330 | warning: ignoring unknown working parent 02a67a77ee9b! | |
323 | #endif |
|
331 | #endif | |
324 | #endif |
|
332 | #endif | |
325 | #endif |
|
333 | #endif | |
@@ -452,8 +460,11 b' The status process should return a consi' | |||||
452 | #endif |
|
460 | #endif | |
453 | #else |
|
461 | #else | |
454 | $ cat $TESTTMP/status-race-lock.out |
|
462 | $ cat $TESTTMP/status-race-lock.out | |
|
463 | A dir/o | |||
|
464 | ? dir/n | |||
|
465 | ? p | |||
|
466 | ? q | |||
455 | $ cat $TESTTMP/status-race-lock.log |
|
467 | $ cat $TESTTMP/status-race-lock.log | |
456 | abort: $ENOENT$: '$TESTTMP/race-with-update/.hg/dirstate.* (glob) |
|
|||
457 |
|
|
468 | #endif | |
458 |
|
|
469 | #endif | |
459 |
|
|
470 | #endif | |
@@ -542,8 +553,12 b' The status process should return a consi' | |||||
542 | #endif |
|
553 | #endif | |
543 | #else |
|
554 | #else | |
544 | $ cat $TESTTMP/status-race-lock.out |
|
555 | $ cat $TESTTMP/status-race-lock.out | |
|
556 | A dir/o | |||
|
557 | R dir/nested/m | |||
|
558 | ? dir/n | |||
|
559 | ? p | |||
|
560 | ? q | |||
545 | $ cat $TESTTMP/status-race-lock.log |
|
561 | $ cat $TESTTMP/status-race-lock.log | |
546 | abort: $ENOENT$: '$TESTTMP/race-with-status/.hg/dirstate.* (glob) |
|
|||
547 | #endif |
|
562 | #endif | |
548 | #endif |
|
563 | #endif | |
549 | #endif |
|
564 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now