postgresql/src/backend
Tom Lane 73b796a52c Improve coding around the fsync request queue.
In all branches back to 8.3, this patch fixes a questionable assumption in
CompactCheckpointerRequestQueue/CompactBgwriterRequestQueue that there are
no uninitialized pad bytes in the request queue structs.  This would only
cause trouble if (a) there were such pad bytes, which could happen in 8.4
and up if the compiler makes enum ForkNumber narrower than 32 bits, but
otherwise would require not-currently-planned changes in the widths of
other typedefs; and (b) the kernel has not uniformly initialized the
contents of shared memory to zeroes.  Still, it seems a tad risky, and we
can easily remove any risk by pre-zeroing the request array for ourselves.
In addition to that, we need to establish a coding rule that struct
RelFileNode can't contain any padding bytes, since such structs are copied
into the request array verbatim.  (There are other places that are assuming
this anyway, it turns out.)

In 9.1 and up, the risk was a bit larger because we were also effectively
assuming that struct RelFileNodeBackend contained no pad bytes, and with
fields of different types in there, that would be much easier to break.
However, there is no good reason to ever transmit fsync or delete requests
for temp files to the bgwriter/checkpointer, so we can revert the request
structs to plain RelFileNode, getting rid of the padding risk and saving
some marginal number of bytes and cycles in fsync queue manipulation while
we are at it.  The savings might be more than marginal during deletion of
a temp relation, because the old code transmitted an entirely useless but
nonetheless expensive-to-process ForgetRelationFsync request to the
background process, and also had the background process perform the file
deletion even though that can safely be done immediately.

In addition, make some cleanup of nearby comments and small improvements to
the code in CompactCheckpointerRequestQueue/CompactBgwriterRequestQueue.
2012-07-17 16:56:54 -04:00
..
access Remove unreachable code 2012-07-16 22:15:03 +03:00
bootstrap Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
catalog Run updated copyright.pl on HEAD and 9.2 trees, updating the psql 2012-07-06 12:28:18 -04:00
commands Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
executor Remove unreachable code 2012-07-16 22:15:03 +03:00
foreign Add GetForeignColumnOptions() to foreign.c, and add some documentation. 2012-03-07 18:20:58 -05:00
lib Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
libpq Remove unreachable code 2012-07-16 22:15:03 +03:00
main Unify calling conventions for postgres/postmaster sub-main functions 2012-06-25 21:30:12 +03:00
nodes Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
optimizer Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns. 2012-07-09 23:22:55 -04:00
parser Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Remove misleading hints about reducing the System V request size. 2012-07-03 10:07:47 -04:00
postmaster Improve coding around the fsync request queue. 2012-07-17 16:56:54 -04:00
regex Prevent corner-case core dump in rfree(). 2012-07-15 13:27:54 -04:00
replication Introduce timeout handling framework 2012-07-16 22:55:33 -04:00
rewrite Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:45:14 -04:00
snowball Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
storage Improve coding around the fsync request queue. 2012-07-17 16:56:54 -04:00
tcop Introduce timeout handling framework 2012-07-16 22:55:33 -04:00
tsearch Remove unreachable code 2012-07-16 22:15:03 +03:00
utils Introduce timeout handling framework 2012-07-16 22:55:33 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
Makefile Fix incorrect make maintainer-clean rule. 2012-04-07 18:16:50 -04:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00