postgresql/src/backend
Alvaro Herrera 272c2ab9fd Change some bogus PageGetLSN calls to BufferGetLSNAtomic
As src/backend/access/transam/README says, PageGetLSN may only be called
by processes holding either exclusive lock on buffer, or a shared lock
on buffer plus buffer header lock.  Therefore any place that only holds
a shared buffer lock must use BufferGetLSNAtomic instead of PageGetLSN,
which internally obtains buffer header lock prior to reading the LSN.

A few callsites failed to comply with this rule.  This was detected by
running all tests under a new (not committed) assertion that verifies
PageGetLSN locking contract.  All but one of the callsites that failed
the assertion are fixed by this patch.  Remaining callsites were
inspected manually and determined not to need any change.

The exception (unfixed callsite) is in TestForOldSnapshot, which only
has a Page argument, making it impossible to access the corresponding
Buffer from it.  Fixing that seems a much larger patch that will have to
be done separately; and that's just as well, since it was only
introduced in 9.6 and other bugs are much older.

Some of these bugs are ancient; backpatch all the way back to 9.3.

Authors: Jacob Champion, Asim Praveen, Ashwin Agrawal
Reviewed-by: Michaël Paquier
Discussion: https://postgr.es/m/CABAq_6GXgQDVu3u12mK9O5Xt5abBZWQ0V40LZCE+oUf95XyNFg@mail.gmail.com
2018-01-09 17:06:31 -03:00
..
access Change some bogus PageGetLSN calls to BufferGetLSNAtomic 2018-01-09 17:06:31 -03:00
bootstrap Update copyright for 2018 2018-01-02 23:30:12 -05:00
catalog Minor preparatory refactoring for UPDATE row movement. 2018-01-04 16:25:49 -05:00
commands Remove PortalGetQueryDesc() 2018-01-09 13:47:56 -05:00
executor Remove PortalGetQueryDesc() 2018-01-09 13:47:56 -05:00
foreign Update copyright for 2018 2018-01-02 23:30:12 -05:00
lib Update copyright for 2018 2018-01-02 23:30:12 -05:00
libpq Another attempt at fixing build with various OpenSSL versions 2018-01-04 19:09:27 -05:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Rewrite list_qsort() to avoid trashing its input list. 2018-01-09 13:25:53 -05:00
optimizer Improve the heuristic for ordering child paths of a parallel append. 2018-01-09 13:07:52 -05:00
parser Don't allow VACUUM VERBOSE ANALYZE VERBOSE. 2018-01-09 10:20:48 -05:00
po Translation updates 2017-08-07 13:55:34 -04:00
port Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Update copyright for 2018 2018-01-02 23:30:12 -05:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Fix race condition during replication origin drop. 2018-01-09 12:09:30 -05:00
rewrite Update copyright for 2018 2018-01-02 23:30:12 -05:00
snowball Update copyright for 2018 2018-01-02 23:30:12 -05:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage While waiting for a condition variable, detect postmaster death. 2018-01-09 12:34:57 -05:00
tcop Remove PortalGetQueryDesc() 2018-01-09 13:47:56 -05:00
tsearch Update copyright for 2018 2018-01-02 23:30:12 -05:00
utils Implement TZH and TZM timestamp format patterns 2018-01-09 14:25:05 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00
common.mk Add ICU_CFLAGS to global CPPFLAGS 2017-06-12 15:57:22 -04:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00