Re: Introduce "log_connection_stages" setting.

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Sergey Dudoladov <sergey(dot)dudoladov(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Jacob Champion <jchampion(at)timescale(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>
Subject: Re: Introduce "log_connection_stages" setting.
Date: 2023-01-31 00:24:58
Message-ID: 20230131002457.GH22427@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for updating the patch. It's currently failing check-world, due
to a test that was added on January 23 (a9dc7f941):

http://cfbot.cputube.org/sergey-dudoladov.html
[19:15:57.101] Summary of Failures:
[19:15:57.101] [19:15:57.101] 250/251 postgresql:ldap / ldap/002_bindpasswd ERROR 1.38s

2023-01-30 19:15:52.427 GMT [56038] LOG: unrecognized configuration parameter "log_connections" in file "/tmp/cirrus-ci-build/build/testrun/ldap/002_bindpasswd/data/t_002_bindpasswd_node_data/pgdata/postgresql.conf" line 839

> + received, but no further work has been done: Postgres is about to start

say "PostgreSQL" to match the rest of the docs.

> + GUC_check_errmsg("Invalid value '%s'", stage);

This message shouldn't be uppercased.

> + GUC_check_errdetail("Valid values to use in the list are 'received', 'authenticated', 'authorized', 'disconnected', and 'all'."
> + "If 'all' is present, it must be the only value in the list.");

Maybe "all" should be first ?

There's no spaces before "If":

| 2023-01-31 00:17:48.906 GMT [5676] DETALLE: Valid values to use in the list are 'received', 'authenticated', 'authorized', 'disconnected', and 'all'.If 'all' is present, it must be the only value in the list.

> +/* flags for logging information about session state */
> +int Log_connection_messages = LOG_CONNECTION_ALL;

The initial value here is overwritten by the GUC default during startup.
For consistency, the integer should be initialized to 0.

> +extern PGDLLIMPORT int Log_connection_messages;
> +
> +/* Bitmap for logging connection messages */
> +#define LOG_CONNECTION_RECEIVED 1
> +#define LOG_CONNECTION_AUTHENTICATED 2
> +#define LOG_CONNECTION_AUTHORIZED 4
> +#define LOG_CONNECTION_DISCONNECTED 8
> +#define LOG_CONNECTION_ALL 15

Maybe the integers should be written like (1<<0)..
And maybe ALL should be 0xffff ?

More nitpicks:

> + Causes stages of each attempted connection to the server to be logged. Example: <literal>authorized,disconnected</literal>.

"Causes the specified stages of each connection attempt .."

> + The default is the empty string meaning nothing is logged.

".. string, which means that nothing is logged"

> + <entry>Logs the original identity that an authentication method employs
> + to identify a user. In most cases, the identity string matches the

".. original identity used by an authentication method ..'

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robins Tharakan 2023-01-31 00:34:58 Re: postgres_fdw uninterruptible during connection establishment / ProcSignalBarrier
Previous Message Peter Smith 2023-01-31 00:22:57 Re: Perform streaming logical transactions by background workers and parallel apply