| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart |
| Date: | 2025-11-12 02:06:10 |
| Message-ID: | CAD21AoDVj_71hrVXKQ5CTU-NKW_6_YpR85RbWxWK3wy4bsQcuA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Nov 9, 2025 at 8:51 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Sawada-San.
>
> Some review comments for v24-0001.
>
> ======
> src/backend/replication/slot.c
>
> ReplicationSlotsDropDBSlots:
>
> 1.
> LWLockAcquire(ReplicationSlotControlLock, LW_SHARED);
> for (i = 0; i < max_replication_slots; i++)
> {
> ReplicationSlot *s;
> + bool invalidated;
> char *slotname;
> int active_pid;
>
> @@ -1462,11 +1494,22 @@ restart:
> if (!SlotIsLogical(s))
> continue;
>
> + SpinLockAcquire(&s->mutex);
> + invalidated = s->data.invalidated == RS_INVAL_NONE;
> + SpinLockRelease(&s->mutex);
> +
> + /*
> + * Count slots on other databases too so we can disable logical
> + * decoding only if no slots in the cluster.
> + */
> + if (invalidated)
> + n_valid_logicalslots++;
> +
>
> IMO it's misleading/backwards to have bool invalidated == true when
> the invalidated member is RS_INVAL_NONE.
>
> It's fine to rename the bool var as 'invalidated', but don't you also
> need to reverse the assignment to (s->data.invalidated !=
> RS_INVAL_NONE) instead of (s->data.invalidated == RS_INVAL_NONE)?
Thank you for the comment! I'll fix it in the next version patch.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xuneng Zhou | 2025-11-12 02:14:16 | Re: Add tests for object size limits of injection points |
| Previous Message | Masahiko Sawada | 2025-11-12 02:05:41 | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart |