pgsql: Update the names of Parallel Hash Join phases.

2021-03-16 Thread Thomas Munro
Update the names of Parallel Hash Join phases. Commit 3048898e dropped -ING from some wait event names that correspond to barrier phases. Update the phases' names to match. While we're here making cosmetic changes, also rename "DONE" to "FREE". That pairs better with "ALLOCATE", and describes th

pgsql: Fix race in Parallel Hash Join batch cleanup.

2021-03-16 Thread Thomas Munro
Fix race in Parallel Hash Join batch cleanup. With very unlucky timing and parallel_leader_participation off, PHJ could attempt to access per-batch state just as it was being freed. There was code intended to prevent that by checking for a cleared pointer, but it was buggy. Fix, by introducing an

pgsql: Fix race in Parallel Hash Join batch cleanup.

2021-03-16 Thread Thomas Munro
Fix race in Parallel Hash Join batch cleanup. With very unlucky timing and parallel_leader_participation off, PHJ could attempt to access per-batch state just as it was being freed. There was code intended to prevent that by checking for a cleared pointer, but it was buggy. Fix, by introducing an

pgsql: Fix race in Parallel Hash Join batch cleanup.

2021-03-16 Thread Thomas Munro
Fix race in Parallel Hash Join batch cleanup. With very unlucky timing and parallel_leader_participation off, PHJ could attempt to access per-batch state just as it was being freed. There was code intended to prevent that by checking for a cleared pointer, but it was buggy. Fix, by introducing an

pgsql: Fix race in Parallel Hash Join batch cleanup.

2021-03-16 Thread Thomas Munro
Fix race in Parallel Hash Join batch cleanup. With very unlucky timing and parallel_leader_participation off, PHJ could attempt to access per-batch state just as it was being freed. There was code intended to prevent that by checking for a cleared pointer, but it was buggy. Fix, by introducing an

pgsql: Fix transaction.sql tests in higher isolation levels.

2021-03-16 Thread Thomas Munro
Fix transaction.sql tests in higher isolation levels. It seems like a useful sanity check to be able to run "installcheck" against a cluster running with default_transaction_level set to serializable or repeatable read. Only one thing currently fails in those configurations, so let's fix that. N

pgsql: Fix race condition in drop subscription's handling of tablesync

2021-03-16 Thread Amit Kapila
Fix race condition in drop subscription's handling of tablesync slots. Commit ce0fdbfe97 made tablesync slots permanent and allow Drop Subscription to drop such slots. However, it is possible that before tablesync worker could get the acknowledgment of slot creation, drop subscription stops it and

pgsql: Doc: Add a description of substream in pg_subscription.

2021-03-16 Thread Amit Kapila
Doc: Add a description of substream in pg_subscription. Commit 464824323e added a new column substream in pg_subscription but forgot to update the docs. Reported-by: Peter Smith Author: Amit Kapila Reviewed-by: Peter Smith Discussion: https://postgr.es/m/CAHut+PuPGGASnh2Dy37VYODKULVQo-5oE=Shc6gw

pgsql: Enable parallelism in REFRESH MATERIALIZED VIEW.

2021-03-16 Thread Thomas Munro
Enable parallelism in REFRESH MATERIALIZED VIEW. Pass CURSOR_OPT_PARALLEL_OK to pg_plan_query() so that parallel plans are considered when running the underlying SELECT query. This wasn't done in commit e9baa5e9, which did this for CREATE MATERIALIZED VIEW, because it wasn't yet known to be safe.

pgsql: Fix comment about promising tuples.

2021-03-16 Thread Peter Geoghegan
Fix comment about promising tuples. Oversight in commit d168b666823, which added bottom-up index deletion. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fbe4cb3bd49f9e524f53ef77c775c1bad4d0312a Modified Files -- src/backend/access/heap/heapam.c | 6 ++

pgsql: amcheck: Reduce debug message verbosity.

2021-03-16 Thread Peter Geoghegan
amcheck: Reduce debug message verbosity. Empty sibling pages can occasionally be much more common than any other event that we report on at elevel DEBUG1. Increase the elevel for relevant cases to DEBUG2 to avoid overwhelming the user with relatively insignificant details. Branch -- master

