pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Extend PageIsVerified() to handle more custom options
8+ messages / 3 participants
[nested] [flat]

* pgsql: Extend PageIsVerified() to handle more custom options
@ 2020-10-26 01:05 Michael Paquier <michael@paquier.xyz>
  2020-10-26 14:39 ` Re: pgsql: Extend PageIsVerified() to handle more custom options Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 8+ messages in thread

From: Michael Paquier @ 2020-10-26 01:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Extend PageIsVerified() to handle more custom options

This is useful for checks of relation pages without having to load the
pages into the shared buffers, and two cases can make use of that: page
verification in base backups and the online, lock-safe, flavor.

Compatibility is kept with past versions using a macro that calls the
new extended routine with the set of options compatible with the
original version.

Extracted from a larger patch by the same author.

Author: Anastasia Lubennikova
Reviewed-by: Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/608f3476-0598-2514-2c03-e05c7d2b0cbd@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d401c5769ef6aeef0a28c147f3fb5afedcd59984

Modified Files
--------------
src/backend/catalog/storage.c       |  3 ++-
src/backend/storage/buffer/bufmgr.c |  6 ++++--
src/backend/storage/page/bufpage.c  | 22 +++++++++++++++-------
src/include/storage/bufpage.h       | 22 ++++++++++++++++------
4 files changed, 37 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Extend PageIsVerified() to handle more custom options
  2020-10-26 01:05 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
@ 2020-10-26 14:39 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2020-10-27 00:18   ` Re: pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 8+ messages in thread

From: Alvaro Herrera @ 2020-10-26 14:39 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

On 2020-Oct-26, Michael Paquier wrote:

> Extend PageIsVerified() to handle more custom options
> 
> This is useful for checks of relation pages without having to load the
> pages into the shared buffers, and two cases can make use of that: page
> verification in base backups and the online, lock-safe, flavor.
> 
> Compatibility is kept with past versions using a macro that calls the
> new extended routine with the set of options compatible with the
> original version.

Please remember that in the macro definition, the arguments should be
enclosed in parens.  No bug here at present, but it seems better to be
cautious.





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Extend PageIsVerified() to handle more custom options
  2020-10-26 01:05 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  2020-10-26 14:39 ` Re: pgsql: Extend PageIsVerified() to handle more custom options Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2020-10-27 00:18   ` Michael Paquier <michael@paquier.xyz>
  2020-10-27 01:29     ` Re: pgsql: Extend PageIsVerified() to handle more custom options Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Michael Paquier @ 2020-10-27 00:18 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org

On Mon, Oct 26, 2020 at 11:39:33AM -0300, Alvaro Herrera wrote:
> Please remember that in the macro definition, the arguments should be
> enclosed in parens.  No bug here at present, but it seems better to be
> cautious.

Indeed, I can see similar changes in the history of the tree.  Do you
think that doing something like the attached is sufficient?
--
Michael

Attachments:

bufpage-macro.patch (text/x-diff, 447B) download diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index d0a52f8e08..82c974dfb3 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -420,7 +420,7 @@ do { \ #define PageIsVerified(page, blkno) \ PageIsVerifiedExtended(page, blkno, \ - PIV_LOG_WARNING | PIV_REPORT_STAT) + (PIV_LOG_WARNING | PIV_REPORT_STAT)) /* * Check that BLCKSZ is a multiple of sizeof(size_t). In
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: pgsql: Extend PageIsVerified() to handle more custom options
  2020-10-26 01:05 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  2020-10-26 14:39 ` Re: pgsql: Extend PageIsVerified() to handle more custom options Alvaro Herrera <alvherre@alvh.no-ip.org>
  2020-10-27 00:18   ` Re: pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
@ 2020-10-27 01:29     ` Tom Lane <tgl@sss.pgh.pa.us>
  2020-10-27 02:12       ` Re: pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2020-10-27 01:29 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org

Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Oct 26, 2020 at 11:39:33AM -0300, Alvaro Herrera wrote:
>> Please remember that in the macro definition, the arguments should be
>> enclosed in parens.  No bug here at present, but it seems better to be
>> cautious.

> Indeed, I can see similar changes in the history of the tree.  Do you
> think that doing something like the attached is sufficient?

Hm, I suspect what Alvaro meant was

 #define PageIsVerified(page, blkno) \
- 	PageIsVerifiedExtended(page, blkno, \
+ 	PageIsVerifiedExtended((page), (blkno), \

But IMV that's not necessary: if the argument parsed as a single
function/macro argument before, it still will do so.  The places
where you have to be careful to add parentheses are where the
macro argument is used as part of a larger expression that is
not just a function/macro argument.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Extend PageIsVerified() to handle more custom options
  2020-10-26 01:05 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  2020-10-26 14:39 ` Re: pgsql: Extend PageIsVerified() to handle more custom options Alvaro Herrera <alvherre@alvh.no-ip.org>
  2020-10-27 00:18   ` Re: pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
  2020-10-27 01:29     ` Re: pgsql: Extend PageIsVerified() to handle more custom options Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-10-27 02:12       ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2020-10-27 02:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org

