AlterSubscription_refresh "wrconn" wrong variable?

Поиск
Список
Период
Сортировка
От Peter Smith
Тема AlterSubscription_refresh "wrconn" wrong variable?
Дата
Msg-id CAHut+Pu7Jv9L2BOEx_Z0UtJxfDevQSAUW2mJqWU+CtmDrEZVAg@mail.gmail.com
обсуждение исходный текст
Ответы Re: AlterSubscription_refresh "wrconn" wrong variable?  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Re: AlterSubscription_refresh "wrconn" wrong variable?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
While reviewing some logical replication code I stumbled across a
variable usage that looks suspicious to me.

Note that the AlterSubscription_refresh function (unlike other
functions in the subscriptioncmds.c) is using the global variable
"wrconn" instead of a local stack variable of the same name. I was
unable to think of any good reason why it would be deliberately doing
this, so my guess is that it is simply an accidental mistake that has
gone unnoticed because the compiler was silently equally happy just
using the global var.

Apparently, this is not causing any reported problems because it seems
like the code has been this way for ~4 years [1].

Even so, it doesn't look intentional to me and I felt that there may
be unknown consequences (e.g. resource leakage?) of just blatting over
the global var. So, PSA a small patch to make this
AlterSubscription_refresh function use a stack variable consistent
with the other nearby functions.

Thoughts?

------
[1] https://github.com/postgres/postgres/commit/7c4f52409a8c7d85ed169bbbc1f6092274d03920#

Kind Regards,
Peter Smith.
Fujitsu Australia

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Performance Evaluation of Result Cache by using TPC-DS
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: MaxOffsetNumber for Table AMs