Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 25b2aba

Browse files
committed
Zero initialize uses of instr_time about to trigger compiler warnings
These are all not necessary from a correctness POV. However, in the near future instr_time will be simplified to an int64, at which point gcc would otherwise start to warn about the changed places. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20230116023639.rn36vf6ajqmfciua@awork3.anarazel.de
1 parent 5d29d52 commit 25b2aba

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

src/backend/access/transam/xlog.c

+4
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,8 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
21912191
/* Measure I/O timing to write WAL data */
21922192
if (track_wal_io_timing)
21932193
INSTR_TIME_SET_CURRENT(start);
2194+
else
2195+
INSTR_TIME_SET_ZERO(start);
21942196

21952197
pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE);
21962198
written = pg_pwrite(openLogFile, from, nleft, startoffset);
@@ -8151,6 +8153,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
81518153
/* Measure I/O timing to sync the WAL file */
81528154
if (track_wal_io_timing)
81538155
INSTR_TIME_SET_CURRENT(start);
8156+
else
8157+
INSTR_TIME_SET_ZERO(start);
81548158

81558159
pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC);
81568160
switch (sync_method)

src/backend/storage/buffer/bufmgr.c

+4
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
10171017

10181018
if (track_io_timing)
10191019
INSTR_TIME_SET_CURRENT(io_start);
1020+
else
1021+
INSTR_TIME_SET_ZERO(io_start);
10201022

10211023
smgrread(smgr, forkNum, blockNum, (char *) bufBlock);
10221024

@@ -2902,6 +2904,8 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln)
29022904

29032905
if (track_io_timing)
29042906
INSTR_TIME_SET_CURRENT(io_start);
2907+
else
2908+
INSTR_TIME_SET_ZERO(io_start);
29052909

29062910
/*
29072911
* bufToWrite is either the shared buffer or a copy, as appropriate.

src/backend/storage/file/buffile.c

+4
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ BufFileLoadBuffer(BufFile *file)
446446

447447
if (track_io_timing)
448448
INSTR_TIME_SET_CURRENT(io_start);
449+
else
450+
INSTR_TIME_SET_ZERO(io_start);
449451

450452
/*
451453
* Read whatever we can get, up to a full bufferload.
@@ -525,6 +527,8 @@ BufFileDumpBuffer(BufFile *file)
525527

526528
if (track_io_timing)
527529
INSTR_TIME_SET_CURRENT(io_start);
530+
else
531+
INSTR_TIME_SET_ZERO(io_start);
528532

529533
bytestowrite = FileWrite(thisfile,
530534
file->buffer.data + wpos,

src/backend/storage/ipc/latch.c

+2
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,8 @@ WaitEventSetWait(WaitEventSet *set, long timeout,
14011401
Assert(timeout >= 0 && timeout <= INT_MAX);
14021402
cur_timeout = timeout;
14031403
}
1404+
else
1405+
INSTR_TIME_SET_ZERO(start_time);
14041406

14051407
pgstat_report_wait_start(wait_event_info);
14061408

src/bin/psql/common.c

+6
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,8 @@ DescribeQuery(const char *query, double *elapsed_msec)
12761276

12771277
if (timing)
12781278
INSTR_TIME_SET_CURRENT(before);
1279+
else
1280+
INSTR_TIME_SET_ZERO(before);
12791281

12801282
/*
12811283
* To parse the query but not execute it, we prepare it, using the unnamed
@@ -1406,6 +1408,8 @@ ExecQueryAndProcessResults(const char *query,
14061408

14071409
if (timing)
14081410
INSTR_TIME_SET_CURRENT(before);
1411+
else
1412+
INSTR_TIME_SET_ZERO(before);
14091413

14101414
if (pset.bind_flag)
14111415
success = PQsendQueryParams(pset.db, query, pset.bind_nparams, NULL, (const char * const *) pset.bind_params, NULL, NULL, 0);
@@ -1702,6 +1706,8 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec)
17021706

17031707
if (timing)
17041708
INSTR_TIME_SET_CURRENT(before);
1709+
else
1710+
INSTR_TIME_SET_ZERO(before);
17051711

17061712
/* if we're not in a transaction, start one */
17071713
if (PQtransactionStatus(pset.db) == PQTRANS_IDLE)

0 commit comments

Comments
 (0)