pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arseny Sher <a.sher@postgrespro.ru>
To: Michael Paquier <michael@paquier.xyz>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Flaky vacuum truncate test in reloptions.sql
Date: Thu, 01 Apr 2021 10:58:25 +0300
Message-ID: <87pmzeqvvi.fsf@ars-thinkpad> (raw)
In-Reply-To: <YGVL46GoetxG08LF@paquier.xyz>
References: <87tuotr2hh.fsf@ars-thinkpad>
	<YGLOWsO2bV7KLvh7@paquier.xyz>
	<78aad736-c653-92fd-45ac-4482729459c6@postgrespro.ru>
	<CAD21AoB+qb-sOY2QeTnGirjh-UvFJj8eANVwQ4CV-r+t1AhxDA@mail.gmail.com>
	<d5dd7eaf-0ba1-a18b-1ef2-552196f36a71@postgrespro.ru>
	<CAD21AoBrNFeBRT-AkVyMybr=bmUbiAcpZPsD61Q_tgvAUqUuHQ@mail.gmail.com>
	<87sg4ar9ar.fsf@ars-thinkpad>
	<CAD21AoAV221s7tuQ6=jLoxhCwZ_8iR6z-CLOwtgr8=77pvxJpA@mail.gmail.com>
	<YGVL46GoetxG08LF@paquier.xyz>


Michael Paquier <michael@paquier.xyz> writes:

> On Thu, Apr 01, 2021 at 12:52:21PM +0900, Masahiko Sawada wrote:
>> Just to be clear the context, I’m mentioning the following test case:

Sorry, I misremembered the test and assumed the table is non-empty there
while it is empty but vacuum_truncate is disabled. Still, this doesn't
change my conclusion of freezing being not a big deal there due to small
chance of locked page. Anyway, let's finish with this.

> What you are writing here makes sense to me.  Looking at the test, it
> is designed to test vacuum_truncate, aka that the behavior we want to
> stress (your former case here) gets stressed all the time, so adding
> the options to avoid the latter case all the time is an improvement.
> And this, even if the latter case does not actually cause a diff and
> it has a small chance to happen in practice.
>
> It would be good to add a comment explaining why the options are
> added (aka just don't skip any pages).

How about the attached?


-- cheers, arseny

Attachments:

  [text/x-diff] reloptions_freeze.patch (2.3K, ../87pmzeqvvi.fsf@ars-thinkpad/2-reloptions_freeze.patch)
  download | inline diff:
diff --git a/src/test/regress/expected/reloptions.out b/src/test/regress/expected/reloptions.out
index 44c130409ff..d6f5bf98114 100644
--- a/src/test/regress/expected/reloptions.out
+++ b/src/test/regress/expected/reloptions.out
@@ -102,7 +102,8 @@ SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
 INSERT INTO reloptions_test VALUES (1, NULL), (NULL, NULL);
 ERROR:  null value in column "i" of relation "reloptions_test" violates not-null constraint
 DETAIL:  Failing row contains (null, null).
-VACUUM reloptions_test;
+-- do aggressive vacuum to be sure we won't skip the page even if it is locked
+VACUUM FREEZE reloptions_test;
 SELECT pg_relation_size('reloptions_test') > 0;
  ?column? 
 ----------
@@ -127,7 +128,8 @@ SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
 INSERT INTO reloptions_test VALUES (1, NULL), (NULL, NULL);
 ERROR:  null value in column "i" of relation "reloptions_test" violates not-null constraint
 DETAIL:  Failing row contains (null, null).
-VACUUM reloptions_test;
+-- do aggressive vacuum to be sure we won't skip the page even if it is locked
+VACUUM FREEZE reloptions_test;
 SELECT pg_relation_size('reloptions_test') = 0;
  ?column? 
 ----------
diff --git a/src/test/regress/sql/reloptions.sql b/src/test/regress/sql/reloptions.sql
index cac5b0bcb0d..61638c3bcae 100644
--- a/src/test/regress/sql/reloptions.sql
+++ b/src/test/regress/sql/reloptions.sql
@@ -61,7 +61,8 @@ CREATE TABLE reloptions_test(i INT NOT NULL, j text)
 	autovacuum_enabled=false);
 SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
 INSERT INTO reloptions_test VALUES (1, NULL), (NULL, NULL);
-VACUUM reloptions_test;
+-- do aggressive vacuum to be sure we won't skip the page even if it is locked
+VACUUM FREEZE reloptions_test;
 SELECT pg_relation_size('reloptions_test') > 0;
 
 SELECT reloptions FROM pg_class WHERE oid =
@@ -71,7 +72,8 @@ SELECT reloptions FROM pg_class WHERE oid =
 ALTER TABLE reloptions_test RESET (vacuum_truncate);
 SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
 INSERT INTO reloptions_test VALUES (1, NULL), (NULL, NULL);
-VACUUM reloptions_test;
+-- do aggressive vacuum to be sure we won't skip the page even if it is locked
+VACUUM FREEZE reloptions_test;
 SELECT pg_relation_size('reloptions_test') = 0;
 
 -- Test toast.* options

view thread (17+ messages)  latest in thread

Message-ID: <87pmzeqvvi.fsf@ars-thinkpad>
Permalink:  ../87pmzeqvvi.fsf@ars-thinkpad/
Also on:    postgresql.org/message-id/87pmzeqvvi.fsf@ars-thinkpad

 ·  · 

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: a.sher@postgrespro.ru, michael@paquier.xyz, sawada.mshk@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Flaky vacuum truncate test in reloptions.sql
  In-Reply-To: <87pmzeqvvi.fsf@ars-thinkpad>

* 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