Re: reloption to prevent VACUUM from truncating empty pages at the end of relation

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
Cc: Michael Paquier <michael@paquier.xyz>, Julien Rouhaud <rjuju123@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>, "Jamison, Kirk" <k.jamison@jp.fujitsu.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Amit Kapila <amit.kapila16@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Fujii Masao <masao.fujii@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-02-25T10:17:02Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add TRUNCATE parameter to VACUUM.

  2. Add vacuum_truncate reloption.

  3. Allow VACUUM to be run with index cleanup disabled.

On Mon, Feb 25, 2019 at 7:01 PM Tsunakawa, Takayuki
<tsunakawa.takay@jp.fujitsu.com> wrote:
>
> From: Michael Paquier [mailto:michael@paquier.xyz]
> On Mon, Feb 25, 2019 at 03:59:21PM +0900, Masahiko Sawada wrote:
> > > Also, I think that this test may fail in case where concurrent
> > > transactions are running. So maybe should not run it in parallel to
> > > other tests.
> >
> > That's why autovacuum is disabled in this specific test, no?  A comment
> > may be a good idea.
>
> Exactly.  The table is disabled for autovacuum to avoid being influenced by autovacuum.
>

This test expects that the inserted tuple is always reclaimed by
subsequent vacuum, but it's not always true if there are concurrent
transactions. So size of the reloptions_test table will not be 0 if
the tuple is not vacuumed. In my environment this test sometimes
failed with 'make check -j 4'.

diff -U3 /home/masahiko/source/postgresql/src/test/regress/expected/reloptions.out
/home/masahiko/source/postgresql/src/test/regress/results/reloptions.out
--- /home/masahiko/source/postgresql/src/test/regress/expected/reloptions.out
  2019-02-25 19:10:49.761438066 +0900
+++ /home/masahiko/source/postgresql/src/test/regress/results/reloptions.out
   2019-02-25 19:12:34.885437911 +0900
@@ -117,7 +117,7 @@
 SELECT pg_relation_size('reloptions_test');
  pg_relation_size
 ------------------
-                0
+             8192
 (1 row)

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center