pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Revert "Avoid the creation of the free space map for small heap
6+ messages / 3 participants
[nested] [flat]

* pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 04:11  Amit Kapila <akapila@postgresql.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Amit Kapila @ 2019-05-07 04:11 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Revert "Avoid the creation of the free space map for small heap relations".

This feature was using a process local map to track the first few blocks
in the relation.  The map was reset each time we get the block with enough
freespace.  It was discussed that it would be better to track this map on
a per-relation basis in relcache and then invalidate the same whenever
vacuum frees up some space in the page or when FSM is created.  The new
design would be better both in terms of API design and performance.

List of commits reverted, in reverse chronological order:

06c8a5090e  Improve code comments in b0eaa4c51b.
13e8643bfc  During pg_upgrade, conditionally skip transfer of FSMs.
6f918159a9  Add more tests for FSM.
9c32e4c350  Clear the local map when not used.
29d108cdec  Update the documentation for FSM behavior..
08ecdfe7e5  Make FSM test portable.
b0eaa4c51b  Avoid creation of the free space map for small heap relations.

Discussion: https://postgr.es/m/20190416180452.3pm6uegx54iitbt5@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7db0cde6b58eef2ba0c70437324cbc7622230320

Modified Files
--------------
contrib/pageinspect/expected/page.out     |  64 ++++---
contrib/pageinspect/sql/page.sql          |  34 ++--
contrib/pgstattuple/pgstatapprox.c        |   3 -
doc/src/sgml/pgfreespacemap.sgml          |   2 -
doc/src/sgml/pgstattuple.sgml             |   4 +-
doc/src/sgml/ref/pgupgrade.sgml           |   7 -
doc/src/sgml/storage.sgml                 |  13 +-
src/backend/access/brin/brin.c            |   2 +-
src/backend/access/brin/brin_pageops.c    |  10 +-
src/backend/access/heap/hio.c             |  42 ++---
src/backend/access/heap/vacuumlazy.c      |  17 +-
src/backend/access/transam/xact.c         |  14 --
src/backend/storage/freespace/README      |  38 +---
src/backend/storage/freespace/freespace.c | 301 +-----------------------------
src/backend/storage/freespace/indexfsm.c  |   6 +-
src/bin/pg_upgrade/info.c                 |  16 +-
src/bin/pg_upgrade/pg_upgrade.h           |   6 -
src/bin/pg_upgrade/relfilenode.c          |  63 +------
src/include/storage/freespace.h           |   9 +-
src/test/regress/expected/fsm.out         |  73 --------
src/test/regress/parallel_schedule        |   2 +-
src/test/regress/serial_schedule          |   1 -
src/test/regress/sql/fsm.sql              |  66 -------
23 files changed, 107 insertions(+), 686 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 04:14  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Amit Kapila <akapila@postgresql.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2019-05-07 04:14 UTC (permalink / raw)
  To: Amit Kapila <akapila@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Amit Kapila <akapila@postgresql.org> writes:
> Revert "Avoid the creation of the free space map for small heap relations".

Shouldn't there be a catversion bump in this?  I doubt that an existing
v12 DB (with some missing FSM files) is going to work with the updated
backend.  Also, will pg_upgrade work across that boundary?

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 04:18  Amit Kapila <amit.kapila16@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Amit Kapila @ 2019-05-07 04:18 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Amit Kapila <akapila@postgresql.org>; pgsql-committers@lists.postgresql.org

On Tue, May 7, 2019 at 9:44 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Amit Kapila <akapila@postgresql.org> writes:
> > Revert "Avoid the creation of the free space map for small heap relations".
>
> Shouldn't there be a catversion bump in this?  I doubt that an existing
> v12 DB (with some missing FSM files) is going to work with the updated
> backend.
>

Won't the next vacuum run will create the FSM?  There is some
performance loss, but shouldn't be big.

>  Also, will pg_upgrade work across that boundary?
>

I haven't tried it.  What is your worry?


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





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 04:21  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Amit Kapila <amit.kapila16@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2019-05-07 04:21 UTC (permalink / raw)
  To: Amit Kapila <amit.kapila16@gmail.com>; +Cc: Amit Kapila <akapila@postgresql.org>; pgsql-committers@lists.postgresql.org

Amit Kapila <amit.kapila16@gmail.com> writes:
> On Tue, May 7, 2019 at 9:44 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Shouldn't there be a catversion bump in this?

> Won't the next vacuum run will create the FSM?

If that's true, and if we don't throw any errors meanwhile, it's fine.
I'm just worried that that's an untested scenario.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 04:33  Amit Kapila <amit.kapila16@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Amit Kapila @ 2019-05-07 04:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Amit Kapila <akapila@postgresql.org>; pgsql-committers@lists.postgresql.org

On Tue, May 7, 2019 at 9:51 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Amit Kapila <amit.kapila16@gmail.com> writes:
> > On Tue, May 7, 2019 at 9:44 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Shouldn't there be a catversion bump in this?
>
> > Won't the next vacuum run will create the FSM?
>
> If that's true, and if we don't throw any errors meanwhile, it's fine.
>

This is what is suppose to happen.

> I'm just worried that that's an untested scenario.
>

I can test it.  Basically, without revert of the patch, I can create a
table with a few records (so as to ensure that there is no FSM).  And
then revert the patch and upgrade the database and perform few dml
operations on that table and see what happens?

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





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Revert "Avoid the creation of the free space map for small heap
@ 2019-05-07 05:55  Amit Kapila <amit.kapila16@gmail.com>
  parent: Amit Kapila <amit.kapila16@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Amit Kapila @ 2019-05-07 05:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Amit Kapila <akapila@postgresql.org>; pgsql-committers@lists.postgresql.org

On Tue, May 7, 2019 at 10:03 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Tue, May 7, 2019 at 9:51 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> > I'm just worried that that's an untested scenario.
> >
>
> I can test it.  Basically, without revert of the patch, I can create a
> table with a few records (so as to ensure that there is no FSM).  And
> then revert the patch and upgrade the database and perform few dml
> operations on that table and see what happens?
>

I have tested this both with and without an upgrade.   This tests that
an existing v12 DB (with some missing FSM files) works with the
updated backend and the same works even if we do upgrade.   If anyone
else can think of some other scenario's, please let me know.

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





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2019-05-07 05:55 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 04:11 pgsql: Revert "Avoid the creation of the free space map for small heap Amit Kapila <akapila@postgresql.org>
2019-05-07 04:14 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-05-07 04:18   ` Amit Kapila <amit.kapila16@gmail.com>
2019-05-07 04:21     ` Tom Lane <tgl@sss.pgh.pa.us>
2019-05-07 04:33       ` Amit Kapila <amit.kapila16@gmail.com>
2019-05-07 05:55         ` Amit Kapila <amit.kapila16@gmail.com>

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