pgsql: Avoid corner-case memory leak in SSL parameter processing.

2021-03-16 Thread Tom Lane
Avoid corner-case memory leak in SSL parameter processing. After reading the root cert list from the ssl_ca_file, immediately install it as client CA list of the new SSL context. That gives the SSL context ownership of the list, so that SSL_CTX_free will free it. This avoids a permanent memory le

pgsql: Avoid corner-case memory leak in SSL parameter processing.

2021-03-16 Thread Tom Lane
Avoid corner-case memory leak in SSL parameter processing. After reading the root cert list from the ssl_ca_file, immediately install it as client CA list of the new SSL context. That gives the SSL context ownership of the list, so that SSL_CTX_free will free it. This avoids a permanent memory le

pgsql: Avoid corner-case memory leak in SSL parameter processing.

2021-03-16 Thread Tom Lane
Avoid corner-case memory leak in SSL parameter processing. After reading the root cert list from the ssl_ca_file, immediately install it as client CA list of the new SSL context. That gives the SSL context ownership of the list, so that SSL_CTX_free will free it. This avoids a permanent memory le

pgsql: Avoid corner-case memory leak in SSL parameter processing.

2021-03-16 Thread Tom Lane
Avoid corner-case memory leak in SSL parameter processing. After reading the root cert list from the ssl_ca_file, immediately install it as client CA list of the new SSL context. That gives the SSL context ownership of the list, so that SSL_CTX_free will free it. This avoids a permanent memory le

pgsql: Avoid corner-case memory leak in SSL parameter processing.

2021-03-16 Thread Tom Lane
Avoid corner-case memory leak in SSL parameter processing. After reading the root cert list from the ssl_ca_file, immediately install it as client CA list of the new SSL context. That gives the SSL context ownership of the list, so that SSL_CTX_free will free it. This avoids a permanent memory le

pgsql: Fix a confusing amcheck corruption message.

2021-03-16 Thread Robert Haas
Fix a confusing amcheck corruption message. Don't complain about the last TOAST chunk number being different from what we expected if there are no TOAST chunks at all. In such a case, saying that the final chunk number is 0 is not really accurate, and the fact the value is missing from the TOAST t

pgsql: Use pre-fetching for ANALYZE

2021-03-16 Thread Stephen Frost
Use pre-fetching for ANALYZE When we have posix_fadvise() available, we can improve the performance of an ANALYZE by quite a bit by using it to inform the kernel of the blocks that we're going to be asking for. Similar to bitmap index scans, the number of buffers pre-fetched is based off of the m

pgsql: Improve logging of auto-vacuum and auto-analyze

2021-03-16 Thread Stephen Frost
Improve logging of auto-vacuum and auto-analyze When logging auto-vacuum and auto-analyze activity, include the I/O timing if track_io_timing is enabled. Also, for auto-analyze, add the read rate and the dirty rate, similar to how that information has historically been logged for auto-vacuum. St

pgsql: Improve logging of bad parameter values in BIND messages.

2021-03-16 Thread Tom Lane
Improve logging of bad parameter values in BIND messages. Since commit ba79cb5dc, values of bind parameters have been logged during errors in extended query mode. However, we only did that after we'd collected and converted all the parameter values, thus failing to offer any useful localization o

Re: pgsql: Implement pipeline mode in libpq

2021-03-16 Thread Alvaro Herrera
On 2021-Mar-15, Tom Lane wrote: > Alvaro Herrera writes: > > Implement pipeline mode in libpq > > So jacana and fairywren are unhappy about this, and the failure reports > are totally uninformative: Yeah. This is the main clue: > Mar 15 21:14:41 # Looks like you planned 8 tests but ran 15. >

pgsql: (Blind) fix Perl splitting of strings at newlines

2021-03-16 Thread Alvaro Herrera
(Blind) fix Perl splitting of strings at newlines I forgot that Windows represents newlines as \r\n, so splitting a string at /\s/ creates additional empty strings. Let's rewrite that as /\s+/ to see if that avoids those. (There's precedent for using that pattern on Windows in other scripts.) P