pgsql: Fix the logic for putting relations into the relcache init file.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix the logic for putting relations into the relcache init file.
Дата
Msg-id E1Z8C3Z-0004Ko-1h@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix the logic for putting relations into the relcache init file.

Commit f3b5565dd4e59576be4c772da364704863e6a835 was a couple of bricks shy
of a load; specifically, it missed putting pg_trigger_tgrelid_tgname_index
into the relcache init file, because that index is not used by any
syscache.  However, we have historically nailed that index into cache for
performance reasons.  The upshot was that load_relcache_init_file always
decided that the init file was busted and silently ignored it, resulting
in a significant hit to backend startup speed.

To fix, reinstantiate RelationIdIsInInitFile() as a wrapper around
RelationSupportsSysCache(), which can know about additional relations
that should be in the init file despite being unknown to syscache.c.

Also install some guards against future mistakes of this type: make
write_relcache_init_file Assert that all nailed relations get written to
the init file, and make load_relcache_init_file emit a WARNING if it takes
the "wrong number of nailed relations" exit path.  Now that we remove the
init files during postmaster startup, that case should never occur in the
field, even if we are starting a minor-version update that added or removed
rels from the nailed set.  So the warning shouldn't ever be seen by end
users, but it will show up in the regression tests if somebody breaks this
logic.

Back-patch to all supported branches, like the previous commit.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/834aa56ea16ff4a7e217a1115797078398d85cc8

Modified Files
--------------
src/backend/utils/cache/inval.c    |    5 +---
src/backend/utils/cache/relcache.c |   58 +++++++++++++++++++++++++++++++-----
src/include/utils/relcache.h       |    1 +
3 files changed, 53 insertions(+), 11 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Docs: fix claim that to_char('FM') removes trailing zeroes.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix the logic for putting relations into the relcache init file.