Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 11a8ae0

Browse files
authored
complement: enable dirty runs (#16520)
* complement: enable dirty runs * Add changelog * Set a low connpool limit when running in Complement Dirty runs can cause many containers to be running concurrently, which seems to easily exhaust resources on the host. The increased speedup from dirty runs also seems to use more db connections on workers, which are misconfigured currently to have `SUM(workers * cp_max) > max_connections`, causing ``` FATAL: sorry, too many clients already ``` which results in tests failing. * Try p=2 concurrency to restrict slowness of servers which causes partial state join tests to flake * Debug logging * Only run flakey tests * Only adjust connection pool limits in worker mode * Move cp vars to somewhere where they get executed in CI * Move cp values back to where they actually work * Debug logging * Try p=1 to see if this makes worker mode happier * Remove debug logging
1 parent 2bf9341 commit 11a8ae0

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

Diff for: .github/workflows/tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,10 @@ jobs:
638638
- name: Prepare Complement's Prerequisites
639639
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
640640

641+
# use p=1 concurrency as GHA boxes are underpowered and don't like running tons of synapses at once.
641642
- run: |
642643
set -o pipefail
643-
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | synapse/.ci/scripts/gotestfmt
644+
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -p 1 -json 2>&1 | synapse/.ci/scripts/gotestfmt
644645
shell: bash
645646
env:
646647
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}

Diff for: changelog.d/16520.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable dirty runs on Complement CI, which is significantly faster.

Diff for: docker/complement/conf/start_for_complement.sh

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then
6868

6969
fi
7070
log "Workers requested: $SYNAPSE_WORKER_TYPES"
71+
# adjust connection pool limits on worker mode as otherwise running lots of worker synapses
72+
# can make docker unhappy (in GHA)
73+
export POSTGRES_CP_MIN=1
74+
export POSTGRES_CP_MAX=3
75+
echo "using reduced connection pool limits for worker mode"
7176
# Improve startup times by using a launcher based on fork()
7277
export SYNAPSE_USE_EXPERIMENTAL_FORKING_LAUNCHER=1
7378
else

Diff for: docker/conf/homeserver.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ database:
6767
host: "{{ POSTGRES_HOST or "db" }}"
6868
port: "{{ POSTGRES_PORT or "5432" }}"
6969
{% endif %}
70-
cp_min: 5
71-
cp_max: 10
70+
cp_min: {{ POSTGRES_CP_MIN or 5 }}
71+
cp_max: {{ POSTGRES_CP_MAX or 10 }}
7272
{% else %}
7373
database:
7474
name: "sqlite3"

Diff for: scripts-dev/complement.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ extra_test_args=()
216216

217217
test_packages="./tests/csapi ./tests ./tests/msc3874 ./tests/msc3890 ./tests/msc3391 ./tests/msc3930 ./tests/msc3902"
218218

219+
# Enable dirty runs, so tests will reuse the same container where possible.
220+
# This significantly speeds up tests, but increases the possibility of test pollution.
221+
export COMPLEMENT_ENABLE_DIRTY_RUNS=1
222+
219223
# All environment variables starting with PASS_ will be shared.
220224
# (The prefix is stripped off before reaching the container.)
221225
export COMPLEMENT_SHARE_ENV_PREFIX=PASS_
@@ -274,7 +278,7 @@ fi
274278
export PASS_SYNAPSE_LOG_TESTING=1
275279

276280
# Run the tests!
277-
echo "Images built; running complement"
281+
echo "Images built; running complement with ${extra_test_args[@]} $@ $test_packages"
278282
cd "$COMPLEMENT_DIR"
279283

280284
go test -v -tags "synapse_blacklist" -count=1 "${extra_test_args[@]}" "$@" $test_packages

0 commit comments

Comments
 (0)