From: stuart@stuartbishop.net
To: pgsql-bugs@postgresql.org
Subject: BUG #7546: Backups on hot standby cancelled despite hot_standby=on
Date: Mon, 17 Sep 2012 10:28:49 +0000
Message-ID: <E1TDYZN-0005Id-Na@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 7546
Logged by: Stuart Bishop
Email address: stuart@stuartbishop.net
PostgreSQL version: 9.1.5
Operating system: Ubuntu 12.10
Description:
I have a primary and a hot standby using streaming replication. The hot
standby specifies 'hot_standby_feedback=on' with other replication settings
set to default.
If a vacuum occurs on the primary while pg_dump is dumping a large table,
the pg_dump is cancelled, usually with the following error:
ERROR: canceling statement due to conflict with recovery
DETAIL: User was holding shared buffer pin for too long.
I can excercise this problem with the following script:
#!/bin/sh
dbname="repl_test"
master_port=5432
slave_port=5434
rows=2000000
slow="pv --rate-limit 20k"
createdb -p $master_port $dbname
psql -p $master_port -d $dbname -f - <<EOM
CREATE TABLE IF NOT EXISTS BigStuff (
a serial primary key, b integer, c text, d text)
WITH (autovacuum_enabled = FALSE);
INSERT INTO BigStuff (b, c, d)
SELECT i,md5(i::text),reverse(md5(i::text))
FROM generate_series(1,${rows}) AS i;
DELETE FROM BigStuff WHERE random() < 0.15;
EOM
synced=0
while [ $synced -ne 1 ]
do sleep 5
synced=`psql -qtA -p $master_port -d $dbname -c "SELECT
(pg_current_xlog_location() = min(replay_location))::integer FROM
pg_stat_replication;"`
echo synced $synced synced
done
(pg_dump -p $slave_port --format=c $dbname | $slow > /dev/null) &
sleep 5;
psql -p $master_port -d $dbname -c "vacuum verbose BigStuff;"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: stuart@stuartbishop.net
Subject: Re: BUG #7546: Backups on hot standby cancelled despite hot_standby=on
In-Reply-To: <E1TDYZN-0005Id-Na@wrigleys.postgresql.org>
References: <E1TDYZN-0005Id-Na@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox