pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix handling of files that source server removes during pg_rewin
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix handling of files that source server removes during pg_rewin
@ 2018-03-28 19:02  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2018-03-28 19:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of files that source server removes during pg_rewind is running.

After processing the filemap to build the list of chunks that will be
fetched from the source to rewing the target server, it is possible that
a file which was previously processed is removed from the source.  A
simple example of such an occurence is a WAL segment which gets recycled
on the target in-between.  When the filemap is processed, files not
categorized as relation files are first truncated to prepare for its
full copy of which is going to be taken from the source, divided into a
set of junks.  However, for a recycled WAL segment, this would result in
a segment which has a zero-byte size.  With such an empty file,
post-rewind recovery thinks that records are saved but they are actually
not because of the truncation which happened when processing the
filemap, resulting in data loss.

In order to fix the problem, make sure that files which are found as
removed on the source when receiving chunks of them are as well deleted
on the target server for consistency.

Back-patch to 9.5 where pg_rewind was added.

Author: Tsunakawa Takayuki
Reviewed-by: Michael Paquier
Reported-by: Tsunakawa Takayuki

Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/09e96b3f35627a2939e2effd8b98aaa934f59b32

Modified Files
--------------
src/bin/pg_rewind/file_ops.c    | 16 ++++++++++++----
src/bin/pg_rewind/file_ops.h    |  1 +
src/bin/pg_rewind/libpq_fetch.c | 10 +++++++---
3 files changed, 20 insertions(+), 7 deletions(-)



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

* pgsql: Fix handling of files that source server removes during pg_rewin
@ 2018-03-28 19:03  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2018-03-28 19:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of files that source server removes during pg_rewind is running.

After processing the filemap to build the list of chunks that will be
fetched from the source to rewing the target server, it is possible that
a file which was previously processed is removed from the source.  A
simple example of such an occurence is a WAL segment which gets recycled
on the target in-between.  When the filemap is processed, files not
categorized as relation files are first truncated to prepare for its
full copy of which is going to be taken from the source, divided into a
set of junks.  However, for a recycled WAL segment, this would result in
a segment which has a zero-byte size.  With such an empty file,
post-rewind recovery thinks that records are saved but they are actually
not because of the truncation which happened when processing the
filemap, resulting in data loss.

In order to fix the problem, make sure that files which are found as
removed on the source when receiving chunks of them are as well deleted
on the target server for consistency.

Back-patch to 9.5 where pg_rewind was added.

Author: Tsunakawa Takayuki
Reviewed-by: Michael Paquier
Reported-by: Tsunakawa Takayuki

Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/bin/pg_rewind/file_ops.c    | 16 ++++++++++++----
src/bin/pg_rewind/file_ops.h    |  1 +
src/bin/pg_rewind/libpq_fetch.c | 10 +++++++---
3 files changed, 20 insertions(+), 7 deletions(-)



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

* pgsql: Fix handling of files that source server removes during pg_rewin
@ 2018-03-28 19:03  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2018-03-28 19:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of files that source server removes during pg_rewind is running.

After processing the filemap to build the list of chunks that will be
fetched from the source to rewing the target server, it is possible that
a file which was previously processed is removed from the source.  A
simple example of such an occurence is a WAL segment which gets recycled
on the target in-between.  When the filemap is processed, files not
categorized as relation files are first truncated to prepare for its
full copy of which is going to be taken from the source, divided into a
set of junks.  However, for a recycled WAL segment, this would result in
a segment which has a zero-byte size.  With such an empty file,
post-rewind recovery thinks that records are saved but they are actually
not because of the truncation which happened when processing the
filemap, resulting in data loss.

In order to fix the problem, make sure that files which are found as
removed on the source when receiving chunks of them are as well deleted
on the target server for consistency.

Back-patch to 9.5 where pg_rewind was added.

Author: Tsunakawa Takayuki
Reviewed-by: Michael Paquier
Reported-by: Tsunakawa Takayuki

Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/52c32d8d8d3cc29d9c2ab4a0c360fb09627231e1

Modified Files
--------------
src/bin/pg_rewind/file_ops.c    | 16 ++++++++++++----
src/bin/pg_rewind/file_ops.h    |  1 +
src/bin/pg_rewind/libpq_fetch.c | 10 +++++++---
3 files changed, 20 insertions(+), 7 deletions(-)



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

* pgsql: Fix handling of files that source server removes during pg_rewin
@ 2018-03-28 19:03  Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2018-03-28 19:03 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of files that source server removes during pg_rewind is running.

After processing the filemap to build the list of chunks that will be
fetched from the source to rewing the target server, it is possible that
a file which was previously processed is removed from the source.  A
simple example of such an occurence is a WAL segment which gets recycled
on the target in-between.  When the filemap is processed, files not
categorized as relation files are first truncated to prepare for its
full copy of which is going to be taken from the source, divided into a
set of junks.  However, for a recycled WAL segment, this would result in
a segment which has a zero-byte size.  With such an empty file,
post-rewind recovery thinks that records are saved but they are actually
not because of the truncation which happened when processing the
filemap, resulting in data loss.

In order to fix the problem, make sure that files which are found as
removed on the source when receiving chunks of them are as well deleted
on the target server for consistency.

Back-patch to 9.5 where pg_rewind was added.

Author: Tsunakawa Takayuki
Reviewed-by: Michael Paquier
Reported-by: Tsunakawa Takayuki

Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8DAAA2%40G01JPEXMBYT05

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/bin/pg_rewind/file_ops.c    | 16 ++++++++++++----
src/bin/pg_rewind/file_ops.h    |  1 +
src/bin/pg_rewind/libpq_fetch.c | 10 +++++++---
3 files changed, 20 insertions(+), 7 deletions(-)



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


end of thread, other threads:[~2018-03-28 19:03 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 19:02 pgsql: Fix handling of files that source server removes during pg_rewin Fujii Masao <fujii@postgresql.org>
2018-03-28 19:03 pgsql: Fix handling of files that source server removes during pg_rewin Fujii Masao <fujii@postgresql.org>
2018-03-28 19:03 pgsql: Fix handling of files that source server removes during pg_rewin Fujii Masao <fujii@postgresql.org>
2018-03-28 19:03 pgsql: Fix handling of files that source server removes during pg_rewin Fujii Masao <fujii@postgresql.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