unnecessary creation of FSM files during bootstrap mode

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: unnecessary creation of FSM files during bootstrap mode
Date: 2018-12-15 05:02:18
Message-ID: CAA4eK1KsET6sotf+rzOTQfb83pzVEzVhbQi1nxGFYVstVWXUGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As pointed out by John Naylor [1], it seems during bootstrap mode, we
are always creating FSM files which are not required. In commit's
b9d01fe288 and 3908473c80, we have added some code where we allowed
the creation of files during mdopen even if they didn't exist during
the bootstrap mode. The comments in the code say: "During bootstrap,
there are cases where a system relation will be accessed (by internal
backend processes) before the bootstrap script nominally creates it."
I am sure this will be the case when that code is added but is it
required today? While going through commit 3908473c80, I came across
below comment:

- * During bootstrap processing, we skip that check, because pg_time,
- * pg_variable, and pg_log get created before their .bki file entries
- * are processed.
- */
+ fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);

The system tables mentioned in above commit are not present today, so
do we really need that code and even if it is required shall we do it
only for 'main' or 'init' forks?

Tom, as you are a committer of the commits b9d01fe288 and 3908473c80,
do you remember anything in this regard?

[1] - https://www.postgresql.org/message-id/CAJVSVGVtf%2B-2sQGVyEZJQh15dpVicpFA6BBiPLugaD4oBEaiHg%40mail.gmail.com

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2018-12-15 05:05:23 Re: WIP: Avoid creation of the free space map for small tables
Previous Message Michael Paquier 2018-12-15 03:42:03 Re: removal of dangling temp tables