Re: ps command does not show walsender's connected db

From: bt22nakamorit <bt22nakamorit(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ps command does not show walsender's connected db
Date: 2022-10-10 02:30:03
Message-ID: 83fa58f8f16ee6157d1120a06551d4bb@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2022-10-09 18:30 Bharath Rupireddy wrote:
> - if (!am_walsender)
> + if (!am_walsender || am_db_walsender)
> appendStringInfo(&ps_data, "%s ", port->database_name);
>
> Can the appendStringInfo be just unconditional? That is more readable
> IMO. We want the database_name to be appended whenever it isn't null.
I agree that the patch makes the code less neat.

> The only case we expect database_name to be null is for walsenders
> serving streaming replication standbys and even when database_name is
> null, nothing gets appended, it's just the appendStringInfo() call
> gets wasted, but that's okay.
appendStringInfo will append extra space after null (since "%s "), so
the ps entry will look less neat in that case.
How about we check whether port->database_name is null or not, instead
of making it unconditional?
It will look like this.
- if (!am_walsender)
+ if (port->database_name != NULL)
appendStringInfo(&ps_data, "%s ", port->database_name);

Thank you for your response,
Tatsuhiro Nakamori

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2022-10-10 02:35:04 Unnecessary lateral dependencies implied by PHVs
Previous Message Andy Fan 2022-10-10 00:40:34 Re: Unify "In" Sublink to EXIST Sublink for better optimize opportunity