diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-06-24 13:57:21 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-06-24 13:57:21 -0400 |
commit | 5c215c941c3f6d6d2f5faf7bef6262373594977c (patch) | |
tree | cf6c561270b819892758b29dbb5849aec8711636 /src/backend/access/transam/xlog.c | |
parent | 35a8e227e6c6d566f47436555730fef711691dd6 (diff) | |
download | postgresql-5c215c941c3f6d6d2f5faf7bef6262373594977c.tar.gz postgresql-5c215c941c3f6d6d2f5faf7bef6262373594977c.zip |
Add parens to ConvertToXSegs macro
The current definition (introduced in 9a3215026bd6) is dangerous. No
bugs exist in our code at present, but backpatch to 11 nonetheless,
where that commit debuted.
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index bceef897d6e..28292393d19 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -738,9 +738,12 @@ static ControlFileData *ControlFile = NULL; */ #define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD) -/* Convert min_wal_size_mb and max wal_size_mb to equivalent segment count */ +/* + * Convert min_wal_size_mb and max wal_size_mb to equivalent segment count. + * Rounds down. + */ #define ConvertToXSegs(x, segsize) \ - (x / ((segsize) / (1024 * 1024))) + ((x) / ((segsize) / (1024 * 1024))) /* The number of bytes in a WAL segment usable for WAL data. */ static int UsableBytesInSegment; |