Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRsFG-00045A-Da for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Apr 2021 08:00:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRsFF-0002Go-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Apr 2021 08:00:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRsDk-0005th-Hp for pgsql-hackers@lists.postgresql.org; Thu, 01 Apr 2021 07:58:28 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRsDi-0003Iz-Tg for pgsql-hackers@lists.postgresql.org; Thu, 01 Apr 2021 07:58:28 +0000 Received: from ars-thinkpad (nat03-43-2.netorn.net [188.35.130.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id C3C9B21C394A; Thu, 1 Apr 2021 10:58:25 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1617263905; bh=yGljdasw6dRZDmC5NTDZtgsErNEHQdA6d/Num/W6Jvc=; h=References:From:To:Cc:Subject:In-reply-to:Date; b=FNFY7YQcdBqjFz2w0v4uU95BmW/zaqtbxTTNCHaVA7l/iyi/0+LF6wb1LwSyq3r4d NzEWRUE4FlHLm8L2betxtkVcW7FSrOGLHZH1PJZVYNi+jNFufu93FTe4xqBOiwCep0 npu0pai3N2B5J8X/pZa3vA6NOqm4fD+QN6clXhcw= References: <87tuotr2hh.fsf@ars-thinkpad> <78aad736-c653-92fd-45ac-4482729459c6@postgrespro.ru> <87sg4ar9ar.fsf@ars-thinkpad> User-agent: mu4e 1.2.0; emacs 26.0.50 From: Arseny Sher To: Michael Paquier Cc: Masahiko Sawada , PostgreSQL Hackers Subject: Re: Flaky vacuum truncate test in reloptions.sql In-reply-to: Date: Thu, 01 Apr 2021 10:58:25 +0300 Message-ID: <87pmzeqvvi.fsf@ars-thinkpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Michael Paquier 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=reloptions_freeze.patch 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 --=-=-=--