pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: walsnd: Don't set waiting_for_ping_response spuriously
7+ messages / 1 participants
[nested] [flat]

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/470687b4a5bb3b9f2b5bf7c9235680b3c91bd050

Modified Files
--------------
src/backend/replication/walsender.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/900429d0c03668ac474770c01ba5911b15025dfb

Modified Files
--------------
src/backend/replication/walsender.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/85cb4ec509c3a27f1b3b8bcaf23a87a76a5a44d0

Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1fa6eec974f8f17f8c5fcd54eb33625f9b107050

Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/55d42c9178306f4f92ac4ed0a924b2e3b914a5b1

Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)



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

* pgsql: walsnd: Don't set waiting_for_ping_response spuriously
@ 2020-08-08 16:42 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Alvaro Herrera @ 2020-08-08 16:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

walsnd: Don't set waiting_for_ping_response spuriously

Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply.  That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.

With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.

This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.

Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)



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


end of thread, other threads:[~2020-08-08 16:42 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously Alvaro Herrera <alvherre@alvh.no-ip.org>
2020-08-08 16:42 pgsql: walsnd: Don't set waiting_for_ping_response spuriously 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