agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings 524+ messages / 2 participants [nested] [flat]
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/backend/storage/ipc/latch.c | 2 ++ src/bin/psql/common.c | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index cc0d9a05d9f..fb4c860bdea 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index d79d71a8515..f4123e7de7e 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout, Assert(timeout >= 0 && timeout <= INT_MAX); cur_timeout = timeout; } + else + INSTR_TIME_SET_ZERO(start_time); pgstat_report_wait_start(wait_event_info); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --vt42kbp2j7rjcapp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0002-instr_time-Represent-time-as-an-int64-on-all-plat.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings @ 2023-01-16 18:04 Andres Freund <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Andres Freund @ 2023-01-16 18:04 UTC (permalink / raw) These are all not necessary from a correctness POV. However, in a subsequent patch instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Author: Reviewed-by: Discussion: https://postgr.es/m/[email protected] Backpatch: --- src/backend/access/transam/xlog.c | 4 ++++ src/backend/storage/buffer/bufmgr.c | 4 ++++ src/backend/storage/file/buffile.c | 4 ++++ src/bin/psql/common.c | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 8f47fb75700..7d65b1d4159 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) /* Measure I/O timing to write WAL data */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); written = pg_pwrite(openLogFile, from, nleft, startoffset); @@ -8150,6 +8152,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) /* Measure I/O timing to sync the WAL file */ if (track_wal_io_timing) INSTR_TIME_SET_CURRENT(start); + else + INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC); switch (sync_method) diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 8075828e8a6..800a4248c95 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); smgrread(smgr, forkNum, blockNum, (char *) bufBlock); @@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * bufToWrite is either the shared buffer or a copy, as appropriate. diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index c5464b6aa62..0a51624df3b 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); /* * Read whatever we can get, up to a full bufferload. @@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file) if (track_io_timing) INSTR_TIME_SET_CURRENT(io_start); + else + INSTR_TIME_SET_ZERO(io_start); bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 00627830c47..f907f5d4e8d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* * To parse the query but not execute it, we prepare it, using the unnamed @@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query, if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); if (pset.bind_flag) success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0); @@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) if (timing) INSTR_TIME_SET_CURRENT(before); + else + INSTR_TIME_SET_ZERO(before); /* if we're not in a transaction, start one */ if (PQtransactionStatus(pset.db) == PQTRANS_IDLE) -- 2.38.0 --ftp5i6iirmkwy7na Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0002-Use-int64-to-represent-instr_time-on-all-platform.patch" ^ permalink raw reply [nested|flat] 524+ messages in thread
* [PATCH] POC: syslogger: add Boolean state indicating readiness @ 2026-05-26 10:45 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 524+ messages in thread From: Álvaro Herrera @ 2026-05-26 10:45 UTC (permalink / raw) This replaces a comparison of MyBackendType, which was made obsolete by commit 0c8e082fba8d. --- src/backend/postmaster/syslogger.c | 5 +++++ src/backend/utils/error/elog.c | 6 +++--- src/include/postmaster/syslogger.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index acfe0a01715..d736f6a4fab 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -76,6 +76,9 @@ char *Log_filename = NULL; bool Log_truncate_on_rotation = false; int Log_file_mode = S_IRUSR | S_IWUSR; +/* for elog.c */ +bool syslogger_setup_done = false; + /* * Private state */ @@ -195,6 +198,8 @@ SysLoggerMain(const void *startup_data, size_t startup_data_len) Assert(startup_data_len == 0); #endif + syslogger_setup_done = true; + /* * Now that we're done reading the startup data, release postmaster's * working memory context. diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 50c53b571a0..a6936a0c664 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -3831,7 +3831,7 @@ send_message_to_server_log(ErrorData *edata) * pipe). If this is not possible, fallback to an entry written to * stderr. */ - if (redirection_done || MyBackendType == B_LOGGER) + if (redirection_done || syslogger_setup_done) write_csvlog(edata); else fallback_to_stderr = true; @@ -3845,7 +3845,7 @@ send_message_to_server_log(ErrorData *edata) * pipe). If this is not possible, fallback to an entry written to * stderr. */ - if (redirection_done || MyBackendType == B_LOGGER) + if (redirection_done || syslogger_setup_done) { write_jsonlog(edata); } @@ -3885,7 +3885,7 @@ send_message_to_server_log(ErrorData *edata) } /* If in the syslogger process, try to write messages direct to file */ - if (MyBackendType == B_LOGGER) + if (syslogger_setup_done) write_syslogger_file(buf.data, buf.len, LOG_DESTINATION_STDERR); /* No more need of the message formatted for stderr */ diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h index 30c4b2daf3f..44409fc2542 100644 --- a/src/include/postmaster/syslogger.h +++ b/src/include/postmaster/syslogger.h @@ -85,6 +85,7 @@ extern PGDLLIMPORT int syslogPipe[2]; extern PGDLLIMPORT HANDLE syslogPipe[2]; #endif +extern bool syslogger_setup_done; extern int SysLogger_Start(int child_slot); -- 2.47.3 --oji7a74ejnbtd35k-- ^ permalink raw reply [nested|flat] 524+ messages in thread
end of thread, other threads:[~2026-05-26 10:45 UTC | newest] Thread overview: 524+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v8 1/5] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2023-01-16 18:04 [PATCH v7 1/4] Zero initialize instr_time uses causing compiler warnings Andres Freund <[email protected]> 2026-05-26 10:45 [PATCH] POC: syslogger: add Boolean state indicating readiness Álvaro Herrera <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox