8000 Update with upstream by Algunenano · Pull Request #31 · CartoDB/postgres · GitHub
[go: up one dir, main page]

Skip to content

Update with upstream #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 101 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
5f2cfe7
docs: clarify that only INSERT and UPDATE triggers can mod. NEW
bmomjian Nov 13, 2019
1cd57b0
Handle arrays and ranges in pg_upgrade's test for non-upgradable types.
tglsfdc Nov 13, 2019
eec569f
Include TableFunc references when computing expression dependencies.
tglsfdc Nov 13, 2019
d980259
Avoid downcasing/truncation of RADIUS authentication parameters.
tglsfdc Nov 13, 2019
99cc47b
Fix silly initializations (cosmetic only).
tglsfdc Nov 13, 2019
5a6eea0
Add missing check_collation_set call to bpcharne().
tglsfdc Nov 13, 2019
d61e7f1
Doc: in v12 release notes, explain how to replace uses of consrc and …
tglsfdc Nov 15, 2019
24897e1
Always call ExecShutdownNode() if appropriate.
macdice Nov 15, 2019
28555a5
Skip system attributes when applying mvdistinct stats
tvondra Nov 16, 2019
bbaa38e
Improve stability of tests for VACUUM (SKIP_LOCKED)
michaelpq Nov 16, 2019
fcaf29d
Further fix dumping of views that contain just VALUES(...).
tglsfdc Nov 17, 2019
93b2bbe
Doc: clarify behavior of ALTER DEFAULT PRIVILEGES ... IN SCHEMA.
tglsfdc Nov 19, 2019
823a551
Doc: clarify use of RECURSIVE in WITH.
tglsfdc Nov 19, 2019
051c50c
Fix deadlock between ginDeletePage() and ginStepRight()
akorotkov Nov 19, 2019
ee437ca
Fix traversing to the deleted GIN page via downlink
akorotkov Nov 19, 2019
ca05fa5
Revise GIN README
akorotkov Nov 19, 2019
a64e7e0
Fix page modification outside of critical section in GIN
akorotkov Nov 19, 2019
bffe18e
Fix corner-case failure in match_pattern_prefix().
tglsfdc Nov 19, 2019
1350266
Doc: fix minor typo in func.sgml.
tatsuo-ishii Nov 20, 2019
2189f49
Handle ReadFile() EOF correctly on Windows.
macdice Nov 20, 2019
2c9772f
Remove incorrect markup
mhagander Nov 20, 2019
c644407
Provide statistics for hypothetical BRIN indexes
michaelpq Nov 21, 2019
5186f76
Defend against self-referential views in relation_is_updatable().
tglsfdc Nov 21, 2019
a2aa224
Fix bogus tuple-slot management in logical replication UPDATE handling.
tglsfdc Nov 22, 2019
8047a7b
Add test coverage for "unchanged toast column" replication code path.
tglsfdc Nov 22, 2019
7d4c311
Improve test coverage for LISTEN/NOTIFY.
tglsfdc Nov 23, 2019
c47f498
Stabilize NOTIFY behavior by transmitting notifies before ReadyForQuery.
tglsfdc Nov 24, 2019
ec9f6be
doc: Fix whitespace in syntax.
macdice Nov 24, 2019
a24a416
Avoid assertion failure with LISTEN in a serializable transaction.
tglsfdc Nov 24, 2019
1cc3a90
Don't shut down Gather[Merge] early under Limit.
Nov 18, 2019
21a4edd
Allow access to child table statistics if user can read parent table.
tglsfdc Nov 26, 2019
bf3cef2
Fix typo in comment.
Nov 27, 2019
ef3fed2
Fix choose_best_statistics to check clauses individually
tvondra Nov 28, 2019
79d6e6a
Remove unnecessary clauses_attnums variable
tvondra Nov 28, 2019
0dafed6
Fix off-by-one error in PGTYPEStimestamp_fmt_asc
tvondra Nov 30, 2019
b154d70
Fix misbehavior with expression indexes on ON COMMIT DELETE ROWS tables.
tglsfdc Dec 1, 2019
ef30975
Fix failures with TAP tests of pg_ctl on Windows
michaelpq Dec 3, 2019
a8a8c6b
Ensure maxlen is at leat 1 in dict_int
tvondra Dec 3, 2019
0e5baa0
Fix whitespace.
Dec 4, 2019
902276f
Fix handling of OpenSSL's SSL_clear_options
michaelpq Dec 6, 2019
ba62bb6
Doc: improve documentation about run-time pruning's effects on EXPLAIN.
tglsfdc Dec 8, 2019
cc4371d
Document search_path security with untrusted dbowner or CREATEROLE.
nmisch Dec 8, 2019
a7472d2
Fix typos in miscinit.c.
Dec 9, 2019
eadfafd
Improve isolationtester's timeout management.
tglsfdc Dec 9, 2019
001362c
Fix race condition in our Windows signal emulation.
tglsfdc Dec 9, 2019
547e454
Fix handling of multiple AFTER ROW triggers on a foreign table.
Dec 10, 2019
be9d4b9
In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log …
tglsfdc Dec 10, 2019
6a9b5a2
Remove extra parenthesis from comment.
Dec 12, 2019
7335563
Remove redundant function calls in timestamp[tz]_part().
tglsfdc Dec 12, 2019
07c4b6a
Fix EXTRACT(ISOYEAR FROM timestamp) for years BC.
tglsfdc Dec 12, 2019
70c4f50
Fix crash when a page was split during GiST index creation.
hlinnaka Dec 13, 2019
c3dc0cd
Don't use _mdfd_getseg() in mdsyncfiletag().
macdice Dec 14, 2019
fd005e1
Fix mdsyncfiletag(), take II.
macdice Dec 14, 2019
d04e255
Prevent overly-aggressive collapsing of joins to RTE_RESULT relations.
tglsfdc Dec 14, 2019
e3ac893
Clean up some misplaced comments in partition_join.sql regression test.
Dec 16, 2019
42d1acd
Fix yet another crash in page split during GiST index creation.
hlinnaka Dec 16, 2019
95f43fe
On Windows, wait a little to see if ERROR_ACCESS_DENIED goes away.
tglsfdc Dec 16, 2019
0eac283
Change overly strict Assert in TransactionGroupUpdateXidStatus.
Dec 12, 2019
97ba30f
Fix error reporting for index expressions of prohibited types.
tglsfdc Dec 17, 2019
35c0152
Remove shadow variables linked to RedoRecPtr in xlog.c
michaelpq Dec 18, 2019
8000
c74111d
Fix subscriber invalid memory access on DDL.
Dec 16, 2019
a9f304f
Update neglected comment.
robertmhaas Dec 19, 2019
e5a37d9
Doc: add a short summary of available authentication methods.
tglsfdc Dec 19, 2019
e8f60e6
libpq should expose GSS-related parameters even when not implemented.
tglsfdc Dec 20, 2019
96aa9b6
docs: clarify handling of column lists in COPY TO/FROM
bmomjian Dec 21, 2019
90281a3
In pgwin32_open, loop after ERROR_ACCESS_DENIED only if we can't stat.
tglsfdc Dec 21, 2019
e1c056c
Avoid low-probability regression test failures in timestamp[tz] tests.
tglsfdc Dec 22, 2019
976cb11
Prevent a rowtype from being included in itself via a range.
tglsfdc Dec 23, 2019
7fbb39a
Disallow partition key expressions that return pseudo-types.
tglsfdc Dec 23, 2019
b5e7569
Disallow null category in crosstab_hash
jconway Dec 23, 2019
8052aaf
Rotate instead of shifting hash join batch number.
macdice Dec 23, 2019
50fa688
Fix some comments related to logical repslot advancing
michaelpq Dec 26, 2019
883c27a
Fix possible loss of sync between rectypeid and underlying PLpgSQL_type.
tglsfdc Dec 26, 2019
1dd8820
Forbid DROP SCHEMA on temporary namespaces
michaelpq Dec 27, 2019
5d72f85
docs: clarify infinite range values from data-type infinities
bmomjian Dec 27, 2019
2034bcc
doc: add examples of creative use of unique expression indexes
bmomjian Dec 27, 2019
b4507a2
Add pg_dump test for triggers on partitioned tables
alvherre Dec 27, 2019
8f3e44a
Update copyrights for 2020
bmomjian Jan 1, 2020
f8a6d8e
Fix running out of file descriptors for spill files.
Jan 2, 2020
98b75c3
Fix comment in test
petere Jan 2, 2020
d732148
Fix cloning of row triggers to sub-partitions
alvherre Jan 2, 2020
0c8836a
Fix typos in parallel query docs.
Jan 3, 2020
6c1860b
Docs: use more standard terminology "round-to-nearest-even" instead o…
tatsuo-ishii Jan 5, 2020
8c2bfd9
Have logical replication subscriber fire column triggers
petere Jan 6, 2020
b898452
Reduce the number of GetFlushRecPtr() calls done by walsenders.
tglsfdc Jan 6, 2020
fce9ba8
pg_stat_activity: show NULL stmt start time for walsenders
alvherre Jan 7, 2020
a1c003e
Revert "Forbid DROP SCHEMA on temporary namespaces"
michaelpq Jan 8, 2020
c24f3b7
Fix handling of generated columns in ALTER TABLE.
tglsfdc Jan 8, 2020
20c4df8
Reimplement nullification of walsender timestamp
alvherre Jan 8, 2020
e05a3b4
doc: Add link to upgrading chapter to release notes
petere Jan 9, 2020
2e89a12
doc: Fix naming of SELinux
michaelpq Jan 10, 2020
93078e6
Maintain valid md.c state when FileClose() fails.
nmisch Jan 11, 2020
fde1554
Extensive code review for GSSAPI encryption mechanism.
tglsfdc Jan 11, 2020
7c21a96
Remove incorrect assertion for INSERT in logical replication's publisher
michaelpq Jan 12, 2020
70c17a8
Fix edge-case crashes and misestimation in range containment selectiv…
tglsfdc Jan 12, 2020
52bc730
Fix typo.
Jan 13, 2020
bf65f3c
Fix base backup with database OIDs larger than INT32_MAX
petere Jan 13, 2020
fa1eaeb
Revert test added by commit d207038053.
Jan 11, 2020
fd5476b
Make rewriter prevent auto-updates on views with conditional INSTEAD …
deanrasheed Jan 14, 2020
518bfa4
Merge remote-tracking branch 'blessed/REL_12_STABLE' into REL_12_CARTO
Algunenano Jan 14, 2020
53f39a6
Update changelog
Algunenano Jan 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid assertion failure with LISTEN in a serializable transaction.
If LISTEN is the only action in a serializable-mode transaction,
and the session was not previously listening, and the notify queue
is not empty, predicate.c reported an assertion failure.  That
happened because we'd acquire the transaction's initial snapshot
during PreCommit_Notify, which was called *after* predicate.c
expects any such snapshot to have been established.

