Re: Parallel safety of binary_upgrade_create_empty_extension

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel safety of binary_upgrade_create_empty_extension
Date: 2018-03-27 02:30:21
Message-ID: CAEepm=2p-y7dQuZJSrBQB-HgcQJYzd=5nyWC0h00JDfm1FEmJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 27, 2018 at 12:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Querying for other functions marked 'r' leaves me with some other related
> doubts:
>
> 1. Why are the various flavors of pg_get_viewdef() marked 'r'? Surely
> reading the catalogs is a thing parallel children are allowed to do.
> If there is a good reason for pg_get_viewdef() to be 'r', why doesn't
> the same reason apply to all the other ruleutils functions?
>
> 2. Why are the various thingy-to-xml functions marked 'r'? Again it
> can't be because they read catalogs or data. I can imagine that the
> reason for restricting cursor_to_xml is that the cursor might execute
> parallel-unsafe operations, but then why isn't it marked 'u'?
>
> 3. Isn't pg_import_system_collations() unsafe, for the same reason
> as binary_upgrade_create_empty_extension()?

Yeah. I hacked something up in Python to analyse the C call graph and
look for non-PARALLEL SAFE functions written in C that can reach
AssignTransactionId. Attached, for interest. Not a great approach
because current_schema, fetch_search_path, SPI_XXX and a couple of
others all lead there creating many possibly false positives (though
who knows). If I filter those out I'm left with the ones already
mentioned (pg_import_system_collations,
binary_upgrade_create_empty_extension) plus two others:

1. unique_key_recheck, not user callable anyway.
2. brin_summarize_range is marked 's'. Seems wrong.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
find_unsafe_parallel_functions.py text/x-python-script 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-03-27 02:39:02 Re: Parallel safety of binary_upgrade_create_empty_extension
Previous Message Mark Wong 2018-03-27 02:22:22 Re: ppc64le support in 9.3 branch?