Skip to content

Commit 1342eaf

Browse files
author
Shane Wall
committed
fixed: race condition between the loader continuously writing transactions and the kill sequence
1 parent 8f0df8d commit 1342eaf

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

demo/postgres-survive-kill9/ci-smoke.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,24 @@ wait_pg
5858
wait_pgbench_tables
5959
wait_metrics || true
6060

61-
baseline=$(docker compose exec -T postgres psql -U postgres -d bench -t -A -c "SELECT count(*) FROM pgbench_history;" 2>/dev/null || echo "0")
62-
echo "Baseline transactions: ${baseline}"
63-
6461
get_count() {
6562
docker compose exec -T postgres psql -U postgres -d bench -t -A -c "SELECT count(*) FROM pgbench_history;" 2>/dev/null | tr -d '\r'
6663
}
6764

68-
# Give the workload a moment to settle and flush durable state
65+
# Let the workload run for a bit
66+
sleep 5
67+
68+
# Pause the loader to stop new transactions during kill sequence
69+
echo "Pausing loader..."
70+
docker compose pause loader
71+
72+
# Give any in-flight transactions a moment to complete
6973
sleep 2
74+
75+
# Issue CHECKPOINT to flush WAL
7076
docker compose exec -T postgres psql -U postgres -d bench -c "CHECKPOINT;" >/dev/null
7177

72-
# Re-read after checkpoint to ensure a stable baseline
78+
# Get the stable baseline after checkpoint with loader paused
7379
baseline=$(get_count)
7480
echo "Stable baseline transactions: ${baseline}"
7581

@@ -81,6 +87,10 @@ wait_pg
8187
wait_pgbench_tables
8288
wait_metrics || true
8389

90+
# Unpause the loader
91+
echo "Resuming loader..."
92+
docker compose unpause loader || true
93+
8494
after=$(get_count)
8595

8696
# Allow a short window for replay to catch up before failing hard

0 commit comments

Comments
 (0)