Re: Question on LWLockMode in dsa.c

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, John Naylor <johncnaylorls(at)gmail(dot)com>
Subject: Re: Question on LWLockMode in dsa.c
Date: 2024-01-30 07:43:01
Message-ID: CALj2ACViPSt2N5QgP8E327CBNGSXqSCnFjOP=-Pv_pQcX+vKFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 30, 2024 at 6:24 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Hi,
>
> While working on radix tree patch[1], John Naylor found that dsa.c
> doesn't already use shared locks even in dsa_dump(). dsa_dump() seems
> a pure read-only function so I thought we could use a shared lock mode
> there. Is there any reason to use exclusive mode even in dsa_dump()?

check_for_freed_segments_locked which is called from dsa_dump does
mark a few variables of the dsa area to NULL right? Are you suggesting
to take initially a shared lock in dsa_dump and upgrade it to
exclusive mode in the unlikely event of
unlikely(area->freed_segment_counter != freed_segment_counter)
occurring in check_for_freed_segments_locked?

> Ultimately, since we're trying to add a new function
> dsa_get_total_size() that just returns
> dsa_area_control.total_segment_size and therefore would also be a
> read-only function, I'd like to find out the correct lock mode there.
>
> [1] https://www.postgresql.org/message-id/CANWCAZYYzoKp_4%2B1m5mn-TRD62BTwom8iLXLOWMsHkkwFi%3Drzg%40mail.gmail.com

Do you see any lock contention or any other issues with exclusive
locks on dsa areas?

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-01-30 07:50:02 Re: Inconsistency in reporting checkpointer stats
Previous Message Sergey Prokhorenko 2024-01-30 07:28:28 Re: UUID v7