postgresql/src/backend/storage
Robert Haas 049469e7e7 Teach mdnblocks() not to create zero-length files.
It's entirely surprising that mdnblocks() has the side effect of
creating new files on disk, so let's make it not do that.  One
consequence of the old behavior is that, if running on a damaged
cluster that is missing a file, mdnblocks() can recreate the file
and allow a subsequent _mdfd_getseg() for a higher segment to succeed.
This happens because, while mdnblocks() stops when it finds a segment
that is shorter than 1GB, _mdfd_getseg() has no such check, and thus
the empty file created by mdnblocks() can allow it to continue its
traversal and find higher-numbered segments which remain.

It might be a good idea for _mdfd_getseg() to actually verify that
each segment it finds is exactly 1GB before proceeding to the next
one, but that would involve some additional system calls, so for
now I'm just doing this much.

Patch by me, per off-list analysis by Kevin Grittner and Rahila Syed.
Review by Andres Freund.
2015-12-15 13:57:45 -05:00
..
buffer Move buffer I/O and content LWLocks out of the main tranche. 2015-12-15 13:32:54 -05:00
file Remove special cases for ETXTBSY from new fsync'ing logic. 2015-05-29 15:11:36 -04:00
freespace Update copyright for 2015 2015-01-06 11:43:47 -05:00
ipc shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive. 2015-11-03 09:12:52 -05:00
large_object Use FLEXIBLE_ARRAY_MEMBER in struct varlena. 2015-02-20 16:51:53 -05:00
lmgr Move buffer I/O and content LWLocks out of the main tranche. 2015-12-15 13:32:54 -05:00
page pgindent run for 9.5 2015-05-23 21:35:49 -04:00
smgr Teach mdnblocks() not to create zero-length files. 2015-12-15 13:57:45 -05:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00