Avoid unnecessary ReplicationSlotControl lwlock acquistion

From: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid unnecessary ReplicationSlotControl lwlock acquistion
Date: 2020-08-25 02:38:39
Message-ID: CA+fd4k4v6t-8VYsz-U3XSCOjPDhDg67eNk33+ZAf53n9bmNo=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

While testing with DTrace, I realized we acquire
ReplicationSlotControl lwlock at some places even when
max_replication_slots is set to 0. For instance, we call
ReplicationSlotCleanup() within PostgresMian() when an error happens
and acquire ReplicationSlotControl lwlock.

The attached patch fixes some functions so that we quickly return if
max_replication_slots is set to 0.

Regards,

--
Masahiko Sawada http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
avoid_replicationslotcontrol.patch application/octet-stream 859 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-08-25 02:39:44 Re: Creating a function for exposing memory usage of backend process
Previous Message Peter Geoghegan 2020-08-25 02:17:16 Re: Problems with the FSM, heap fillfactor, and temporal locality