postgresql/src/backend
Andres Freund 524dbc1433 Avoid superfluous work for commits during logical slot creation.
Before 955a684e04 logical decoding snapshot maintenance needed to
cope with transactions it might not have seen in their entirety. For
such transactions we'd to assume they modified the catalog (could have
happened before we were watching), and thus a new snapshot had to be
built, and distributed to concurrently running transactions.

That's problematic because building a new snapshot isn't that cheap ,
especially as the the array of committed transactions needs to be
sorted.  When creating a slot on a server with a lot of transactions,
this could make logical slot creation infeasibly expensive.

After 955a684e04 there's no need to deal with transaction that
aren't guaranteed to be fully observable.  That allows to avoid
building snapshots for transactions that haven't modified catalog,
even before reaching consistency.

While this isn't necessarily a bugfix, slot creation being impossible
in some production workloads, is severe enough to warrant
backpatching.

Author: Andres Freund, based on a quite different patch from Petr Jelinek
Analyzed-By: Petr Jelinek
Reviewed-By: Petr Jelinek
Discussion: https://postgr.es/m/f37e975c-908f-858e-707f-058d3b1eb214@2ndquadrant.com
Backpatch: 9.4-, where logical decoding has been introduced
2017-05-13 15:06:40 -07:00
..
access Standardize "WAL location" terminology 2017-05-12 13:51:27 -04:00
bootstrap Use one transaction while reading postgres.bki, not one per line. 2017-04-14 17:51:25 -04:00
catalog Teach \d+ to show partitioning constraints. 2017-05-13 12:04:53 -04:00
commands Fix dependencies for extended statistics objects. 2017-05-12 16:26:31 -04:00
executor Redesign get_attstatsslot()/free_attstatsslot() for more safety and speed. 2017-05-13 15:14:39 -04:00
foreign Abstract logic to allow for multiple kinds of child rels. 2017-04-03 22:41:31 -04:00
lib Revert "Permit dump/reload of not-too-large >1GB tuples" 2017-05-10 18:41:27 -03:00
libpq Remove support for password_encryption='off' / 'plain'. 2017-05-08 11:26:07 +03:00
main Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
nodes Change CREATE STATISTICS syntax 2017-05-12 14:59:35 -03:00
optimizer Reduce semijoins with unique inner relations to plain inner joins. 2017-05-01 14:53:42 -04:00
parser Change CREATE STATISTICS syntax 2017-05-12 14:59:35 -03:00
po Translation updates 2016-08-08 11:08:00 -04:00
port Provide a way to control SysV shmem attach address in EXEC_BACKEND builds. 2017-04-15 17:27:38 -04:00
postmaster Replace "transaction log" with "write-ahead log" 2017-05-12 11:52:43 -04:00
regex Fix regexport.c to behave sanely with lookaround constraints. 2017-04-13 17:18:35 -04:00
replication Avoid superfluous work for commits during logical slot creation. 2017-05-13 15:06:40 -07:00
rewrite RLS: Fix ALL vs. SELECT+UPDATE policy usage 2017-05-06 21:46:35 -04:00
snowball Add ICU_FLAGS to one more place 2017-03-23 16:53:10 -04:00
statistics extstats: change output functions to emit valid JSON 2017-05-02 18:49:32 -03:00
storage Cope with glibc too old to have epoll_create1(). 2017-04-27 17:13:53 -04:00
tcop Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
tsearch Redesign get_attstatsslot()/free_attstatsslot() for more safety and speed. 2017-05-13 15:14:39 -04:00
utils Redesign get_attstatsslot()/free_attstatsslot() for more safety and speed. 2017-05-13 15:14:39 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Implement multivariate n-distinct coefficients 2017-03-24 14:06:10 -03:00
common.mk ICU support 2017-03-23 15:28:48 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00