Re: Suggestion to add --continue-client-on-abort option to pgbench - Mailing list pgsql-hackers

From Rintaro Ikeda
Subject Re: Suggestion to add --continue-client-on-abort option to pgbench
Date
Msg-id e71bdb62-d53e-4c55-8a41-f3a2624f687b@oss.nttdata.com
Whole thread Raw
In response to Re: Suggestion to add --continue-client-on-abort option to pgbench  (Yugo Nagata <nagata@sraoss.co.jp>)
Responses Re: Suggestion to add --continue-client-on-abort option to pgbench
List pgsql-hackers
Hi,

On 2025/07/15 11:16, Yugo Nagata wrote:
>> I noticed one small thing I’d like to discuss. I'm not sure that users clearly
>> understand which aborted in the following error message, the client or the script.
>>> pgbench: error: client 0 script 0 aborted in command ... query ...
>>
>> Since the code path always results in a client abort, I wonder if the following
>> message might be clearer:
>>> pgbench: error: client 0 aborted in script 0 command ... query ...
> 
> Indeed, it seems clearer to explicitly state that it is the client that
> was aborted.
> 
> I've attached an updated patch that replaces the remaining message mentioned
> above with a call to commandFailed(). With this change, the output in such
> situations will now be:
> 
>  "client 0 aborted in command 0 (SQL) of script 0; ...."

Thank you for updating the patch!

When I executed a custom script that may raise a unique constraint violation, I
got the following output:
> pgbench: error: client 0 script 0 aborted in command 1 query 0: ERROR:
duplicate key value violates unique constraint "test_col2_key"

I think we should also change the error message in pg_log_error. I modified the
patch v8-0003 as follows:
@@ -3383,8 +3383,8 @@ readCommandResponse(CState *st, MetaCommand meta, char
*varprefix)

                        default:
                                /* anything else is unexpected */
-                               pg_log_error("client %d script %d aborted in
command %d query %d: %s",
-                                                        st->id, st->use_file,
st->command, qrynum,
+                               pg_log_error("client %d aborted in command %d
query %d of script %d: %s",
+                                                        st->id, st->command,
qrynum, st->use_file,
                                                         PQerrorMessage(st->con));
                                goto error;
                }

With this change, the output now is like this:
> pgbench: error: client 0 aborted in command 1 query 0 of script 0: ERROR:
duplicate key value violates unique constraint "test_col2_key"

I want hear your thoughts.


Also, let me ask one question. In this case, I directly modified your commit in
the v8-0003 patch. Is that the right way to update the patch?

Regards,
Rintaro Ikeda
Attachment

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Question on any plans to use the Create Server/Create blink_ Mapping to provide Logical Replication Subscriptions the user/password in an encrypted manner
Next
From: Andrei Lepikhov
Date:
Subject: Re: track generic and custom plans in pg_stat_statements