Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions

From: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>
To: pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions
Date: 2016-05-25 17:33:12
Message-ID: 52fb5d06-ac66-ea1e-c6fd-46949d17962e@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 27/06/15 01:13, Jim Nasby wrote:
> On 6/26/15 8:50 AM, Marco Nenciarini wrote:
>>> >In the heap_xlog_freeze we need to subtract one to the value of
>>> cutoff_xid
>>> >before passing it to ResolveRecoveryConflictWithSnapshot.
>>> >
>>> >
>>> >
>> Attached a proposed patch that solves the issue.
>

I have hit the bug again, as it has been fixed only from 9.5+

The procedure to reproduce it sent in the original post is not fully
accurate, below there is one that always works:

Run the following operation on an idle cluster.

1) connect to the master and run the following script

create table t(id int primary key);
insert into t select generate_series(1, 10000);

2) connect to the standby and simulate a long running query:

select pg_sleep(3600);

3) on the master and run the following commands:
vacuum freeze verbose t;
drop table t;

4) after 30 seconds the pg_sleep query on standby will be canceled.

Attached there is a patch that apply on every version that misses the
fix (9.0, 9.1, 9.2, 9.3, 9.4)

Regards,
Marco

--
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco(dot)nenciarini(at)2ndQuadrant(dot)it | www.2ndQuadrant.it

Attachment Content-Type Size
avoid-hot-standby-cancels-from-vac-freeze.patch text/x-patch 681 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2016-05-25 23:30:00 Re: [HACKERS] BUG #13473: VACUUM FREEZE mistakenly cancel standby sessions
Previous Message Michael Paquier 2016-05-25 16:38:05 Re: Too high rate of progress information from pg_basebackup

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-05-25 17:41:18 Re: Does people favor to have matrix data type?
Previous Message Nikolay Shaplov 2016-05-25 17:30:39 Re: [PROPOSAL] Move all am-related reloption code into src/backend/access/[am-name] and get rid of relopt_kind