pgsql: Fix transient mdsync() errors of truncated relations due to 72a9

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Fix transient mdsync() errors of truncated relations due to 72a9
Дата
Msg-id E1axse8-0003el-Hn@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: [COMMITTERS] pgsql: Fix transient mdsync() errors of truncatedrelations due to 72a9  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-committers
Fix transient mdsync() errors of truncated relations due to 72a98a6395.

Unfortunately the segment size checks from 72a98a6395 had the negative
side-effect of breaking a corner case in mdsync(): When processing a
fsync request for a truncated away segment mdsync() could fail with
"could not fsync file" (if previous segment < RELSEG_SIZE) because
_mdfd_getseg() now wouldn't return the relevant segment anymore.

The cleanest fix seems to be to allow the caller of _mdfd_getseg() to
specify whether checks for RELSEG_SIZE are performed. To allow doing so,
change the ExtensionBehavior enum into a bitmask. Besides allowing for
the addition of EXTENSION_DONT_CHECK_SIZE, this makes for a nicer
implementation of EXTENSION_REALLY_RETURN_NULL.

Besides mdsync() the only callsite that should change behaviour due to
this is mdprefetch() which now doesn't create segments anymore, even in
recovery. Given the uses of mdprefetch() that seems better.

Reported-By: Thom Brown
Discussion: CAA-aLv72QazLvPdKZYpVn4a_Eh+i4_cxuB03k+iCuZM_xjc+6Q@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/storage/smgr/md.c | 81 +++++++++++++++++++++++++------------------
1 file changed, 47 insertions(+), 34 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: doc: Fix typos
Следующее
От: Teodor Sigaev
Дата:
Сообщение: pgsql: Fix crash of filter(tsvector)