Re: [HACKERS] Replication slots and isolation levels

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Vladimir Borodin <root(at)simply(dot)name>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Replication slots and isolation levels
Date: 2015-10-29 12:29:21
Message-ID: CAB7nPqTSVXR1WQegikpnkATjR3oz8FQE3hUf9RUk+o9VN0+zrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

On Thu, Oct 29, 2015 at 12:35 PM, Vladimir Borodin wrote:
> 29 окт. 2015 г., в 14:03, Michael Paquier написал(а):
>> Standby will receive the record but not replay it until the
>> transaction doing REPEATABLE READ transactions that needs those rows
>> commits on the standby. The WAL flush position on the standby
>> continues to move on.
>
> By replication lag on standby I mean exactly replay_location, not
> flush_location.
> Well, the initial problem is that in read commited mode heavy
> SELECT-statement hits max_standby_streaming_delay but in repeatable read
> mode doesn’t. My question is if it is expected behavior? If yes, why is it
> so?

Er, well. If I enforce on master the deletion then VACUUM-cleanup of a
page with a REPEATABLE READ transaction on standby still expecting to
have this page items visible until its commit the startup process puts
itself in waiting state when trying to replay the cleanup record, and
the replay_location does not move on, still the wal receiver gets WAL
in parallel, so it continues to flush things and flush_position
progresses. With a READ COMMITTED transaction running on the standby,
this transaction considers as visible stuff that has been committed,
so WAL replay can move on, and indeed there is a risk to face a
recovery conflict. So this behavior as-is is correct, based on how
isolation levels should behave when a node performs recovery.
--
Michael

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2015-10-29 12:58:54 Re: PITR using pg_basebackup ERROR
Previous Message Vladimir Borodin 2015-10-29 11:35:27 Re: [ADMIN] Replication slots and isolation levels

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladimir Borodin 2015-10-29 13:39:22 Re: [ADMIN] Replication slots and isolation levels
Previous Message Matthijs van der Vleuten 2015-10-29 12:28:57 Re: psql: add \pset true/false