Mercurial > hg
view tests/test-transaction-rollback-on-sigpipe.t @ 46095:93e09d370003
treemanifest: stop storing full path for each item in manifest._lazydirs
This information is obtainable, if needed, based on the lazydirs key (which is
the entry name) and the manifest's `dir()` method.
### Performance
This is actually both a memory and a performance improvement, but it's likely to
be a very small one in most situations. In the pathological repo I've been using
for testing other performance work I've done recently, this reduced the time for
a rebase operation (rebasing two commits across a public-phase change that
touches a sibling of one of my tracked directories where the common parent is
massive (>>10k entries)):
#### Before
```
Time (mean ± σ): 4.059 s ± 0.121 s [User: 0.9 ms, System: 0.6 ms]
Range (min … max): 3.941 s … 4.352 s 10 runs
```
#### After
```
Time (mean ± σ): 3.707 s ± 0.060 s [User: 0.8 ms, System: 0.8 ms]
Range (min … max): 3.648 s … 3.818 s 10 runs
```
Differential Revision: https://phab.mercurial-scm.org/D9553
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 03 Dec 2020 14:39:39 -0800 |
parents | b713e4cae2d7 |
children | 77e73827a02d |
line wrap: on
line source
Test that, when an hg push is interrupted and the remote side recieves SIGPIPE, the remote hg is able to successfully roll back the transaction. $ hg init -q remote $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" -q ssh://user@dummy/`pwd`/remote local $ check_for_abandoned_transaction() { > [ -f $TESTTMP/remote/.hg/store/journal ] && echo "Abandoned transaction!" > } $ pidfile=`pwd`/pidfile $ >$pidfile $ script() { > cat >"$1" > chmod +x "$1" > } On the remote end, run hg, piping stdout and stderr through processes that we know the PIDs of. We will later kill these to simulate an ssh client disconnecting. $ killable_pipe=`pwd`/killable_pipe.sh $ script $killable_pipe <<EOF > #!/bin/bash > echo \$\$ >> $pidfile > exec cat > EOF $ remotecmd=`pwd`/remotecmd.sh $ script $remotecmd <<EOF > #!/bin/bash > hg "\$@" 1> >($killable_pipe) 2> >($killable_pipe >&2) > EOF In the pretxnchangegroup hook, kill the PIDs recorded above to simulate ssh disconnecting. Then exit nonzero, to force a transaction rollback. $ hook_script=`pwd`/pretxnchangegroup.sh $ script $hook_script <<EOF > #!/bin/bash > for pid in \$(cat $pidfile) ; do > kill \$pid > while kill -0 \$pid 2>/dev/null ; do > sleep 0.1 > done > done > exit 1 > EOF $ cat >remote/.hg/hgrc <<EOF > [hooks] > pretxnchangegroup.break-things=$hook_script > EOF $ cd local $ echo foo > foo ; hg commit -qAm "commit" $ hg push -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --remotecmd $remotecmd 2>&1 | grep -v $killable_pipe abort: stream ended unexpectedly (got 0 bytes, expected 4) $ check_for_abandoned_transaction [1]