pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic 6+ messages / 1 participants [nested] [flat]
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/272c2ab9fd0a604e3200030b1ea26fd464c44935 Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistget.c | 4 ++-- src/backend/access/gist/gistvacuum.c | 2 +- src/backend/access/nbtree/nbtsearch.c | 2 +- src/backend/access/nbtree/nbtutils.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/37dd11281352c2e9cba6c3e2512a23b8ac3adeef Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistget.c | 4 ++-- src/backend/access/gist/gistvacuum.c | 2 +- src/backend/access/nbtree/nbtsearch.c | 2 +- src/backend/access/nbtree/nbtutils.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/01268386665f4a59c2fa9236f448bf3caf8c3b0b Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistget.c | 4 ++-- src/backend/access/gist/gistvacuum.c | 2 +- src/backend/access/nbtree/nbtsearch.c | 2 +- src/backend/access/nbtree/nbtutils.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/38a23790e13c84446b55cb0f7028c9da67c361e3 Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistvacuum.c | 2 +- src/backend/access/nbtree/nbtsearch.c | 2 +- src/backend/access/nbtree/nbtutils.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c6187964047f5892fb91e3af170996a93af33ed9 Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistvacuum.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic @ 2018-01-09 20:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2018-01-09 20:10 UTC (permalink / raw) To: pgsql-committers 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 Branch ------ REL9_3_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/469fa9ad6d0564b7252e89726533c0b7ccb2c4ec Modified Files -------------- src/backend/access/gist/gist.c | 5 +++-- src/backend/access/gist/gistvacuum.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-01-09 20:10 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org> 2018-01-09 20:10 pgsql: Change some bogus PageGetLSN calls to BufferGetLSNAtomic Alvaro Herrera <alvherre@alvh.no-ip.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox