pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: PANIC on fsync() failure. 6+ messages / 1 participants [nested] [flat]
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:44 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/9ccdd7f66e3324d2b6d3dec282cfa9ff084083f1 Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 48 +++++++++++++++++++++++---- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 +++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 99 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:45 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6534d544cd77e14a93f5c779fa8addee8d916a66 Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 48 +++++++++++++++++++++++---- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 +++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 99 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:45 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/afbe03f6547015790d13d21d5eb5083cc604eeec Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 48 +++++++++++++++++++++++---- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 +++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 99 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:45 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b9cce9ddfa1748c76d1d35c62aa35fe70ddc2dbe Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 48 +++++++++++++++++++++++---- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 +++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 99 insertions(+), 18 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:45 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3124352322179a4b3bdc47f98caf2ef8e0e3de65 Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 42 +++++++++++++++++++++++++-- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 ++++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 97 insertions(+), 14 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: PANIC on fsync() failure. @ 2018-11-19 04:46 Thomas Munro <tmunro@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Thomas Munro @ 2018-11-19 04:46 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org PANIC on fsync() failure. On some operating systems, it doesn't make sense to retry fsync(), because dirty data cached by the kernel may have been dropped on write-back failure. In that case the only remaining copy of the data is in the WAL. A subsequent fsync() could appear to succeed, but not have flushed the data. That means that a future checkpoint could apparently complete successfully but have lost data. Therefore, violently prevent any future checkpoint attempts by panicking on the first fsync() failure. Note that we already did the same for WAL data; this change extends that behavior to non-temporary data files. Provide a GUC data_sync_retry to control this new behavior, for users of operating systems that don't eject dirty data, and possibly forensic/testing uses. If it is set to on and the write-back error was transient, a later checkpoint might genuinely succeed (on a system that does not throw away buffers on failure); if the error is permanent, later checkpoints will continue to fail. The GUC defaults to off, meaning that we panic. Back-patch to all supported releases. There is still a narrow window for error-loss on some operating systems: if the file is closed and later reopened and a write-back error occurs in the intervening time, but the inode has the bad luck to be evicted due to memory pressure before we reopen, we could miss the error. A later patch will address that with a scheme for keeping files with dirty data open at all times, but we judge that to be too complicated to back-patch. Author: Craig Ringer, with some adjustments by Thomas Munro Reported-by: Craig Ringer Reviewed-by: Robert Haas, Thomas Munro, Andres Freund Discussion: https://postgr.es/m/20180427222842.in2e4mibx45zdth5%40alap3.anarazel.de Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f1ff5f51d2490817c2b3bba202f4e2c73a846389 Modified Files -------------- doc/src/sgml/config.sgml | 32 ++++++++++++++++++++ src/backend/access/heap/rewriteheap.c | 6 ++-- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/timeline.c | 4 +-- src/backend/access/transam/xlog.c | 2 +- src/backend/replication/logical/snapbuild.c | 3 ++ src/backend/storage/file/fd.c | 42 +++++++++++++++++++++++++-- src/backend/storage/smgr/md.c | 6 ++-- src/backend/utils/cache/relmapper.c | 2 +- src/backend/utils/misc/guc.c | 9 ++++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/storage/fd.h | 2 ++ 12 files changed, 97 insertions(+), 14 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-11-19 04:46 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-11-19 04:44 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@postgresql.org> 2018-11-19 04:45 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@postgresql.org> 2018-11-19 04:45 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@postgresql.org> 2018-11-19 04:45 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@postgresql.org> 2018-11-19 04:45 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@postgresql.org> 2018-11-19 04:46 pgsql: PANIC on fsync() failure. Thomas Munro <tmunro@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