Re: DROP TABLE can crash the replication sync worker

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: DROP TABLE can crash the replication sync worker
Date: 2021-02-03 12:49:00
Message-ID: CAA4eK1JQ9yoC8TuaTsexWreONW-UiQBhFbtsi6DJJcphpBO2Zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 3, 2021 at 2:53 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Hackers.
>
> As discovered in another thread [master] there is an *existing* bug in
> the PG HEAD code which can happen if a DROP TABLE is done at same time
> a replication tablesync worker is running.
>
> It seems the table's relid that the sync worker is using gets ripped
> out from underneath it and is invalidated by the DROP TABLE. Any
> subsequent use of that relid will go wrong.
>

Where exactly did you pause the tablesync worker while dropping the
table? We acquire the lock on the table in LogicalRepSyncTableStart
and then keep it for the entire duration of tablesync worker so drop
table shouldn't be allowed.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-02-03 12:55:19 Re: Typo in tablesync comment
Previous Message Ibrar Ahmed 2021-02-03 12:44:24 Re: Next Commitfest Manager.