From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Beena Emerson <memissemerson(at)gmail(dot)com> |
Cc: | tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: increasing the default WAL segment size |
Date: | 2017-03-17 01:10:51 |
Message-ID: | CA+Tgmobq1q3yM3iPi+P3=Wt7T4urWcsWD5ioS2-SB5zOx6Z=bw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 14, 2017 at 1:44 AM, Beena Emerson <memissemerson(at)gmail(dot)com> wrote:
> Attached is the updated patch. It fixes the issues and also updates few code
> comments.
I did an initial readthrough of this patch tonight just to get a
feeling for what's going on. Based on that, here are a few review
comments:
The changes to pg_standby seem to completely break the logic to wait
until the file has attained the correct size. I don't know how to
salvage that logic off-hand, but just breaking it isn't acceptable.
+ Note that changing this value requires an initdb.
Instead, maybe say something like "Note that this value is fixed for
the lifetime of the database cluster."
-int max_wal_size = 64; /* 1 GB */
-int min_wal_size = 5; /* 80 MB */
+int wal_segment_size = 2048; /* 16 MB */
+int max_wal_size = 1024 * 1024; /* 1 GB */
+int min_wal_size = 80 * 1024; /* 80 MB */
If wal_segment_size is now measured in multiple of XLOG_BLCKSZ, then
it's not the case that 2048 is always 16MB. If the other values are
now measured in kB, perhaps rename the variables to add _kb, to avoid
confusion with the way it used to work (and in general). The problem
with leaving this as-is is that any existing references to
max_wal_size in core or extension code will silently break; you want
it to break in a noticeable way so that it gets fixed.
+ * UsableBytesInSegment: It is set in assign_wal_segment_size and stores the
+ * number of bytes in a WAL segment usable for WAL data.
The comment doesn't need to say where it gets set, and it doesn't need
to repeat the variable name. Just say "The number of bytes in a..."
+assign_wal_segment_size(int newval, void *extra)
Why does a PGC_INTERNAL GUC need an assign hook? I think the GUC
should only be there to expose the value; it shouldn't have
calculation logic associated with it.
/*
+ * initdb passes the WAL segment size in an environment variable. We don't
+ * bother doing any sanity checking, we already check in initdb that the
+ * user gives a sane value.
+ */
+ XLogSegSize = pg_atoi(getenv("XLOG_SEG_SIZE"), sizeof(uint32), 0);
I think we should bother. I don't like the idea of the postmaster
crashing in flames without so much as a reasonable error message if
this parameter-passing mechanism goes wrong.
+ {"wal-segsize", required_argument, NULL, 'Z'},
When adding an option with no documented short form, generally one
picks a number that isn't a character for the value at the end. See
pg_regress.c or initdb.c for examples.
+ wal_segment_size = atoi(str_wal_segment_size);
So, you're comfortable interpreting --wal-segsize=1TB or
--wal-segsize=1GB as 1? Implicitly, 1MB?
+ * ControlFile is not accessible here so use SHOW wal_segment_size command
+ * to set the XLogSegSize
Breaks compatibility with pre-9.6 servers.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-03-17 01:10:59 | Re: CREATE/ALTER ROLE PASSWORD ('value' USING 'method') |
Previous Message | Tsunakawa, Takayuki | 2017-03-17 00:18:51 | Re: Crash on promotion when recovery.conf is renamed |