pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync 6+ messages / 1 participants [nested] [flat]
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/1d4a0ab19a7e45aa8b94d7f720d1d9cefb81ec40 Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +-- src/backend/access/transam/timeline.c | 40 +++--------------- src/backend/access/transam/xlog.c | 56 +++++-------------------- src/backend/access/transam/xlogarchive.c | 13 +----- src/backend/postmaster/pgarch.c | 6 +-- src/backend/replication/logical/origin.c | 23 +--------- src/backend/utils/misc/guc.c | 6 +-- 7 files changed, 24 insertions(+), 126 deletions(-) -- 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] 6+ messages in thread
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/301cc3549c29aaa58abdd9377a339cd86afeff15 Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +-- src/backend/access/transam/timeline.c | 40 +++--------------- src/backend/access/transam/xlog.c | 56 +++++-------------------- src/backend/access/transam/xlogarchive.c | 13 +----- src/backend/postmaster/pgarch.c | 6 +-- src/backend/replication/logical/origin.c | 23 +--------- src/backend/utils/misc/guc.c | 6 +-- 7 files changed, 24 insertions(+), 126 deletions(-) -- 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] 6+ messages in thread
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/4f37d091694d77b15f36a8a220025f5faa1ed296 Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +--- src/backend/access/transam/timeline.c | 40 ++++--------------------- src/backend/access/transam/xlog.c | 40 +++++-------------------- src/backend/access/transam/xlogarchive.c | 13 ++------ src/backend/postmaster/pgarch.c | 6 +--- src/backend/utils/misc/guc.c | 6 +--- 6 files changed, 18 insertions(+), 93 deletions(-) -- 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] 6+ messages in thread
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/bfa282a02b32afc6a554d1d7a580ea4b91d377c2 Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +--- src/backend/access/transam/timeline.c | 40 ++++--------------------- src/backend/access/transam/xlog.c | 40 +++++-------------------- src/backend/access/transam/xlogarchive.c | 13 ++------ src/backend/postmaster/pgarch.c | 6 +--- 5 files changed, 17 insertions(+), 88 deletions(-) -- 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] 6+ messages in thread
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/ce8f42919dfdf823e670fd3a007e2a1239a9391c Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +- src/backend/access/transam/xlog.c | 73 ++++--------------------- src/backend/postmaster/pgarch.c | 6 +- 3 files changed, 14 insertions(+), 71 deletions(-) -- 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] 6+ messages in thread
* pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync @ 2016-03-10 03:25 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2016-03-10 03:25 UTC (permalink / raw) To: pgsql-committers Avoid unlikely data-loss scenarios due to rename() without fsync. Renaming a file using rename(2) is not guaranteed to be durable in face of crashes. Use the previously added durable_rename()/durable_link_or_rename() in various places where we previously just renamed files. Most of the changed call sites are arguably not critical, but it seems better to err on the side of too much durability. The most prominent known case where the previously missing fsyncs could cause data loss is crashes at the end of a checkpoint. After the actual checkpoint has been performed, old WAL files are recycled. When they're filled, their contents are fdatasynced, but we did not fsync the containing directory. An OS/hardware crash in an unfortunate moment could then end up leaving that file with its old name, but new content; WAL replay would thus not replay it. Reported-By: Tomas Vondra Author: Michael Paquier, Tomas Vondra, Andres Freund Discussion: 56583BDD.9060302@2ndquadrant.com Backpatch: All supported branches Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a62714fae23d2056242bb2ac872111cab8f9fbd1 Modified Files -------------- contrib/pg_stat_statements/pg_stat_statements.c | 6 +-- src/backend/access/transam/xlog.c | 66 +++++-------------------- src/backend/postmaster/pgarch.c | 6 +-- 3 files changed, 13 insertions(+), 65 deletions(-) -- 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] 6+ messages in thread
end of thread, other threads:[~2016-03-10 03:25 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de> 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de> 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de> 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de> 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de> 2016-03-10 03:25 pgsql: Avoid unlikely data-loss scenarios due to rename() without fsync Andres Freund <andres@anarazel.de>
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