##// END OF EJS Templates
revlogv2: delay the update of the changelog docket to transaction end...
marmoute -
r48013:682f0985 default
parent child Browse files
Show More
@@ -443,12 +443,13 b' class changelog(revlog.revlog):'
443 self._filteredrevs = val
443 self._filteredrevs = val
444 self._filteredrevs_hashcache = {}
444 self._filteredrevs_hashcache = {}
445
445
446 def _write_docket(self, tr):
447 if not self._delayed:
448 super(changelog, self)._write_docket(tr)
449
446 def delayupdate(self, tr):
450 def delayupdate(self, tr):
447 """delay visibility of index updates to other readers"""
451 """delay visibility of index updates to other readers"""
448 if self._docket is not None:
452 if self._docket is None and not self._delayed:
449 return
450
451 if not self._delayed:
452 if len(self) == 0:
453 if len(self) == 0:
453 self._divert = True
454 self._divert = True
454 if self._realopener.exists(self._indexfile + b'.a'):
455 if self._realopener.exists(self._indexfile + b'.a'):
@@ -468,7 +469,9 b' class changelog(revlog.revlog):'
468 self._delayed = False
469 self._delayed = False
469 self.opener = self._realopener
470 self.opener = self._realopener
470 # move redirected index data back into place
471 # move redirected index data back into place
471 if self._divert:
472 if self._docket is not None:
473 self._write_docket(tr)
474 elif self._divert:
472 assert not self._delaybuf
475 assert not self._delaybuf
473 tmpname = self._indexfile + b".a"
476 tmpname = self._indexfile + b".a"
474 nfile = self.opener.open(tmpname)
477 nfile = self.opener.open(tmpname)
@@ -1150,7 +1150,6 b' coreconfigitem('
1150 )
1150 )
1151 # "out of experimental" todo list.
1151 # "out of experimental" todo list.
1152 #
1152 #
1153 # * properly hide uncommitted content to other process
1154 # * expose transaction content hooks during pre-commit validation
1153 # * expose transaction content hooks during pre-commit validation
1155 # * include management of a persistent nodemap in the main docket
1154 # * include management of a persistent nodemap in the main docket
1156 # * enforce a "no-truncate" policy for mmap safety
1155 # * enforce a "no-truncate" policy for mmap safety
@@ -2096,7 +2096,7 b' class revlog(object):'
2096 try:
2096 try:
2097 yield
2097 yield
2098 if self._docket is not None:
2098 if self._docket is not None:
2099 self._docket.write(transaction)
2099 self._write_docket(transaction)
2100 finally:
2100 finally:
2101 self._writinghandles = None
2101 self._writinghandles = None
2102 finally:
2102 finally:
@@ -2105,6 +2105,15 b' class revlog(object):'
2105 if dfh is not None:
2105 if dfh is not None:
2106 dfh.close()
2106 dfh.close()
2107
2107
2108 def _write_docket(self, transaction):
2109 """write the current docket on disk
2110
2111 Exist as a method to help changelog to implement transaction logic
2112
2113 We could also imagine using the same transaction logic for all revlog
2114 since docket are cheap."""
2115 self._docket.write(transaction)
2116
2108 def addrevision(
2117 def addrevision(
2109 self,
2118 self,
2110 text,
2119 text,
@@ -3187,18 +3196,6 b' class revlog(object):'
3187 # Nothing to generate or remove
3196 # Nothing to generate or remove
3188 return
3197 return
3189
3198
3190 # changelog implement some "delayed" writing mechanism that assume that
3191 # all index data is writen in append mode and is therefor incompatible
3192 # with the seeked write done in this method. The use of such "delayed"
3193 # writing will soon be removed for revlog version that support side
3194 # data, so for now, we only keep this simple assert to highlight the
3195 # situation.
3196 delayed = getattr(self, '_delayed', False)
3197 diverted = getattr(self, '_divert', False)
3198 if delayed and not diverted:
3199 msg = "cannot rewrite_sidedata of a delayed revlog"
3200 raise error.ProgrammingError(msg)
3201
3202 new_entries = []
3199 new_entries = []
3203 # append the new sidedata
3200 # append the new sidedata
3204 with self._writing(transaction):
3201 with self._writing(transaction):
@@ -46,13 +46,13 b' synchronisation+output script:'
46 $ cat << EOF > script/external.sh
46 $ cat << EOF > script/external.sh
47 > #!/bin/sh
47 > #!/bin/sh
48 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_UNLOCK $HG_TEST_FILE_EXT_WAITING
48 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_UNLOCK $HG_TEST_FILE_EXT_WAITING
49 > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > $TESTTMP/output/external.out
49 > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > $TESTTMP/output/external.out 2>/dev/null
50 > touch $HG_TEST_FILE_EXT_DONE
50 > touch $HG_TEST_FILE_EXT_DONE
51 > EOF
51 > EOF
52 $ chmod +x script/external.sh
52 $ chmod +x script/external.sh
53 $ cat << EOF > script/internal.sh
53 $ cat << EOF > script/internal.sh
54 > #!/bin/sh
54 > #!/bin/sh
55 > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > $TESTTMP/output/internal.out
55 > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > $TESTTMP/output/internal.out 2>/dev/null
56 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_DONE $HG_TEST_FILE_EXT_UNLOCK
56 > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_DONE $HG_TEST_FILE_EXT_UNLOCK
57 > EOF
57 > EOF
58 $ chmod +x script/internal.sh
58 $ chmod +x script/internal.sh
@@ -123,9 +123,9 b' the repository should still be inline (f'
123
123
124 $ make_one_commit first
124 $ make_one_commit first
125 pre-commit: -1
125 pre-commit: -1
126 external: -1 (revlogv1 !)
126 external: -1
127 external: 0 first (revlogv2 known-bad-output !)
127 internal: 0 first (revlogv1 !)
128 internal: 0 first
128 internal: -1 (revlogv2 known-bad-output !)
129 post-tr: 0 first
129 post-tr: 0 first
130
130
131 #if revlogv1
131 #if revlogv1
@@ -149,9 +149,9 b' the repository should still be inline (f'
149
149
150 $ make_one_commit second
150 $ make_one_commit second
151 pre-commit: 0 first
151 pre-commit: 0 first
152 external: 0 first (revlogv1 !)
152 external: 0 first
153 external: 1 second (revlogv2 known-bad-output !)
153 internal: 1 second (revlogv1 !)
154 internal: 1 second
154 internal: 0 first (revlogv2 known-bad-output !)
155 post-tr: 1 second
155 post-tr: 1 second
156
156
157 #if revlogv1
157 #if revlogv1
@@ -176,9 +176,9 b' the repository should still be inline (f'
176 $ make_one_pull 3
176 $ make_one_pull 3
177 pre-commit: 1 second
177 pre-commit: 1 second
178 warning: repository is unrelated
178 warning: repository is unrelated
179 external: 1 second (revlogv1 !)
179 external: 1 second
180 external: 5 r3 (revlogv2 known-bad-output !)
180 internal: 5 r3 (revlogv1 !)
181 internal: 5 r3
181 internal: 1 second (revlogv2 known-bad-output !)
182 post-tr: 5 r3
182 post-tr: 5 r3
183
183
184 #if revlogv1
184 #if revlogv1
@@ -202,9 +202,9 b' the repository should no longer be inlin'
202
202
203 $ make_one_pull 400
203 $ make_one_pull 400
204 pre-commit: 5 r3
204 pre-commit: 5 r3
205 external: 5 r3 (revlogv1 !)
205 external: 5 r3
206 external: 402 r400 (revlogv2 known-bad-output !)
206 internal: 402 r400 (revlogv1 !)
207 internal: 402 r400
207 internal: 5 r3 (revlogv2 known-bad-output !)
208 post-tr: 402 r400
208 post-tr: 402 r400
209
209
210 #if revlogv1
210 #if revlogv1
@@ -228,9 +228,9 b' the repository should no longer be inlin'
228
228
229 $ make_one_commit third
229 $ make_one_commit third
230 pre-commit: 402 r400
230 pre-commit: 402 r400
231 external: 402 r400 (revlogv1 !)
231 external: 402 r400
232 external: 403 third (revlogv2 known-bad-output !)
232 internal: 403 third (revlogv1 !)
233 internal: 403 third
233 internal: 402 r400 (revlogv2 known-bad-output !)
234 post-tr: 403 third
234 post-tr: 403 third
235
235
236 #if revlogv1
236 #if revlogv1
@@ -255,9 +255,9 b' the repository should no longer be inlin'
255
255
256 $ make_one_pull tip
256 $ make_one_pull tip
257 pre-commit: 403 third
257 pre-commit: 403 third
258 external: 403 third (revlogv1 !)
258 external: 403 third
259 external: 503 r500 (revlogv2 known-bad-output !)
259 internal: 503 r500 (revlogv1 !)
260 internal: 503 r500
260 internal: 403 third (revlogv2 known-bad-output !)
261 post-tr: 503 r500
261 post-tr: 503 r500
262
262
263 #if revlogv1
263 #if revlogv1
General Comments 0
You need to be logged in to leave comments. Login now