To fix, just swap the order of the PreCommit_Notify and
PreCommit_CheckForSerializationFailure calls during CommitTransaction.
This will imply holding the notify-insertion lock slightly longer,
but the difference could only be meaningful in serializable mode,
which is an expensive option anyway.

It appears that this is just an assertion failure, with no
consequences in non-assert builds.  A snapshot used only to scan
the notify queue could not have been involved in any serialization
conflicts, so there would be nothing for
PreCommit_CheckForSerializationFailure to do except assign it a
prepareSeqNo and set the SXACT_FLAG_PREPARED flag.  And given no
conflicts, neither of those omissions affect the behavior of
ReleasePredicateLocks.  This admittedly once-over-lightly analysis
is backed up by the lack of field reports of trouble.

Per report from Mark Dilger.  The bug is old, so back-patch to all
supported branches; but the new test case only goes back to 9.6,
for lack of adequate isolationtester infrastructure before that.

Discussion: https://postgr.es/m/3ac7f397-4d5f-be8e-f354-440020675694@gmail.com
Discussion: https://postgr.es/m/13881.1574557302@sss.pgh.pa.us
  • Loading branch information
tglsfdc committed Nov 24, 2019
commit a24a4167aa3889d26c425d38a8c67cc39df35fbd
19 changes: 10 additions & 9 deletions src/backend/access/transam/xact.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,14 @@ CommitTransaction(void)
/* close large objects before lower-level cleanup */
AtEOXact_LargeObject(true);