On Mon, Oct 26, 2020 at 09:29:46PM -0400, Tom Lane wrote:
> Hm, I suspect what Alvaro meant was
> 
>  #define PageIsVerified(page, blkno) \
> - 	PageIsVerifiedExtended(page, blkno, \
> + 	PageIsVerifiedExtended((page), (blkno), \
> 
> But IMV that's not necessary: if the argument parsed as a single
> function/macro argument before, it still will do so.  The places
> where you have to be careful to add parentheses are where the
> macro argument is used as part of a larger expression that is
> not just a function/macro argument.

Thanks.  I really thought that this remark was for the bit-flag
argument for readability reasons, not the two others as we don't do
that in other places (varbit.h, bufpage.h, timestamp.h, brin_page.h,
etc.).  Perhaps I just missed the point.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: Extend PageIsVerified() to handle more custom options
@ 2020-11-02 01:45 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2020-11-02 01:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Extend PageIsVerified() to handle more custom options

This is useful for checks of relation pages without having to load the
pages into the shared buffers, and two cases can make use of that: page
verification in base backups and the online, lock-safe, flavor.

Compatibility is kept with past versions using a routine that calls the
new extended routine with the set of options compatible with the
original version.  Contrary to d401c576, a macro cannot be used as there
may be external code relying on the presence of the original routine.

This is applied down to 11, where this will be used by a follow-up
commit addressing a set of issues with page verification in base
backups.

Extracted from a larger patch by the same author.

Author: Anastasia Lubennikova
Reviewed-by: Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/608f3476-0598-2514-2c03-e05c7d2b0cbd@postgrespro.ru
Backpatch-through: 11

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/017e78a3edc261143c7d791cafca5a5ad326a679

Modified Files
--------------
src/backend/catalog/storage.c       |  3 ++-
src/backend/storage/buffer/bufmgr.c |  6 ++++--
src/backend/storage/page/bufpage.c  | 32 ++++++++++++++++++++++++++------
src/include/storage/bufpage.h       | 17 ++++++++++++-----
4 files changed, 44 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: Extend PageIsVerified() to handle more custom options
@ 2020-11-02 01:45 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2020-11-02 01:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Extend PageIsVerified() to handle more custom options

This is useful for checks of relation pages without having to load the
pages into the shared buffers, and two cases can make use of that: page
verification in base backups and the online, lock-safe, flavor.

Compatibility is kept with past versions using a routine that calls the
new extended routine with the set of options compatible with the
original version.  Contrary to d401c576, a macro cannot be used as there
may be external code relying on the presence of the original routine.

This is applied down to 11, where this will be used by a follow-up
commit addressing a set of issues with page verification in base
backups.

Extracted from a larger patch by the same author.

Author: Anastasia Lubennikova
Reviewed-by: Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/608f3476-0598-2514-2c03-e05c7d2b0cbd@postgrespro.ru
Backpatch-through: 11

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a8795445bc1bacc98d54ad746809bcb638700aca

Modified Files
--------------
src/backend/catalog/storage.c       |  3 ++-
src/backend/storage/buffer/bufmgr.c |  6 ++++--
src/backend/storage/page/bufpage.c  | 32 ++++++++++++++++++++++++++------
src/include/storage/bufpage.h       |  7 +++++++
4 files changed, 39 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* pgsql: Extend PageIsVerified() to handle more custom options
@ 2020-11-02 01:45 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2020-11-02 01:45 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Extend PageIsVerified() to handle more custom options

This is useful for checks of relation pages without having to load the
pages into the shared buffers, and two cases can make use of that: page
verification in base backups and the online, lock-safe, flavor.

Compatibility is kept with past versions using a routine that calls the
new extended routine with the set of options compatible with the
original version.  Contrary to d401c576, a macro cannot be used as there
may be external code relying on the presence of the original routine.

This is applied down to 11, where this will be used by a follow-up
commit addressing a set of issues with page verification in base
backups.

Extracted from a larger patch by the same author.

Author: Anastasia Lubennikova
Reviewed-by: Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/608f3476-0598-2514-2c03-e05c7d2b0cbd@postgrespro.ru
Backpatch-through: 11

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a593bc4674f4f08333447facc111c9659f3d4f8

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c |  6 ++++--
src/backend/storage/page/bufpage.c  | 25 ++++++++++++++++++++-----
src/include/storage/bufpage.h       |  6 ++++++
3 files changed, 30 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2020-11-02 01:45 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 01:05 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
2020-10-26 14:39 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-10-27 00:18   ` Michael Paquier <michael@paquier.xyz>
2020-10-27 01:29     ` Tom Lane <tgl@sss.pgh.pa.us>
2020-10-27 02:12       ` Michael Paquier <michael@paquier.xyz>
2020-11-02 01:45 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
2020-11-02 01:45 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>
2020-11-02 01:45 pgsql: Extend PageIsVerified() to handle more custom options Michael Paquier <michael@paquier.xyz>

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