Re: rename pg_log_standby_snapshot

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rename pg_log_standby_snapshot
Date: 2025-04-04 16:55:41
Message-ID: CAA5RZ0vqfN3f7n2ga4WVofWmXy_GX-UxkPu99cbQ6iHMXQJzvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > Should the pg_log_ prefix strictly refer to functions that write to
> > > logs?
> > >
> >
> > I don't know how strict we should be about this,
>
> I don't know as well and specially given that:
>
> - the snapshot is logged to the log file (if log level <= DEBUG2)

But unlike pg_log_backend_memory_contexts, the primary purpose
of this function is not to write at the LOG message level.

> - that name also makes sense from an API point of view as it calls "LogStandbySnapshot"

I don't really see the correlation between the user facing pg_log_
prefix and the Log prefixed
functions that write to wal.

But this goes back to the main point of should pg_log_ be specific to
functions that
write to the server logs only. I am making the argument that we
should. We have a precedent
with pg_stat_ being the prefix for any function related to the cumulative stats.

I think it keeps things nicely organized and just overall good code
hygiene, but also not sure
how we can even enforce such naming conventions.

> > The other option could be pg_create_standby_snapshot(), which would be
> > similar to the existing function pg_create_restore_point(). I think we
> > need to think about backward compatibility if we agree with moving in
> > this direction.
>
> +1

This is slightly better. pg_create_restore_point also writes to wal and _create_
has a more generic meaning.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Jackson 2025-04-04 16:55:42 Re: Update LDAP Protocol in fe-connect.c to v3
Previous Message Masahiko Sawada 2025-04-04 16:39:25 Re: Restrict copying of invalidated replication slots