pgsql: Code review for recent changes in relcache.c.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Code review for recent changes in relcache.c.
Дата
Msg-id E1WkeLl-0003HU-AG@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Code review for recent changes in relcache.c.

rd_replidindex should be managed the same as rd_oidindex, and rd_keyattr
and rd_idattr should be managed like rd_indexattr.  Omissions in this area
meant that the bitmapsets computed for rd_keyattr and rd_idattr would be
leaked during any relcache flush, resulting in a slow but permanent leak in
CacheMemoryContext.  There was also a tiny probability of relcache entry
corruption if we ran out of memory at just the wrong point in
RelationGetIndexAttrBitmap.  Otherwise, the fields were not zeroed where
expected, which would not bother the code any AFAICS but could greatly
confuse anyone examining the relcache entry while debugging.

Also, create an API function RelationGetReplicaIndex rather than letting
non-relcache code be intimate with the mechanisms underlying caching of
that value (we won't even mention the memory leak there).

Also, fix a relcache flush hazard identified by Andres Freund:
RelationGetIndexAttrBitmap must not assume that rd_replidindex stays valid
across index_open.

The aspects of this involving rd_keyattr date back to 9.3, so back-patch
those changes.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/e7a9020939c9f09eddf6cf2f5477f82a1efcbf09

Modified Files
--------------
src/backend/utils/cache/relcache.c |   15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: pgsql: doc: fix 9.4 release notes typo
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Code review for recent changes in relcache.c.