postgresql/src/include
Noah Misch c6b92041d3 Skip WAL for new relfilenodes, under wal_level=minimal.
Until now, only selected bulk operations (e.g. COPY) did this.  If a
given relfilenode received both a WAL-skipping COPY and a WAL-logged
operation (e.g. INSERT), recovery could lose tuples from the COPY.  See
src/backend/access/transam/README section "Skipping WAL for New
RelFileNode" for the new coding rules.  Maintainers of table access
methods should examine that section.

To maintain data durability, just before commit, we choose between an
fsync of the relfilenode and copying its contents to WAL.  A new GUC,
wal_skip_threshold, guides that choice.  If this change slows a workload
that creates small, permanent relfilenodes under wal_level=minimal, try
adjusting wal_skip_threshold.  Users setting a timeout on COMMIT may
need to adjust that timeout, and log_min_duration_statement analysis
will reflect time consumption moving to COMMIT from commands like COPY.

Internally, this requires a reliable determination of whether
RollbackAndReleaseCurrentSubTransaction() would unlink a relation's
current relfilenode.  Introduce rd_firstRelfilenodeSubid.  Amend the
specification of rd_createSubid such that the field is zero when a new
rel has an old rd_node.  Make relcache.c retain entries for certain
dropped relations until end of transaction.

Bump XLOG_PAGE_MAGIC, since this introduces XLOG_GIST_ASSIGN_LSN.
Future servers accept older WAL, so this bump is discretionary.

Kyotaro Horiguchi, reviewed (in earlier, similar versions) by Robert
Haas.  Heikki Linnakangas and Michael Paquier implemented earlier
designs that materially clarified the problem.  Reviewed, in earlier
designs, by Andrew Dunstan, Andres Freund, Alvaro Herrera, Tom Lane,
Fujii Masao, and Simon Riggs.  Reported by Martijn van Oosterhout.

Discussion: https://postgr.es/m/20150702220524.GA9392@svana.org
2020-04-04 12:25:34 -07:00
..
access Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
bootstrap Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catalog Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
commands Include information on buffer usage during planning phase, in EXPLAIN output, take two. 2020-04-04 03:13:17 +09:00
common Add checksum helper functions. 2020-04-03 11:52:43 -04:00
datatype Update copyrights for 2020 2020-01-01 12:21:45 -05:00
executor Add infrastructure to track WAL usage. 2020-04-04 10:02:08 +05:30
fe_utils Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit jit: Reference expression step functions via llvmjit_types. 2020-02-06 22:29:14 -08:00
lib Skip memcpy(x, x) in qunique(). 2020-01-04 11:31:42 -08:00
libpq Fix assorted portability issues in commit 896fcdb23. 2020-03-25 19:37:30 -04:00
mb Allow Unicode escapes in any server encoding, not only UTF-8. 2020-03-06 14:17:43 -05:00
nodes Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
optimizer Cosmetic improvements for code related to partitionwise join. 2020-04-03 17:00:35 -04:00
parser Add SQL functions for Unicode normalization 2020-04-02 08:56:27 +02:00
partitioning Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port Enable Unix-domain sockets support on Windows 2020-03-28 15:01:01 +01:00
portability Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postmaster Trigger autovacuum based on number of INSERTs 2020-03-28 19:20:12 +13:00
regex Assume that we have <wchar.h>. 2020-02-21 14:30:47 -05:00
replication Generate backup manifests for base backups, and validate them. 2020-04-03 15:05:59 -04:00
rewrite Update copyrights for 2020 2020-01-01 12:21:45 -05:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Use multi-variate MCV lists to estimate ScalarArrayOpExpr 2020-03-14 16:13:00 +01:00
storage Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
tcop Allow the planner-related functions and hook to accept the query string. 2020-03-30 13:51:05 +09:00
tsearch Assume that we have <wchar.h>. 2020-02-21 14:30:47 -05:00
utils Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Enable Unix-domain sockets support on Windows 2020-03-28 15:01:01 +01:00
fmgr.h Implement operator class parameters 2020-03-30 19:17:23 +03:00
funcapi.h Avoid holding a directory FD open across assorted SRF calls. 2020-03-16 21:05:52 -04:00
getaddrinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
getopt_long.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
miscadmin.h Unify several ways to tracking backend type 2020-03-13 14:01:10 +01:00
pg_config.h.in Enable Unix-domain sockets support on Windows 2020-03-28 15:01:01 +01:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Enable Unix-domain sockets support on Windows 2020-03-28 15:01:01 +01:00
pg_getopt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_trace.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgstat.h Add wait events for recovery conflicts. 2020-04-03 12:15:56 +09:00
pgtar.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgtime.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port.h Add -c/--restore-target-wal to pg_rewind 2020-04-01 10:57:03 +09:00
postgres.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rusagestub.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
windowapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00