pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix WAL-logging of FSM and VM truncation.
5+ messages / 1 participants
[nested] [flat]

* pgsql: Fix WAL-logging of FSM and VM truncation.
@ 2016-10-19 11:29 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2016-10-19 11:29 UTC (permalink / raw)
  To: pgsql-committers

Fix WAL-logging of FSM and VM truncation.

When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/917dc7d2393ce680dea7a59418be9ff341df3c14

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 16 ++++++
src/backend/storage/freespace/freespace.c | 20 ++++++-
src/test/recovery/t/008_fsm_truncation.pl | 93 +++++++++++++++++++++++++++++++
3 files changed, 128 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* pgsql: Fix WAL-logging of FSM and VM truncation.
@ 2016-10-19 12:01 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2016-10-19 12:01 UTC (permalink / raw)
  To: pgsql-committers

Fix WAL-logging of FSM and VM truncation.

When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>

Backpatch to 9.3, where we got data checksums.

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/142530ef0e683af4f063e4efd3b322cd3e9ea87e

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 16 ++++++
src/backend/storage/freespace/freespace.c | 20 ++++++-
src/test/recovery/t/008_fsm_truncation.pl | 93 +++++++++++++++++++++++++++++++
3 files changed, 128 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* pgsql: Fix WAL-logging of FSM and VM truncation.
@ 2016-10-19 12:01 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2016-10-19 12:01 UTC (permalink / raw)
  To: pgsql-committers

Fix WAL-logging of FSM and VM truncation.

When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>

Backpatch to 9.3, where we got data checksums.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b82573d6e4e946ed8e9e3a3c6650245c16e223c1

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 16 ++++++++++++++++
src/backend/storage/freespace/freespace.c | 21 ++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* pgsql: Fix WAL-logging of FSM and VM truncation.
@ 2016-10-19 12:01 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2016-10-19 12:01 UTC (permalink / raw)
  To: pgsql-committers

Fix WAL-logging of FSM and VM truncation.

When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>

Backpatch to 9.3, where we got data checksums.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2523bef15e446d25d16b206bac3b6ef6ad6a8a7d

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 16 ++++++++++++++++
src/backend/storage/freespace/freespace.c | 22 +++++++++++++++++++++-
2 files changed, 37 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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

* pgsql: Fix WAL-logging of FSM and VM truncation.
@ 2016-10-19 12:01 Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 5+ messages in thread

From: Heikki Linnakangas @ 2016-10-19 12:01 UTC (permalink / raw)
  To: pgsql-committers

Fix WAL-logging of FSM and VM truncation.

When a relation is truncated, it is important that the FSM is truncated as
well. Otherwise, after recovery, the FSM can return a page that has been
truncated away, leading to errors like:

ERROR:  could not read block 28991 in file "base/16390/572026": read only 0
of 8192 bytes

We were using MarkBufferDirtyHint() to dirty the buffer holding the last
remaining page of the FSM, but during recovery, that might in fact not
dirty the page, and the FSM update might be lost.

To fix, use the stronger MarkBufferDirty() function. MarkBufferDirty()
requires us to do WAL-logging ourselves, to protect from a torn page, if
checksumming is enabled.

Also fix an oversight in visibilitymap_truncate: it also needs to WAL-log
when checksumming is enabled.

Analysis by Pavan Deolasee.

Discussion: <CABOikdNr5vKucqyZH9s1Mh0XebLs_jRhKv6eJfNnD2wxTn=_9A@mail.gmail.com>

Backpatch to 9.3, where we got data checksums.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1c02ee314bc17ba0ff226c33a64935d02ff1208a

Modified Files
--------------
src/backend/access/heap/visibilitymap.c   | 16 ++++++++++++++++
src/backend/storage/freespace/freespace.c | 21 ++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


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


end of thread, other threads:[~2016-10-19 12:01 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19 11:29 pgsql: Fix WAL-logging of FSM and VM truncation. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2016-10-19 12:01 pgsql: Fix WAL-logging of FSM and VM truncation. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2016-10-19 12:01 pgsql: Fix WAL-logging of FSM and VM truncation. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2016-10-19 12:01 pgsql: Fix WAL-logging of FSM and VM truncation. Heikki Linnakangas <heikki.linnakangas@iki.fi>
2016-10-19 12:01 pgsql: Fix WAL-logging of FSM and VM truncation. Heikki Linnakangas <heikki.linnakangas@iki.fi>

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