Incorrect overflow check condition for WAL segment size

Started by Kuntal Ghoshabout 9 years ago5 messages
#1Kuntal Ghosh
kuntalghosh.2007@gmail.com
1 attachment(s)

Hi all,

Although we restrict the WAL segment size to 64 MB as upper limit, the
following piece of code in guc.c (line 715) seems confusing to me.

#if XLOG_SEG_SIZE < (1024*1024) || XLOG_BLCKSZ > (1024*1024*1024)
#error XLOG_SEG_SIZE must be between 1MB and 1GB
#endif

Either the comment is wrongly written or the check for overflow
condition has to be fixed. Assuming the overflow check condition to be
erroneous, I've attached a patch to fix this.

--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

Attachments:

wrong_wal_segment_size_upper_limit.patchapplication/x-download; name=wrong_wal_segment_size_upper_limit.patchDownload
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 65660c1..3c695c1 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -707,7 +707,7 @@ typedef struct
 #if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024)
 #error XLOG_BLCKSZ must be between 1KB and 1MB
 #endif
-#if XLOG_SEG_SIZE < (1024*1024) || XLOG_BLCKSZ > (1024*1024*1024)
+#if XLOG_SEG_SIZE < (1024*1024) || XLOG_SEG_SIZE > (1024*1024*1024)
 #error XLOG_SEG_SIZE must be between 1MB and 1GB
 #endif
 
#2Michael Paquier
michael.paquier@gmail.com
In reply to: Kuntal Ghosh (#1)
Re: Incorrect overflow check condition for WAL segment size

On Tue, Nov 8, 2016 at 2:33 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:

Either the comment is wrongly written or the check for overflow
condition has to be fixed. Assuming the overflow check condition to be
erroneous, I've attached a patch to fix this.

Good catch. Interesting copy-pasto from 88e9823.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Robert Haas
robertmhaas@gmail.com
In reply to: Michael Paquier (#2)
Re: Incorrect overflow check condition for WAL segment size

On Tue, Nov 8, 2016 at 1:01 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:

On Tue, Nov 8, 2016 at 2:33 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:

Either the comment is wrongly written or the check for overflow
condition has to be fixed. Assuming the overflow check condition to be
erroneous, I've attached a patch to fix this.

Good catch. Interesting copy-pasto from 88e9823.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Markus Nullmeier
dq124@uni-heidelberg.de
In reply to: Robert Haas (#3)
Re: Incorrect overflow check condition for WAL segment size

On 11/08/16 18:12, Robert Haas wrote:

On Tue, Nov 8, 2016 at 1:01 AM, Michael Paquier <michael.paquier@gmail.com> wrote:

On Tue, Nov 8, 2016 at 2:33 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:

I've attached a patch to fix this.

Good catch. Interesting copy-pasto from 88e9823.

Committed.

Hmm, somehow this fix (60379f66c8 for master) does not seem to appear
in the 9.5 and 9.6 branches, yet the latter both include commit 88e9823.

--
Markus Nullmeier http://www.g-vo.org
German Astrophysical Virtual Observatory (GAVO)

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Robert Haas
robertmhaas@gmail.com
In reply to: Markus Nullmeier (#4)
Re: Incorrect overflow check condition for WAL segment size

On Wed, Nov 9, 2016 at 12:54 PM, Markus Nullmeier
<dq124@uni-heidelberg.de> wrote:

On 11/08/16 18:12, Robert Haas wrote:

On Tue, Nov 8, 2016 at 1:01 AM, Michael Paquier <michael.paquier@gmail.com> wrote:

On Tue, Nov 8, 2016 at 2:33 PM, Kuntal Ghosh <kuntalghosh.2007@gmail.com> wrote:

I've attached a patch to fix this.

Good catch. Interesting copy-pasto from 88e9823.

Committed.

Hmm, somehow this fix (60379f66c8 for master) does not seem to appear
in the 9.5 and 9.6 branches, yet the latter both include commit 88e9823.

It didn't seem important to back-patch it, so I didn't. It also
occurred to me that there was a small chance of breaking the build for
somebody who is skating by today, which would annoy that person
without being likely to benefit anyone else.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers