Re: parallel restore sometimes fails for FKs to partitioned tables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: parallel restore sometimes fails for FKs to partitioned tables
Date: 2019-10-17 08:14:25
Message-ID: 20191017081425.GA18878@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Oct-05, Alvaro Herrera wrote:

> While playing around I noticed that depending on the number of parallel
> workers in pg_restore compared to the number of partitions a table has,
> restoring an FK fails because the FK itself is restored before the index
> partitions have completed restoring. The exact conditions to cause the
> failure seem to vary depending on whether the dump is schema-only or not.
>
> This can seemingly be fixed by having pg_dump make the constraint depend
> on the attach of each partition, as in the attached patch. With this
> patch I no longer see failures.

Pushed with some additional tweaks.

Parallel restore of partitioned tables containing data and unique keys
still fails with some deadlock errors, though :-(

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-10-17 08:15:39 Re: Remaining calls of heap_close/heap_open in the tree
Previous Message Andres Freund 2019-10-17 08:04:50 Re: Remaining calls of heap_close/heap_open in the tree