pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Yu Shi (Fujitsu) <shiy.fnst@fujitsu.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Test slots invalidations in 035_standby_logical_decoding.pl only if dead rows are removed
Date: Thu, 11 Jan 2024 23:00:01 +0300
Message-ID: <6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com> (raw)
In-Reply-To: <ZaACEPtVovKlRVUf@ip-10-97-1-34.eu-west-3.compute.internal>
References: <bf67e076-b163-9ba3-4ade-b9fc51a3a8f6@gmail.com>
	<d40d015f-03a4-1cf2-6c1f-2b9aca860762@gmail.com>
	<28fffded-7dc6-3518-7e0e-fc76b9221586@gmail.com>
	<ZZ4cZkBLczQISHxq@paquier.xyz>
	<7c025095-5763-17a6-8c80-899b35bd0459@gmail.com>
	<ZZ7GpII4bAYN+jT5@ip-10-97-1-34.eu-west-3.compute.internal>
	<5d0e5bec-67f9-9164-36cb-c4ff5f95d1ed@gmail.com>
	<ZaACEPtVovKlRVUf@ip-10-97-1-34.eu-west-3.compute.internal>

11.01.2024 17:58, Bertrand Drouvot wrote:
> So I think we have 2 issues here:
>
> 1) The one you're mentioning above related to the on-access pruning test:
>
> I think the engine behavior is right here and that the test is racy. I'm
> proposing to bypass the active slot invalidation check for this particular test (
> as I don't see any "easy" way to take care of this race condition). The active slot
> invalidation is already well covered in the other tests anyway.
>
> I'm proposing the attached v4-0001-Fix-035_standby_logical_decoding.pl-race-conditio.patch
> for it.
>
> 2) The fact that sometime we're getting a termination message which is not followed
> by an obsolete one (like as discussed in [1]).
>
> For this one, I think that InvalidatePossiblyObsoleteSlot() is racy:
>
> In case of an active slot we proceed in 2 steps:
>   - terminate the backend holding the slot
>   - report the slot as obsolete
>
> This is racy because between the two we release the mutex on the slot, which
> means the effective_xmin and effective_catalog_xmin could advance during that time.
>
> I'm proposing the attached v1-0001-Fix-race-condition-in-InvalidatePossiblyObsoleteS.patch
> for it.
>
> Would it be possible to re-launch your repro (the slow one, not the pg_sleep() one)
> with bot patch applied and see how it goes? (Please note that v4 replaces v3 that
> you're already using in your tests).
>
> If it helps, I'll propose v1-0001-Fix-race-condition-in-InvalidatePossiblyObsoleteS.patch
> into a dedicated hackers thread.
>
> [1]: https://www.postgresql.org/message-id/ZZ7GpII4bAYN%2BjT5%40ip-10-97-1-34.eu-west-3.compute.internal

Bertrand, I've relaunched tests in the same slowed down VM with both
patches applied (but with no other modifications) and got a failure
with pg_class, similar to what we had seen before:
9       #   Failed test 'activeslot slot invalidation is logged with vacuum on pg_class'
9       #   at t/035_standby_logical_decoding.pl line 230.

Please look at the logs attached (I see there Standby/RUNNING_XACTS near
'invalidating obsolete replication slot "row_removal_inactiveslot"').

Best regards,
Alexander

Attachments:

  035-failure-vacuum-pg_class.tar.gz (application/gzip, 119.3K) download

view thread (29+ messages)  latest in thread

Message-ID: <6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com>
Permalink:  ../6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com/
Also on:    postgresql.org/message-id/6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: exclusion@gmail.com, bertranddrouvot.pg@gmail.com, michael@paquier.xyz, shiy.fnst@fujitsu.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@anarazel.de, thomas.munro@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Test slots invalidations in 035_standby_logical_decoding.pl only if dead rows are removed
  In-Reply-To: <6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com>

* 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