postgresql/src/include/storage
Tom Lane 9c2626acac 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:08 -04:00
..
backendid.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
block.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
buf.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
buf_internals.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
buffile.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
bufmgr.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
bufpage.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
fd.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
freespace.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
ipc.h Repair two places where SIGTERM exit could leave shared memory state 2008-04-16 23:59:51 +00:00
item.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
itemid.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
itempos.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
itemptr.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
large_object.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
lmgr.h Fix PREPARE TRANSACTION to reject the case where the transaction has dropped a 2008-03-04 19:54:13 +00:00
lock.h Widen the nLocks counts in local lock tables from int to int64. This 2008-09-16 01:56:35 +00:00
lwlock.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
off.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
pg_sema.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
pg_shmem.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
pmsignal.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
pos.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
proc.h Change StatementCancelHandler() to check the DoingCommandRead flag to decide 2008-01-26 19:55:08 +00:00
procarray.h Fix CREATE INDEX CONCURRENTLY to not deadlock against an automatic or manual 2008-01-09 21:52:36 +00:00
relfilenode.h Improve coding around the fsync request queue. 2012-07-17 16:56:08 -04:00
s_lock.h Use __sync_lock_test_and_set() for spinlocks on ARM, if available. 2012-01-07 15:39:16 -05:00
shmem.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
sinval.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
sinvaladt.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
smgr.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
spin.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00