mirror of
https://github.com/redis/redis.git
synced 2026-05-28 04:02:46 -04:00
Fix test assertion except from TSAN case (#14852)
Some checks failed
CI / test-ubuntu-latest (push) Has been cancelled
CI / test-sanitizer-address (push) Has been cancelled
CI / build-debian-old (push) Has been cancelled
CI / build-macos-latest (push) Has been cancelled
CI / build-32bit (push) Has been cancelled
CI / build-libc-malloc (push) Has been cancelled
CI / build-centos-jemalloc (push) Has been cancelled
CI / build-old-chain-jemalloc (push) Has been cancelled
Codecov / code-coverage (push) Has been cancelled
External Server Tests / test-external-standalone (push) Has been cancelled
External Server Tests / test-external-cluster (push) Has been cancelled
External Server Tests / test-external-nodebug (push) Has been cancelled
Spellcheck / Spellcheck (push) Has been cancelled
Some checks failed
CI / test-ubuntu-latest (push) Has been cancelled
CI / test-sanitizer-address (push) Has been cancelled
CI / build-debian-old (push) Has been cancelled
CI / build-macos-latest (push) Has been cancelled
CI / build-32bit (push) Has been cancelled
CI / build-libc-malloc (push) Has been cancelled
CI / build-centos-jemalloc (push) Has been cancelled
CI / build-old-chain-jemalloc (push) Has been cancelled
Codecov / code-coverage (push) Has been cancelled
External Server Tests / test-external-standalone (push) Has been cancelled
External Server Tests / test-external-cluster (push) Has been cancelled
External Server Tests / test-external-nodebug (push) Has been cancelled
Spellcheck / Spellcheck (push) Has been cancelled
Fix #14835
Executed `failover` with `force` argument in slow environments (TSAN, IO
threads, etc) can force a full resync instead of a partial one.
e3c38aab6 adds TSAN-only workaround in integration/failover test, test
failure occurs in `test‑ubuntu‑io‑threads` job, drop TSAN-only condition
and always check the sum of partial+full syncs will fix it.
Steps to reproduce:
My setup: Hardware: MacBook Pro (Apple chip)
1. Build docker image with Dockerfile below and run the container:
```
FROM ubuntu:22.04
# avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
tcl8.6 \
tclx \
tcl-tls \
pkg-config \
ca-certificates \
git \
bash \
vim \
wget \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/redis
# if you prefer to copy the source during build uncomment the next line
# COPY . /opt/redis
# configure a non-root user if desired; we stay root for simplicity
# default command keeps you in a shell
CMD ["/bin/bash"]
```
Execute the command:
```
cd /path/to/redis
docker build -f Dockerfile.io-threads -t redis-test-io .
docker run --rm -it --cpuset-cpus=0 --cpus=0.1 -v $(pwd):/opt/redis redis-test-io /bin/bash
```
2. Inside the container you can then run the same commands as the CI
job:
```
make REDIS_CFLAGS='-Werror'
./runtest --single integration/failover --config io-threads 4 --tags "failover" --verbose --accurate --loop --stop
```
If the container still seems too fast, lower `--cpus` further (e.g.
0.05), or run the whole driver under `cpulimit`:
```
apt-get update && apt-get install -y cpulimit
cpulimit -l 1 -- ./runtest --single integration/failover --config io-threads 4 --tags "failover" --verbose --accurate --loop --stop
```
This commit is contained in:
parent
62059a2438
commit
b3ce4c28ca
1 changed files with 8 additions and 11 deletions
|
|
@ -180,19 +180,16 @@ start_server {overrides {save {}}} {
|
|||
|
||||
assert_equal [count_log_message -2 "time out exceeded, failing over."] 1
|
||||
|
||||
# We should accept both psyncs, although this is the condition we might
|
||||
# not meet since we didn't catch up. This happens often if TSan is
|
||||
# enabled as it slows down the execution time significantly.
|
||||
# We should accept both psyncs and full syncs, although this is the condition we might
|
||||
# not meet since we didn't catch up. This happens often in slow environments
|
||||
# (TSAN, IO threads, etc) which can force a full resync instead of a partial
|
||||
# one. Count both partial and full syncs and verify the total increments by two.
|
||||
set psyncs [expr [s 0 sync_partial_ok] - $initial_psyncs]
|
||||
set full_syncs [expr [s 0 sync_full] - $initial_syncs]
|
||||
if {$::tsan} {
|
||||
assert_lessthan_equal $psyncs 2
|
||||
assert_morethan_equal $full_syncs 0
|
||||
assert_equal [expr $psyncs + $full_syncs] 2
|
||||
} else {
|
||||
assert_equal $psyncs 2
|
||||
assert_equal $full_syncs 0
|
||||
}
|
||||
# Either we get 2 partial syncs, or some combination of partial/full that totals 2
|
||||
assert_lessthan_equal $psyncs 2
|
||||
assert_morethan_equal $full_syncs 0
|
||||
assert_equal [expr $psyncs + $full_syncs] 2
|
||||
assert_digests_match $node_0 $node_1 $node_2
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue