Re: WIP: Avoid creation of the free space map for small tables

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: John Naylor <john.naylor@2ndquadrant.com>
Cc: Mithun Cy <mithun.cy@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-21T11:31:55Z
Lists: pgsql-hackers
On Sun, Jan 20, 2019 at 5:19 AM John Naylor <john.naylor@2ndquadrant.com> wrote:
>

Review of v16-0002-During-pg_upgrade-conditionally-skip-transfer-of:

- * Copy/link any fsm and vm files, if they exist
+ *
Copy/link any fsm and vm files, if they exist and if they would
+ * be created in the
new cluster.
  */
- transfer_relfile(&maps[mapnum], "_fsm",
vm_must_add_frozenbit);
+ if ((maps[mapnum].relkind != RELKIND_RELATION &&
+
maps[mapnum].relkind != RELKIND_TOASTVALUE) ||
+
first_seg_size > HEAP_FSM_CREATION_THRESHOLD * BLCKSZ ||
+ GET_MAJOR_VERSION
(new_cluster.major_version) <= 1100)
+ (void) transfer_relfile(&maps[mapnum],
"_fsm", vm_must_add_frozenbit);

So we won't allow transfer of FSM files if their size is below
HEAP_FSM_CREATION_THRESHOLD.  What will be its behavior in link mode?
It seems that the old files will remain there. Will it create any
problem when we try to create the files via the new server, can you
once test this case?

Also, another case to think in this regard is the upgrade for standby
servers, if you read below paragraph from the user manual [1], you
will see what I am worried about?

"What this does is to record the links created by pg_upgrade's link
mode that connect files in the old and new clusters on the primary
server. It then finds matching files in the standby's old cluster and
creates links for them in the standby's new cluster. Files that were
not linked on the primary are copied from the primary to the standby.
(They are usually small.)"

[1] - https://www.postgresql.org/docs/devel/pgupgrade.html

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


Commits

  1. Improve code comments in b0eaa4c51b.

  2. During pg_upgrade, conditionally skip transfer of FSMs.

  3. Add more tests for FSM.

  4. Doc: Update the documentation for FSM behavior for small tables.

  5. Make FSM test portable.

  6. Avoid creation of the free space map for small heap relations, take 2.

  7. Move page initialization from RelationAddExtraBlocks() to use, take 2.

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

  9. In bootstrap mode, don't allow the creation of files if they don't already