File tree Expand file tree Collapse file tree
demo/postgres-survive-kill9 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,18 +58,24 @@ wait_pg
5858wait_pgbench_tables
5959wait_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-
6461get_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
6973sleep 2
74+
75+ # Issue CHECKPOINT to flush WAL
7076docker 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
7379baseline=$( get_count)
7480echo " Stable baseline transactions: ${baseline} "
7581
@@ -81,6 +87,10 @@ wait_pg
8187wait_pgbench_tables
8288wait_metrics || true
8389
90+ # Unpause the loader
91+ echo " Resuming loader..."
92+ docker compose unpause loader || true
93+
8494after=$( get_count)
8595
8696# Allow a short window for replay to catch up before failing hard
You can’t perform that action at this time.
0 commit comments