postgresql/src/backend
Andres Freund 1c7675a7a4 Fix wrong data table horizon computation during backend startup.
When ComputeXidHorizons() was called before MyDatabaseOid is set,
e.g. because a dead row in a shared relation is encountered during
InitPostgres(), the horizon for normal tables was computed too
aggressively, ignoring all backends connected to a database.

During subsequent pruning in a data table the too aggressive horizon
could end up still being used, possibly leading to still needed tuples
being removed. Not good.

This is a bug in dc7420c2c9, which the test added in 94bc27b576 made
visible, if run with force_parallel_mode set to regress. In that case
the bug is reliably triggered, because "pruning_query" is run in a
parallel worker and the start of that parallel worker is likely to
encounter a dead row in pg_database.

The fix is trivial: Compute a more pessimistic data table horizon if
MyDatabaseId is not yet known.

Author: Andres Freund
Discussion: https://postgr.es/m/20201029040030.p4osrmaywhqaesd4@alap3.anarazel.de
2020-10-28 21:49:07 -07:00
..
access Centralize horizon determination for temp tables, fixing bug due to skew. 2020-10-28 18:02:31 -07:00
bootstrap Make postgres.bki use the same literal-string syntax as postgresql.conf. 2020-10-04 16:09:55 -04:00
catalog Track statistics for streaming of changes from ReorderBuffer. 2020-10-29 09:11:51 +05:30
commands Centralize horizon determination for temp tables, fixing bug due to skew. 2020-10-28 18:02:31 -07:00
executor In INSERT/UPDATE, use the table's real tuple descriptor as target. 2020-10-26 11:36:53 -04:00
foreign
jit llvmjit: Work around bug in LLVM 3.9 causing crashes after 72559438f9. 2020-10-15 18:17:00 -07:00
lib Use pg_bitutils for HyperLogLog. 2020-07-30 09:14:23 -07:00
libpq Fix -Wcast-function-type warnings on Windows/MinGW 2020-10-21 08:17:51 +02:00
main
nodes Fix foreign-key selectivity estimation in the presence of constants. 2020-10-28 11:15:47 -04:00
optimizer Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
parser Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
partitioning Improve error cursor positions for problems with partition bounds. 2020-09-23 18:04:53 -04:00
po
port Fix -Wcast-function-type warnings on Windows/MinGW 2020-10-21 08:17:51 +02:00
postmaster Track statistics for streaming of changes from ReorderBuffer. 2020-10-29 09:11:51 +05:30
regex
replication Track statistics for streaming of changes from ReorderBuffer. 2020-10-29 09:11:51 +05:30
rewrite Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
snowball code: replace most remaining uses of 'master'. 2020-07-08 13:24:35 -07:00
statistics Remove some more useless assignments. 2020-09-04 14:32:19 -04:00
storage Fix wrong data table horizon computation during backend startup. 2020-10-28 21:49:07 -07:00
tcop Fix bogus completion tag usage in walsender 2020-09-16 21:16:25 -03:00
tsearch Improve behavior of tsearch_readline(), and remove t_readline(). 2020-09-23 20:26:58 -04:00
utils Track statistics for streaming of changes from ReorderBuffer. 2020-10-29 09:11:51 +05:30
.gitignore
common.mk
Makefile
nls.mk