postgresql/src/backend
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
..
access Provide a way to predefine LWLock tranche IDs. 2015-12-15 11:48:19 -05:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog For REASSIGN OWNED for foreign user mappings 2015-12-11 18:39:09 -03:00
commands Fix ALTER TABLE ... SET TABLESPACE for unlogged relations. 2015-12-12 14:17:39 +01:00
executor Improve some messages 2015-12-10 22:05:27 -05:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:18 -04:00
libpq Message improvements 2015-11-16 21:39:23 -05:00
main Revoke support for strxfrm() that write past the specified array length. 2015-07-08 20:44:21 -04:00
nodes Get rid of the planner's LateralJoinInfo data structure. 2015-12-11 15:52:38 -05:00
optimizer Collect the global OR of hasRowSecurity flags for plancache 2015-12-14 20:05:43 -05:00
parser COPY (INSERT/UPDATE/DELETE .. RETURNING ..) 2015-11-27 19:11:22 +03:00
po Translation updates 2015-06-28 23:56:55 -04:00
port On Windows, ensure shared memory handle gets closed if not being used. 2015-10-13 11:21:33 -04:00
postmaster Message improvements 2015-11-16 21:39:23 -05:00
regex Fix enforcement of restrictions inside regexp lookaround constraints. 2015-11-07 12:43:24 -05:00
replication Consistently set all fields in pg_stat_replication to null instead of 0 2015-12-13 16:53:38 +01:00
rewrite Get rid of the planner's LateralJoinInfo data structure. 2015-12-11 15:52:38 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Teach mdnblocks() not to create zero-length files. 2015-12-15 13:57:45 -05:00
tcop Fix problems with ParamListInfo serialization mechanism. 2015-11-02 18:11:29 -05:00
tsearch pgindent run for 9.5 2015-05-23 21:35:49 -04:00
utils Add missing CHECK_FOR_INTERRUPTS in lseg_inside_poly 2015-12-14 16:44:40 -03:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Revert "Have dtrace depend on object files directly, not objfiles.txt" 2015-10-15 13:16:03 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00