pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()
3+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2024-01-19 448a3331d9  Fix name collision in c64086b79dba
* pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()
@ 2024-01-19 15:19 Alexander Korotkov <akorotkov@postgresql.org>
  2024-01-19 16:08 ` Re: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Alexander Korotkov @ 2024-01-19 15:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Reorder actions in ProcArrayApplyRecoveryInfo()

Since 5a1dfde8334b, 2PC filenames use FullTransactionId.  Thus, it needs to
convert TransactionId to FullTransactionId in StandbyTransactionIdIsPrepared()
using TransamVariables->nextXid.  However, ProcArrayApplyRecoveryInfo()
first releases locks with usage StandbyTransactionIdIsPrepared(), then advances
TransamVariables->nextXid.  This sequence of actions could cause errors.
This commit makes ProcArrayApplyRecoveryInfo() advance
TransamVariables->nextXid before releasing locks.

Reported-by: Thomas Munro, Michael Paquier
Discussion: https://postgr.es/m/CA%2BhUKGLj_ve1_pNAnxwYU9rDcv7GOhsYXJt7jMKSA%3D5-6ss-Cw%40mail.gmail.com
Discussion: https://postgr.es/m/Zadp9f4E1MYvMJqe%40paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/storage/ipc/procarray.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



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

* Re: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()
  2024-01-19 15:19 pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Alexander Korotkov <akorotkov@postgresql.org>
@ 2024-01-19 16:08 ` Tom Lane <tgl@sss.pgh.pa.us>
  2024-01-19 16:18   ` Re: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Alexander Korotkov <aekorotkov@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2024-01-19 16:08 UTC (permalink / raw)
  To: Alexander Korotkov <akorotkov@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Alexander Korotkov <akorotkov@postgresql.org> writes:
> Reorder actions in ProcArrayApplyRecoveryInfo()

I'm seeing this warning since this commit:

procarray.c: In function 'ProcArrayApplyRecoveryInfo':
procarray.c:1172:17: warning: declaration of 'xid' shadows a previous local [-Wshadow=compatible-local]
   TransactionId xid = running->xids[i];
                 ^~~
procarray.c:1056:16: note: shadowed declaration is here
  TransactionId xid;
                ^~~

			regards, tom lane





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

* Re: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo()
  2024-01-19 15:19 pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Alexander Korotkov <akorotkov@postgresql.org>
  2024-01-19 16:08 ` Re: pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Tom Lane <tgl@sss.pgh.pa.us>
@ 2024-01-19 16:18   ` Alexander Korotkov <aekorotkov@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexander Korotkov @ 2024-01-19 16:18 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alexander Korotkov <akorotkov@postgresql.org>; pgsql-committers@lists.postgresql.org

On Fri, Jan 19, 2024 at 6:08 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Korotkov <akorotkov@postgresql.org> writes:
> > Reorder actions in ProcArrayApplyRecoveryInfo()
>
> I'm seeing this warning since this commit:
>
> procarray.c: In function 'ProcArrayApplyRecoveryInfo':
> procarray.c:1172:17: warning: declaration of 'xid' shadows a previous local [-Wshadow=compatible-local]
>    TransactionId xid = running->xids[i];
>                  ^~~
> procarray.c:1056:16: note: shadowed declaration is here
>   TransactionId xid;
>                 ^~~

Thank you for reporting.  Must be fixed in 448a3331d9.

------
Regards,
Alexander Korotkov





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


end of thread, other threads:[~2024-01-19 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 15:19 pgsql: Reorder actions in ProcArrayApplyRecoveryInfo() Alexander Korotkov <akorotkov@postgresql.org>
2024-01-19 16:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-01-19 16:18   ` Alexander Korotkov <aekorotkov@gmail.com>

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