Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcae0f3c

Browse files
committed
pgbench: Improve result outputs related to failed transactions.
Previously, per-script statistics were never output when alltransactions failed due to serialization or deadlock errors. However,it is reasonable to report such information if there are ones evenwhen there are no successful transaction since these failedtransactions are now objects to be reported.Meanwhile, if the total number of successful, skipped, and failedtransactions is zero, we don't have to report the number of failedtransactions as similar to the number of skipped transactions, whichavoids to print "NaN%" in lines on failed transaction reports.Also, the number of transactions in per-script results now includesskipped and failed transactions. It prevents to print "total of NaN%"when any transactions are not successfully processed. The number oftransactions actually processed per-script and TPS based on it are nowoutput explicitly in a separate line.Author: Yugo NagataReviewed-by: Tatsuo IshiiDiscussion:https://postgr.es/m/20240921003544.2436ef8da9c5c8cb963c651b%40sraoss.co.jp
1 parent161320b commitcae0f3c

File tree

1 file changed

+46
-35
lines changed

1 file changed

+46
-35
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6391,6 +6391,13 @@ printResults(StatsData *total,
63916391
total->cnt);
63926392
}
63936393

6394+
/*
6395+
* Remaining stats are nonsensical if we failed to execute any xacts due
6396+
* to others than serialization or deadlock errors
6397+
*/
6398+
if (total_cnt <=0)
6399+
return;
6400+
63946401
printf("number of failed transactions: "INT64_FORMAT" (%.3f%%)\n",
63956402
failures,100.0*failures /total_cnt);
63966403

@@ -6412,10 +6419,6 @@ printResults(StatsData *total,
64126419
printf("total number of retries: "INT64_FORMAT"\n",total->retries);
64136420
}
64146421

6415-
/* Remaining stats are nonsensical if we failed to execute any xacts */
6416-
if (total->cnt+total->skipped <=0)
6417-
return;
6418-
64196422
if (throttle_delay&&latency_limit)
64206423
printf("number of transactions skipped: "INT64_FORMAT" (%.3f%%)\n",
64216424
total->skipped,100.0*total->skipped /total_cnt);
@@ -6483,45 +6486,53 @@ printResults(StatsData *total,
64836486

64846487
printf("SQL script %d: %s\n"
64856488
" - weight: %d (targets %.1f%% of total)\n"
6486-
" - "INT64_FORMAT" transactions (%.1f%% of total, tps = %f)\n",
6489+
" - "INT64_FORMAT" transactions (%.1f%% of total)\n",
64876490
i+1,sql_script[i].desc,
64886491
sql_script[i].weight,
64896492
100.0*sql_script[i].weight /total_weight,
6490-
sstats->cnt,
6491-
100.0*sstats->cnt /total->cnt,
6492-
sstats->cnt /bench_duration);
6493-
6494-
printf(" - number of failed transactions: "INT64_FORMAT" (%.3f%%)\n",
6495-
script_failures,
6496-
100.0*script_failures /script_total_cnt);
6493+
script_total_cnt,
6494+
100.0*script_total_cnt /total_cnt);
64976495

6498-
if (failures_detailed)
6496+
if (script_total_cnt>0)
64996497
{
6500-
printf(" - number of serialization failures: "INT64_FORMAT" (%.3f%%)\n",
6501-
sstats->serialization_failures,
6502-
(100.0*sstats->serialization_failures /
6503-
script_total_cnt));
6504-
printf(" - number of deadlock failures: "INT64_FORMAT" (%.3f%%)\n",
6505-
sstats->deadlock_failures,
6506-
(100.0*sstats->deadlock_failures /
6507-
script_total_cnt));
6508-
}
6498+
printf(" - number of transactions actually pocessed: "INT64_FORMAT" (tps = %f)\n",
6499+
sstats->cnt,sstats->cnt /bench_duration);
65096500

6510-
/* it can be non-zero only if max_tries is not equal to one */
6511-
if (max_tries!=1)
6512-
{
6513-
printf(" - number of transactions retried: "INT64_FORMAT" (%.3f%%)\n",
6514-
sstats->retried,
6515-
100.0*sstats->retried /script_total_cnt);
6516-
printf(" - total number of retries: "INT64_FORMAT"\n",
6517-
sstats->retries);
6518-
}
6501+
printf(" - number of failed transactions: "INT64_FORMAT" (%.3f%%)\n",
6502+
script_failures,
6503+
100.0*script_failures /script_total_cnt);
65196504

6520-
if (throttle_delay&&latency_limit&&script_total_cnt>0)
6521-
printf(" - number of transactions skipped: "INT64_FORMAT" (%.3f%%)\n",
6522-
sstats->skipped,
6523-
100.0*sstats->skipped /script_total_cnt);
6505+
if (failures_detailed)
6506+
{
6507+
printf(" - number of serialization failures: "INT64_FORMAT" (%.3f%%)\n",
6508+
sstats->serialization_failures,
6509+
(100.0*sstats->serialization_failures /
6510+
script_total_cnt));
6511+
printf(" - number of deadlock failures: "INT64_FORMAT" (%.3f%%)\n",
6512+
sstats->deadlock_failures,
6513+
(100.0*sstats->deadlock_failures /
6514+
script_total_cnt));
6515+
}
65246516

6517+
/*
6518+
* it can be non-zero only if max_tries is not equal to
6519+
* one
6520+
*/
6521+
if (max_tries!=1)
6522+
{
6523+
printf(" - number of transactions retried: "INT64_FORMAT" (%.3f%%)\n",
6524+
sstats->retried,
6525+
100.0*sstats->retried /script_total_cnt);
6526+
printf(" - total number of retries: "INT64_FORMAT"\n",
6527+
sstats->retries);
6528+
}
6529+
6530+
if (throttle_delay&&latency_limit)
6531+
printf(" - number of transactions skipped: "INT64_FORMAT" (%.3f%%)\n",
6532+
sstats->skipped,
6533+
100.0*sstats->skipped /script_total_cnt);
6534+
6535+
}
65256536
printSimpleStats(" - latency",&sstats->latency);
65266537
}
65276538

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp