pgsql: Maintain valid md.c state when FileClose() fails.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Maintain valid md.c state when FileClose() fails.
Date: 2020-01-11 02:34:27
Message-ID: E1iq6bb-0005Il-6k@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Maintain valid md.c state when FileClose() fails.

FileClose() failure ordinarily causes a PANIC. Suppose the user
disables that PANIC via data_sync_retry=on. After mdclose() issued a
FileClose() that failed, calls into md.c raised SIGSEGV. This fix adds
repalloc() calls during mdclose(); update a comment about ignoring
repalloc() cost. The rate of relation segment count change is a minor
factor; more relevant to overall performance is the rate of mdclose()
and subsequent re-opening of segments. Back-patch to v10, where commit
45e191e3aa62d47a8bc1a33f784286b2051f45cb introduced the bug.

Reviewed by Kyotaro Horiguchi.

Discussion: https://postgr.es/m/20191222091930.GA1280238@rfd.leadboat.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cb977424532f20fae65f2e58ac901286a2482b24

Modified Files
--------------
src/backend/storage/smgr/md.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2020-01-11 07:13:52 pgsql: Remove STATUS_FOUND
Previous Message Peter Geoghegan 2020-01-10 21:15:53 pgsql: nbtree: Rename BT_HEAP_TID_ATTR.