tests/test-transaction-rollback-on-revlog-split.t
changeset 50686 a41eeb877d07
parent 50662 12f13b13f414
child 50810 5c3d07950bac
child 50811 5d77a6f37fe1
equal deleted inserted replaced
50685:b9a355763e76 50686:a41eeb877d07
    82   $ files="
    82   $ files="
    83   > file
    83   > file
    84   > Directory_With,Special%Char/Complex_File.babar
    84   > Directory_With,Special%Char/Complex_File.babar
    85   > foo/bar/babar_celeste/foo
    85   > foo/bar/babar_celeste/foo
    86   > 1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/f
    86   > 1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/f
       
    87   > some_dir/sub_dir/foo_bar
       
    88   > some_dir/sub_dir/foo_bar.i.s/tutu
    87   > "
    89   > "
    88   $ for f in $files; do
    90   $ for f in $files; do
    89   >     mkdir -p `dirname $f`
    91   >     mkdir -p `dirname $f`
    90   > done
    92   > done
    91   $ for f in $files; do
    93   $ for f in $files; do
   100   >     printf '%20d' '1' > $f
   102   >     printf '%20d' '1' > $f
   101   > done
   103   > done
   102   $ hg commit -Aqmc
   104   $ hg commit -Aqmc
   103   $ for f in $files; do
   105   $ for f in $files; do
   104   >     dd if=/dev/zero of=$f bs=1k count=128 > /dev/null 2>&1
   106   >     dd if=/dev/zero of=$f bs=1k count=128 > /dev/null 2>&1
       
   107   > done
       
   108   $ hg commit -AqmD --traceback
       
   109   $ for f in $files; do
       
   110   >     dd if=/dev/zero of=$f bs=1k count=132 > /dev/null 2>&1
   105   > done
   111   > done
   106   $ hg commit -AqmD --traceback
   112   $ hg commit -AqmD --traceback
   107 
   113 
   108 Reference size:
   114 Reference size:
   109   $ f -s file
   115   $ f -s file
   110   file: size=131072
   116   file: size=135168
   111   $ f -s .hg/store/data/file*
   117   $ f -s .hg/store/data*/file*
   112   .hg/store/data/file.d: size=132139
   118   .hg/store/data/file.d: size=267307
   113   .hg/store/data/file.i: size=256
   119   .hg/store/data/file.i: size=320
   114 
   120 
   115   $ cd ..
   121   $ cd ..
   116 
   122 
   117 Test a succesful pull
   123 Test a succesful pull
   118 =====================
   124 =====================
   132   pulling from ../troffset-computation
   138   pulling from ../troffset-computation
   133   searching for changes
   139   searching for changes
   134   adding changesets
   140   adding changesets
   135   adding manifests
   141   adding manifests
   136   adding file changes
   142   adding file changes
   137   added 2 changesets with 8 changes to 4 files
   143   added 3 changesets with 18 changes to 6 files
   138   new changesets 16a630ece54e:8437c461d70a
   144   new changesets c99a94cae9b1:64874a3b0160
   139   (run 'hg update' to get a working copy)
   145   (run 'hg update' to get a working copy)
   140 
   146 
   141 
   147 
   142 The inline revlog has been replaced
   148 The inline revlog has been replaced
   143 
   149 
   144   $ f -s .hg/store/data/file*
   150   $ f -s .hg/store/data/file*
   145   .hg/store/data/file.d: size=132139
   151   .hg/store/data/file.d: size=267307
   146   .hg/store/data/file.i: size=256
   152   .hg/store/data/file.i: size=320
   147 
   153 
   148 
   154 
   149   $ hg verify -q
   155   $ hg verify -q
   150   $ cd ..
   156   $ cd ..
   151 
   157 
   169   $ cd troffset-computation-copy
   175   $ cd troffset-computation-copy
   170 
   176 
   171 Reference size:
   177 Reference size:
   172   $ f -s file
   178   $ f -s file
   173   file: size=1024
   179   file: size=1024
   174   $ f -s .hg/store/data/file*
   180   $ f -s .hg/store/data*/file*
   175   .hg/store/data/file.i: size=1174
   181   .hg/store/data/file.i: size=1174
   176 
   182 
   177   $ cat > .hg/hgrc <<EOF
   183   $ cat > .hg/hgrc <<EOF
   178   > [hooks]
   184   > [hooks]
   179   > pretxnchangegroup = python:$TESTTMP/killme.py:killme
   185   > pretxnchangegroup = python:$TESTTMP/killme.py:killme
   190 #endif
   196 #endif
   191 
   197 
   192 
   198 
   193 The inline revlog still exist, but a split version exist next to it
   199 The inline revlog still exist, but a split version exist next to it
   194 
   200 
   195   $ f -s .hg/store/data/file*
   201   $ cat .hg/store/journal | tr '\0' ' ' | grep '\.s'
   196   .hg/store/data/file.d: size=132139
   202   data/some_dir/sub_dir/foo_bar.i.s/tutu.i 1174
       
   203   data/some_dir/sub_dir/foo_bar.i.s/tutu.d 0
       
   204   $ f -s .hg/store/data*/file*
       
   205   .hg/store/data-s/file: size=320
       
   206   .hg/store/data/file.d: size=267307
   197   .hg/store/data/file.i: size=132395
   207   .hg/store/data/file.i: size=132395
   198   .hg/store/data/file.i.s: size=256
       
   199 
   208 
   200 
   209 
   201 The first file.i entry should match the "Reference size" above.
   210 The first file.i entry should match the "Reference size" above.
   202 The first file.d entry is the temporary record during the split,
   211 The first file.d entry is the temporary record during the split,
   203 
   212 
   204 A "temporary file" entry exist for the split index.
   213 A "temporary file" entry exist for the split index.
   205 
   214 
   206   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   215   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   207   data/file.i 1174
   216   data/file.i 1174
   208   data/file.d 0
   217   data/file.d 0
   209   $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep data/file
   218   $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep 'data.*/file'
   210    data/file.i data/journal.backup.file.i.bck 0
   219    data/file.i data/journal.backup.file.i.bck 0
   211    data/file.i.s 0
   220    data-s/file 0
   212 
   221 
   213 recover is rolling the split back, the fncache is still valid
   222 recover is rolling the split back, the fncache is still valid
   214 
   223 
   215   $ hg recover
   224   $ hg recover
   216   rolling back interrupted transaction
   225   rolling back interrupted transaction
   217   (verify step skipped, run `hg verify` to check your repository content)
   226   (verify step skipped, run `hg verify` to check your repository content)
   218   $ f -s .hg/store/data/file*
   227   $ f -s .hg/store/data*/file*
   219   .hg/store/data/file.i: size=1174
   228   .hg/store/data/file.i: size=1174
   220   $ hg tip
   229   $ hg tip
   221   changeset:   1:cc8dfb126534
   230   changeset:   1:64b04c8dc267
   222   tag:         tip
   231   tag:         tip
   223   user:        test
   232   user:        test
   224   date:        Thu Jan 01 00:00:00 1970 +0000
   233   date:        Thu Jan 01 00:00:00 1970 +0000
   225   summary:     b
   234   summary:     b
   226   
   235   
   241   $ cd troffset-computation-copy2
   250   $ cd troffset-computation-copy2
   242 
   251 
   243 Reference size:
   252 Reference size:
   244   $ f -s file
   253   $ f -s file
   245   file: size=1024
   254   file: size=1024
   246   $ f -s .hg/store/data/file*
   255   $ f -s .hg/store/data*/file*
   247   .hg/store/data/file.i: size=1174
   256   .hg/store/data/file.i: size=1174
   248 
   257 
   249   $ cat > .hg/hgrc <<EOF
   258   $ cat > .hg/hgrc <<EOF
   250   > [extensions]
   259   > [extensions]
   251   > intercept_rename = $TESTTMP/intercept_before_rename.py
   260   > intercept_rename = $TESTTMP/intercept_before_rename.py
   269   [137]
   278   [137]
   270 #endif
   279 #endif
   271 
   280 
   272 The inline revlog still exist, but a split version exist next to it
   281 The inline revlog still exist, but a split version exist next to it
   273 
   282 
   274   $ f -s .hg/store/data/file*
   283   $ f -s .hg/store/data*/file*
   275   .hg/store/data/file.d: size=132139
   284   .hg/store/data-s/file: size=320
       
   285   .hg/store/data/file.d: size=267307
   276   .hg/store/data/file.i: size=132395
   286   .hg/store/data/file.i: size=132395
   277   .hg/store/data/file.i.s: size=256
   287 
   278 
   288   $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
   279   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
       
   280   data/file.i 1174
   289   data/file.i 1174
   281   data/file.d 0
   290   data/file.d 0
   282 
   291 
   283 recover is rolling the split back, the fncache is still valid
   292 recover is rolling the split back, the fncache is still valid
   284 
   293 
   285   $ hg recover
   294   $ hg recover
   286   rolling back interrupted transaction
   295   rolling back interrupted transaction
   287   (verify step skipped, run `hg verify` to check your repository content)
   296   (verify step skipped, run `hg verify` to check your repository content)
   288   $ f -s .hg/store/data/file*
   297   $ f -s .hg/store/data*/file*
   289   .hg/store/data/file.i: size=1174
   298   .hg/store/data/file.i: size=1174
   290   $ hg tip
   299   $ hg tip
   291   changeset:   1:cc8dfb126534
   300   changeset:   1:64b04c8dc267
   292   tag:         tip
   301   tag:         tip
   293   user:        test
   302   user:        test
   294   date:        Thu Jan 01 00:00:00 1970 +0000
   303   date:        Thu Jan 01 00:00:00 1970 +0000
   295   summary:     b
   304   summary:     b
   296   
   305   
   306   $ cd troffset-computation-crash-after-rename
   315   $ cd troffset-computation-crash-after-rename
   307 
   316 
   308 Reference size:
   317 Reference size:
   309   $ f -s file
   318   $ f -s file
   310   file: size=1024
   319   file: size=1024
   311   $ f -s .hg/store/data/file*
   320   $ f -s .hg/store/data*/file*
   312   .hg/store/data/file.i: size=1174
   321   .hg/store/data/file.i: size=1174
   313 
   322 
   314   $ cat > .hg/hgrc <<EOF
   323   $ cat > .hg/hgrc <<EOF
   315   > [extensions]
   324   > [extensions]
   316   > intercept_rename = $TESTTMP/intercept_after_rename.py
   325   > intercept_rename = $TESTTMP/intercept_after_rename.py
   334   [137]
   343   [137]
   335 #endif
   344 #endif
   336 
   345 
   337 The inline revlog was over written on disk
   346 The inline revlog was over written on disk
   338 
   347 
   339   $ f -s .hg/store/data/file*
   348   $ f -s .hg/store/data*/file*
   340   .hg/store/data/file.d: size=132139
   349   .hg/store/data/file.d: size=267307
   341   .hg/store/data/file.i: size=256
   350   .hg/store/data/file.i: size=320
   342 
   351 
   343   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   352   $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
   344   data/file.i 1174
   353   data/file.i 1174
   345   data/file.d 0
   354   data/file.d 0
   346 
   355 
   347 recover is rolling the split back, the fncache is still valid
   356 recover is rolling the split back, the fncache is still valid
   348 
   357 
   349   $ hg recover
   358   $ hg recover
   350   rolling back interrupted transaction
   359   rolling back interrupted transaction
   351   (verify step skipped, run `hg verify` to check your repository content)
   360   (verify step skipped, run `hg verify` to check your repository content)
   352   $ f -s .hg/store/data/file*
   361   $ f -s .hg/store/data*/file*
   353   .hg/store/data/file.i: size=1174
   362   .hg/store/data/file.i: size=1174
   354   $ hg tip
   363   $ hg tip
   355   changeset:   1:cc8dfb126534
   364   changeset:   1:64b04c8dc267
   356   tag:         tip
   365   tag:         tip
   357   user:        test
   366   user:        test
   358   date:        Thu Jan 01 00:00:00 1970 +0000
   367   date:        Thu Jan 01 00:00:00 1970 +0000
   359   summary:     b
   368   summary:     b
   360   
   369   
   384   abort: pretxnchangegroup hook exited with status 1
   393   abort: pretxnchangegroup hook exited with status 1
   385   [40]
   394   [40]
   386 
   395 
   387 The split was rollback
   396 The split was rollback
   388 
   397 
   389   $ f -s .hg/store/data/file*
   398   $ f -s .hg/store/data*/file*
   390   .hg/store/data/file.d: size=0
   399   .hg/store/data/file.d: size=0
   391   .hg/store/data/file.i: size=1174
   400   .hg/store/data/file.i: size=1174
   392 
   401 
   393 
   402 
   394   $ hg tip
   403   $ hg tip
   395   changeset:   1:cc8dfb126534
   404   changeset:   1:64b04c8dc267
   396   tag:         tip
   405   tag:         tip
   397   user:        test
   406   user:        test
   398   date:        Thu Jan 01 00:00:00 1970 +0000
   407   date:        Thu Jan 01 00:00:00 1970 +0000
   399   summary:     b
   408   summary:     b
   400   
   409   
   470   pulling from ../troffset-computation
   479   pulling from ../troffset-computation
   471   searching for changes
   480   searching for changes
   472   adding changesets
   481   adding changesets
   473   adding manifests
   482   adding manifests
   474   adding file changes
   483   adding file changes
   475   size=131072
   484   size=135168
   476   transaction abort!
   485   transaction abort!
   477   rollback completed
   486   rollback completed
   478   abort: pretxnclose.03-abort hook exited with status 1
   487   abort: pretxnclose.03-abort hook exited with status 1
   479   [40]
   488   [40]
   480 
   489