postgresql/src/include/storage
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
..
backendid.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
barrier.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
block.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
buf.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
buf_internals.h Scan the buffer pool just once, not once per fork, during relation drop. 2012-06-07 17:43:11 -04:00
buffile.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
bufmgr.h Scan the buffer pool just once, not once per fork, during relation drop. 2012-06-07 17:43:11 -04:00
bufpage.h Replace XLogRecPtr struct with a 64-bit integer. 2012-06-24 19:19:45 +03:00
copydir.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
fd.h Inherit max_safe_fds to child processes in EXEC_BACKEND mode. 2012-03-29 08:19:11 +03:00
freespace.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
fsm_internals.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
indexfsm.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
ipc.h Unify calling conventions for postgres/postmaster sub-main functions 2012-06-25 21:30:12 +03:00
item.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
itemid.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
itemptr.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
large_object.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
latch.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
lmgr.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
lock.h Add a small cache of locks owned by a resource owner in ResourceOwner. 2012-06-21 15:30:26 +03:00
lwlock.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
off.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
pg_sema.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
pg_shmem.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
pmsignal.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
pos.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
predicate.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
predicate_internals.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
proc.h Introduce timeout handling framework 2012-07-16 22:55:33 -04:00
procarray.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
procsignal.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
reinit.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
relfilenode.h Improve coding around the fsync request queue. 2012-07-17 16:56:54 -04:00
s_lock.h When LWLOCK_STATS is defined, count spindelays. 2012-06-26 16:06:07 -04:00
shmem.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
sinval.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
sinvaladt.h Tighten up includes in sinvaladt.h, twophase.h, proc.h 2012-06-25 18:40:40 -04:00
smgr.h Improve coding around the fsync request queue. 2012-07-17 16:56:54 -04:00
spin.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
standby.h Introduce timeout handling framework 2012-07-16 22:55:33 -04:00