Re: subscription/015_stream sometimes breaks

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: subscription/015_stream sometimes breaks
Date: 2023-08-24 03:45:36
Message-ID: CAA4eK1KEYtgC3mB683iEq-CQUUSA8=3ZRYB9ZMbWHaU8hey2uA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 23, 2023 at 1:31 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2023-Aug-23, Zhijie Hou (Fujitsu) wrote:
>
> > [1]--
> > LWLockAcquire(LogicalRepWorkerLock, LW_SHARED);
> >
> > workers = logicalrep_workers_find(MyLogicalRepWorker->subid, true);
> > foreach(lc, workers)
> > {
> > LogicalRepWorker *w = (LogicalRepWorker *) lfirst(lc);
> >
> > ** if (isParallelApplyWorker(w))
> > logicalrep_worker_stop_internal(w, SIGTERM);
> > }
>
> Hmm, I think if worker->in_use is false, we shouldn't consult the rest
> of the struct at all, so I propose to add the attached 0001 as a minimal
> fix.
>

I think that way we may need to add the check for in_use before
accessing each of the LogicalRepWorker struct fields or form some rule
about which fields (or places) are okay to access without checking
in_use field.

> In fact, I'd go further and propose that if we do take that stance, then
> we don't need clear out the contents of this struct at all, so let's
> not. That's 0002.
>
> And the reason 0002 does not remove the zeroing of ->proc is that the
> tests gets stuck when I do that, and the reason for that looks to be
> some shoddy coding in WaitForReplicationWorkerAttach, so I propose we
> change that too, as in 0003.
>

Personally, I think we should consider this change (0002 and 0002) separately.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vaibhav Dalvi 2023-08-24 04:06:12 Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Previous Message Peter Smith 2023-08-24 03:24:04 Re: [PoC] pg_upgrade: allow to upgrade publisher node