Skip to content

Commit 6a10952

Browse files
track_io_timing logging: Don't special case 0 ms.
Adjust track_io_timing related logging code added by commit 94d13d4. Make it consistent with other nearby autovacuum and autoanalyze logging code by removing logic that suppressed zero millisecond outputs. log_autovacuum_min_duration log output now reliably shows "read:" and "write:" millisecond-based values in its report (when track_io_timing is enabled). Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: Stephen Frost <sfrost@snowman.net> Discussion: https://postgr.es/m/CAH2-WznW0FNxSVQMSRazAMYNfZ6DR_gr5WE78hc6E1CBkkJpzw@mail.gmail.com Backpatch: 14-, where the track_io_timing logging was introduced.
1 parent fd134f3 commit 6a10952

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/backend/access/heap/vacuumlazy.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -840,16 +840,11 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
840840
}
841841
if (track_io_timing)
842842
{
843-
appendStringInfoString(&buf, _("I/O timings:"));
844-
if (pgStatBlockReadTime - startreadtime > 0)
845-
appendStringInfo(&buf, _(" read: %.3f ms"),
846-
(double) (pgStatBlockReadTime - startreadtime) / 1000);
847-
if ((pgStatBlockReadTime - startreadtime > 0) && (pgStatBlockWriteTime - startwritetime > 0))
848-
appendStringInfoString(&buf, _(","));
849-
if (pgStatBlockWriteTime - startwritetime > 0)
850-
appendStringInfo(&buf, _(" write: %.3f ms"),
851-
(double) (pgStatBlockWriteTime - startwritetime) / 1000);
852-
appendStringInfoChar(&buf, '\n');
843+
double read_ms = (double) (pgStatBlockReadTime - startreadtime) / 1000;
844+
double write_ms = (double) (pgStatBlockWriteTime - startwritetime) / 1000;
845+
846+
appendStringInfo(&buf, _("I/O timings: read: %.3f ms, write: %.3f ms\n"),
847+
read_ms, write_ms);
853848
}
854849
appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
855850
read_rate, write_rate);

src/backend/commands/analyze.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -779,16 +779,11 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
779779
RelationGetRelationName(onerel));
780780
if (track_io_timing)
781781
{
782-
appendStringInfoString(&buf, _("I/O timings:"));
783-
if (pgStatBlockReadTime - startreadtime > 0)
784-
appendStringInfo(&buf, _(" read: %.3f ms"),
785-
(double) (pgStatBlockReadTime - startreadtime) / 1000);
786-
if ((pgStatBlockReadTime - startreadtime > 0) && (pgStatBlockWriteTime - startwritetime > 0))
787-
appendStringInfoString(&buf, _(","));
788-
if (pgStatBlockWriteTime - startwritetime > 0)
789-
appendStringInfo(&buf, _(" write: %.3f ms"),
790-
(double) (pgStatBlockWriteTime - startwritetime) / 1000);
791-
appendStringInfoChar(&buf, '\n');
782+
double read_ms = (double) (pgStatBlockReadTime - startreadtime) / 1000;
783+
double write_ms = (double) (pgStatBlockWriteTime - startwritetime) / 1000;
784+
785+
appendStringInfo(&buf, _("I/O timings: read: %.3f ms, write: %.3f ms\n"),
786+
read_ms, write_ms);
792787
}
793788
appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
794789
read_rate, write_rate);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy