pgsql: Use TRUNCATE to preserve relfilenode for pg_largeobject + index.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Use TRUNCATE to preserve relfilenode for pg_largeobject + index.
Дата
Msg-id E1oH9vL-001gCC-2W@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Use TRUNCATE to preserve relfilenode for pg_largeobject + index.  (Dilip Kumar <dilipbalaut@gmail.com>)
Список pgsql-committers
Use TRUNCATE to preserve relfilenode for pg_largeobject + index.

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged to preserve
the relfilenode of user tables across pg_upgrade, but failed to notice
that pg_upgrade treats pg_largeobject as a user table and thus it needs
the same treatment. Otherwise, large objects will appear to vanish
after a  pg_upgrade.

Commit d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d fixed this problem
by teaching pg_dump to UPDATE pg_class.relfilenode for pg_largeobject
and its index. However, because an UPDATE on the catalog rows doesn't
change anything on disk, this can leave stray files behind in the new
cluster. They will normally be empty, but it's a little bit untidy.

Hence, this commit arranges to do the same thing using DDL. Specifically,
it makes TRUNCATE work for the pg_largeobject catalog when in
binary-upgrade mode, and it then uses that command in binary-upgrade
dumps as a way of setting pg_class.relfilenode for pg_largeobject and
its index. That way, the old files are removed from the new cluster.

Discussion: http://postgr.es/m/CA+TgmoYYMXGUJO5GZk1-MByJGu_bB8CbOL6GJQC8=Bzt6x6vDg@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4ab5dae9472c5c6ada5f5627ec0e0f9f965ade28

Modified Files
--------------
src/backend/commands/tablecmds.c   | 11 ++++++-
src/backend/storage/smgr/md.c      | 27 +++++++++++++---
src/backend/utils/cache/relcache.c | 66 +++++++++++++++++++++++++++++++++++---
src/bin/pg_dump/pg_dump.c          | 31 +++++++++++++++---
4 files changed, 120 insertions(+), 15 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve speed of hash index build.
Следующее
От: Amit Kapila
Дата:
Сообщение: pgsql: Move related functions next to each other in pg_publication.c.