pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7fbe0c8c4d4fe429ee1d6383706ea5ccb0f639d3

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3a0d2d0cbaf349a1aba928bb7b14edeaffab5212

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/795a9166e2e16058256e90fdc2a3af8ee726ca30

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/11dbad74c10442d1cd2d10ac4284980912a09508

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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

* pgsql: Fix some issues with WAL segment opening for pg_receivewal --com
@ 2021-07-20 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2021-07-20 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some issues with WAL segment opening for pg_receivewal --compress

The logic handling the opening of new WAL segments was fuzzy when using
--compress if a partial, non-compressed, segment with the same base name
existed in the repository storing those files.  In this case, using
--compress would cause the code to first check for the existence and the
size of a non-compressed segment, followed by the opening of a new
compressed, partial, segment.  The code was accidentally working
correctly on most platforms as the buildfarm has proved, except
bowerbird where gzflush() could fail in this code path.  It is wrong
anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it.

Note that this issue exists when users mix successive runs of
pg_receivewal with or without compression, as discovered with the tests
introduced by ffc9dda.

While on it, this refactors the code so as code paths that need to know
about the ".gz" suffix are down from four to one in walmethods.c, easing
a bit the introduction of new compression methods.  This addresses a
second issue where log messages generated for an unexpected failure
would not show the compressed segment name involved, which was
confusing, printing instead the name of the non-compressed equivalent.

Reported-by: Georgios Kokolatos
Discussion: https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz
Backpatch-through: 10

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 13 ++++---
src/bin/pg_basebackup/walmethods.c | 79 +++++++++++++++++++++++++++++---------
src/bin/pg_basebackup/walmethods.h |  9 +++++
3 files changed, 78 insertions(+), 23 deletions(-)



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


end of thread, other threads:[~2021-07-20 03:13 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com Michael Paquier <michael@paquier.xyz>
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com Michael Paquier <michael@paquier.xyz>
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com Michael Paquier <michael@paquier.xyz>
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com Michael Paquier <michael@paquier.xyz>
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com Michael Paquier <michael@paquier.xyz>
2021-07-20 03:13 pgsql: Fix some issues with WAL segment opening for pg_receivewal --com 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