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

From Srinath Reddy Sadipiralla
Subject Re: Suggestion to add --continue-client-on-abort option to pgbench
Date
Msg-id CAFC+b6oHvoQBEYCMdo6i7A=QYP+Q1r+wYe+bj4bD-KiTiEL7aw@mail.gmail.com
Whole thread Raw
In response to Re: Suggestion to add --continue-client-on-abort option to pgbench  (Dilip Kumar <dilipbalaut@gmail.com>)
List pgsql-hackers

Hi,

On Tue, May 13, 2025 at 11:27 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
On Tue, May 13, 2025 at 9:20 AM <Rintaro.Ikeda@nttdata.com> wrote:
> I also appreciate you for pointing out my mistakes in the previous version of the patch. I fixed the duplicated lines. I’ve attached the updated patch.
>
This is a useful feature, so +1 from my side.  Here are some initial
comments on the patch while having a quick look.

1. You need to update the stats for this new counter in the
"accumStats()" function.

2. IMHO, " continue-on-error " is more user-friendly than
"continue-client-on-error".

3. There are a lot of whitespace errors, so those can be fixed.  You
can just try to apply using git am, and it will report those
whitespace warnings.  And for fixing, you can just use
"--whitespace=fix" along with git am.

Hi, +1 for the idea. I’ve reviewed and tested the patch. Aside from Dilip’s feedback and the missing usage information for this option, the patch LGTM.

Here's the diff for the missing usage information for this option and as Dilip mentioned updating the new counter in the "accumStats()" function.

diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index baaf1379be2..20d456bc4b9 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -959,6 +959,8 @@ usage(void)
                   "  --log-prefix=PREFIX      prefix for transaction time log file\n"
                   "                           (default: \"pgbench_log\")\n"
                   "  --max-tries=NUM          max number of tries to run transaction (default: 1)\n"
+                  "  --continue-client-on-error\n"
+                  "                           Continue and retry transactions that failed due to errors other than serialization or deadlocks.\n"
                   "  --progress-timestamp     use Unix epoch timestamps for progress\n"
                   "  --random-seed=SEED       set random seed (\"time\", \"rand\", integer)\n"
                   "  --sampling-rate=NUM      fraction of transactions to log (e.g., 0.01 for 1%%)\n"
@@ -1522,6 +1524,9 @@ accumStats(StatsData *stats, bool skipped, double lat, double lag,
                case ESTATUS_DEADLOCK_ERROR:
                        stats->deadlock_failures++;
                        break;
+               case ESTATUS_OTHER_SQL_ERROR:
+                       stats->other_sql_failures++;
+                       break;
                default:
                        /* internal error which should never occur */
                        pg_fatal("unexpected error status: %d", estatus);
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Vacuum statistics
Next
From: Dilip Kumar
Date:
Subject: Re: Backward movement of confirmed_flush resulting in data duplication.