| From: | Beena Emerson <memissemerson(at)gmail(dot)com> | 
|---|---|
| To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> | 
| Cc: | Robert Haas <robertmhaas(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: | 2016-12-19 09:44:50 | 
| Message-ID: | CAOG9ApGTaqVQdeutVd_M+Ru9x+Ud6Z014G3sEw36PbBxpA0tpQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hello all,
Please find attached a patch to make wal segment size initdb configurable.
The attached patch removes --with-wal-segsize configure option and adds a
new initdb option --wal-segsize. The module initdb passes the wal-segsize
value into an environment variable which is used to overwrite the guc value
wal_ segment_size and set the internal variables : XLogSegSize and
XLOG_SEG_SIZE (xlog_internal.h). The default wal_segment_size is not
changed but I have increased the maximum size to 1GB.
Since  XLOG_SEG_SIZE is now variable, it could not be used directly in
src/bin modules and few macros and few changes had to be made:
  -  in guc.c , remove GUC_UNIT_XSEGS which used XLOG_SEG_SIZE and
introduce show functions for the guc which used the unit (min_wal_size and
max_wal_size).
  -  For pg_basebackup, add new replication command SHOW_WAL_SEGSZ to fetch
the wal_segment_size in bytes.
  - pg_controldata, pg_resetxlog, pg_rewind, fetch the xlog_seg_size from
the ControlFile.
  - Since pg_xlogdump reads the wal files, it uses the file size to
determine the xlog_seg_size.
  - In pg_test_fsync, a buffer of size XLOG_SEG_SIZE was created, filled
with random data and written to a temporary file to check for any
write/fsync error before performing the tests. Since it does not affect the
actual performance results, the XLOG_SEG_SIZE in the module is replaced
with the default value (16MB).
Please note that the documents are not updated in this patch.
Feedback and suggestions are welcome.
--
Beena Emerson
Have a Great Day!
| Attachment | Content-Type | Size | 
|---|---|---|
| initdb-walsegsize_v1.patch | application/octet-stream | 28.7 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2016-12-19 09:46:16 | Re: Measuring replay lag | 
| Previous Message | Petr Jelinek | 2016-12-19 09:30:07 | Logical replication existing data copy |