tests/test-transaction-rollback-on-revlog-split.t
author Joerg Sonnenberger <joerg@bec.de>
Tue, 18 May 2021 02:35:27 +0200
changeset 47295 21ed126bab53
child 47296 46b828b85eb7
permissions -rw-r--r--
revlog: fix index computation during inline->non-inline transition The computation in 63edc384d3b7 failed to factor in the index entries themselve as revlog.start() doesn't count them. Found by Valtenin Gatienbaron with a more precise test case from me. Differential Revision: https://phab.mercurial-scm.org/D10724
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47295
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
Test correctness of revlog inline -> non-inline transition
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
----------------------------------------------------------
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     3
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     4
Test offset computation to correctly factor in the index entries themselve.
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     5
Test repo has one small, one moderate and one big change. The clone has
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     6
the small and moderate change and will transition to non-inline storage when
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     7
adding the big change.
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     8
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     9
  $ hg init troffset-computation --config format.revlog-compression=none
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    10
  $ cd troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    11
  $ printf '% 20d' '1' > file
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    12
  $ hg commit -Aqm_
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    13
  $ printf '% 1024d' '1' > file
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    14
  $ hg commit -Aqm_
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    15
  $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    16
  $ hg commit -Aqm_
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    17
  $ cd ..
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    18
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    19
  $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
  $ cd troffset-computation-copy
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
  $ cat > .hg/hgrc <<EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
  > [hooks]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
  > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
  > EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
#if chg
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    27
  pulling from ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    28
  [255]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    29
#else
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    30
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    31
  pulling from ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    32
  [80]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    33
#endif
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    34
  $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    35
  data/file.i 128