/*
* Insert notifications sent by NOTIFY commands into the queue. This
* should be late in the pre-commit sequence to minimize time spent
* holding the notify-insertion lock. However, this could result in
* creating a snapshot, so we must do it before serializable cleanup.
*/
PreCommit_Notify();

/*
* Mark serializable transaction as complete for predicate locking
* purposes. This should be done as late as we can put it and still allow
Expand All @@ -2120,13 +2128,6 @@ CommitTransaction(void)
if (!is_parallel_worker)
PreCommit_CheckForSerializationFailure();

/*
* Insert notifications sent by NOTIFY commands into the queue. This
* should be late in the pre-commit sequence to minimize time spent
* holding the notify-insertion lock.
*/
PreCommit_Notify();

/* Prevent cancel/die interrupt while cleaning up */
HOLD_INTERRUPTS();

Expand Down Expand Up @@ -2342,15 +2343,15 @@ PrepareTransaction(void)
/* close large objects before lower-level cleanup */
AtEOXact_LargeObject(true);

/* NOTIFY requires no work at this point */

/*
* Mark serializable transaction as 8000 complete for predicate locking
* purposes. This should be done as late as we can put it and still allow
* errors to be raised for failure patterns found at commit.
*/
PreCommit_CheckForSerializationFailure();

