From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Petr Jelinek <pjmodos(at)pjmodos(dot)net>, Euler Taveira <euler(at)eulerto(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pg_replication_origin_drop API potential race condition |
Date: | 2021-02-09 10:46:37 |
Message-ID: | 20210209104637.GA29929@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2021-Feb-09, Amit Kapila wrote:
> > IIUC, you are suggesting to use lock for the particular origin instead
> > of locking the corresponding catalog table in functions
> > pg_replication_origin_advance and replorigin_drop_by_name.
Right.
> I think it won't be that straightforward as we don't have origin_id.
> So what we instead need to do is first to acquire a lock on
> ReplicationOriginRelationId, get the origin_id, lock the specific
> origin and then re-check if the origin still exists. I feel some
> similar changes might be required in pg_replication_origin_advance.
Hmm, ok.
> Now, we can do this optimization if we want but I am not sure if
> origin_drop would be a frequent enough operation that we add such an
> optimization. For now, I have added a note in the comments so that if
> we find any such use case we can implement such optimization in the
> future. What do you think?
By all means let's get the bug fixed. Then, in another patch, we can
optimize further, if there really is a problem.
--
Álvaro Herrera 39°49'30"S 73°17'W
"Siempre hay que alimentar a los dioses, aunque la tierra esté seca" (Orual)
From | Date | Subject | |
---|---|---|---|
Next Message | 'Alvaro Herrera' | 2021-02-09 10:47:43 | Re: libpq debug log |
Previous Message | Fujii Masao | 2021-02-09 10:11:35 | Re: adding wait_start column to pg_locks |