From: | Jeff Davis <jdavis(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: logtape.c: allocate read buffer even for an empty tape. |
Date: | 2020-02-19 18:12:23 |
Message-ID: | E1j4Tpf-0003eL-0x@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
logtape.c: allocate read buffer even for an empty tape.
Prior to this commit, the read buffer was allocated at the time the tape
was rewound; but as an optimization, would not be allocated at all if
the tape was empty.
That optimization meant that it was valid to have a rewound tape with
the buffer set to NULL, but only if a number of conditions were met
and only if the API was used properly. After 7fdd919a refactored the
code to support lazily-allocating the buffer, Coverity started
complaining.
The optimization for empty tapes doesn't seem important, so just
allocate the buffer whether the tape has any data or not.
Discussion: https://postgr.es/m/20351.1581868306%40sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8021985d791902a9eeda51acdede759fbc67ae01
Modified Files
--------------
src/backend/utils/sort/logtape.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2020-02-19 18:53:40 | pgsql: Minor refactor of nodeAgg.c. |
Previous Message | Fujii Masao | 2020-02-19 11:49:35 | pgsql: Fix mesurement of elapsed time during truncating heap in VACUUM. |