/* NOTIFY will be handled below */

/*
* Don't allow PREPARE TRANSACTION if we've accessed a temporary table in
* this transaction. Having the prepared xact hold locks on another
Expand Down
13 changes: 12 additions & 1 deletion src/test/isolation/expected/async-notify.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Parsed test spec with 2 sessions
Parsed test spec with 3 sessions

starting permutation: listenc notify1 notify2 notify3 notifyf
step listenc: LISTEN c1; LISTEN c2;
Expand Down Expand Up @@ -85,6 +85,17 @@ listener: NOTIFY "c1" with payload "" from notifier
listener: NOTIFY "c2" with payload "payload" from notifier
listener: NOTIFY "c2" with payload "" from notifier

starting permutation: l2listen l2begin notify1 lbegins llisten lcommit l2commit l2stop
step l2listen: LISTEN c1;
step l2begin: BEGIN;
step notify1: NOTIFY c1;
step lbegins: BEGIN ISOLATION LEVEL SERIALIZABLE;
step llisten: LISTEN c1; LISTEN c2;
step lcommit: COMMIT;
step l2commit: COMMIT;
listener2: NOTIFY "c1" with payload "" from notifier
step l2stop: UNLISTEN *;

starting permutation: llisten lbegin usage bignotify usage
step llisten: LISTEN c1; LISTEN c2;
step lbegin: BEGIN;
Expand Down
14 changes: 14 additions & 0 deletions src/test/isolation/specs/async-notify.spec

Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ session "listener"
step "llisten" { LISTEN c1; LISTEN c2; }
step "lcheck" { SELECT 1 AS x; }
step "lbegin" { BEGIN; }
step "lbegins" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "lcommit" { COMMIT; }
teardown { UNLISTEN *; }

# In some tests we need a second listener, just to block the queue.

session "listener2"
step "l2listen" { LISTEN c1; }
step "l2begin" { BEGIN; }
step "l2commit" { COMMIT; }
step "l2stop" { UNLISTEN *; }

# Trivial cases.
permutation "listenc" "notify1" "notify2" "notify3" "notifyf"
Expand All @@ -59,6 +69,10 @@ permutation "llisten" "notify1" "notify2" "notify3" "notifyf" "lcheck"
# Again, with local delivery too.
permutation "listenc" "llisten" "notify1" "notify2" "notify3" "notifyf" "lcheck"

# Check for bug when initial listen is only action in a serializable xact,
# and notify queue is not empty
permutation "l2listen" "l2begin" "notify1" "lbegins" "llisten" "lcommit" "l2commit" "l2stop"

# Verify that pg_notification_queue_usage correctly reports a non-zero result,
# after submitting notifications while another connection is listening for
# those notifications and waiting inside an active transaction. We have to
Expand Down
0