pgbench: Improve result outputs related to failed transactinos

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pgbench: Improve result outputs related to failed transactinos
Date: 2024-09-20 15:35:44
Message-ID: 20240921003544.2436ef8da9c5c8cb963c651b@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I would like to improve the following two points on the result outputs
of pgbench related to faild transaction. The patch is attached.

(1) Output per-script statistics even when there are no successful
transaction if there is any failed transactions due to serialization
or deadlock errors.

Previously, per-script statistics were never output when any transactions
are failed. However, it is reasonable to report per-script failed transactions
if they are due to serialization or deadlock errors, since these kinds of
failures are now objects to be reported.

This is fixed by modifying the following condition to use "total_cnt <= 0".

/* Remaining stats are nonsensical if we failed to execute any xacts */
if (total->cnt + total->skipped <= 0)
return;

(2) Avoid to print "NaN%" in lines on failed transaction reports.

If the total number of successful, skipped, and failed transactions is zero,
we don't have to report the number of failed transactions as similar to that
the number of skipped transactions is not reported in this case.

So, I moved the check of total_cnt mentioned above before reporting the number
of faild transactions. Also, I added a check of script_total_cnt before
reporting per-script number of failed transactions.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
0001-pgbench-Improve-result-outputs-related-to-failed-tra.patch text/x-diff 4.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-09-20 15:53:49 Re: Why mention to Oracle ?
Previous Message Peter Geoghegan 2024-09-20 14:59:41 Re: Adding skip scan (including MDAM style range skip scan) to nbtree