mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Make WAL segment size configurable at initdb time.
For performance reasons a larger segment size than the default 16MB can be useful. A larger segment size has two main benefits: Firstly, in setups using archiving, it makes it easier to write scripts that can keep up with higher amounts of WAL, secondly, the WAL has to be written and synced to disk less frequently. But at the same time large segment size are disadvantageous for smaller databases. So far the segment size had to be configured at compile time, often making it unrealistic to choose one fitting to a particularly load. Therefore change it to a initdb time setting. This includes a breaking changes to the xlogreader.h API, which now requires the current segment size to be configured. For that and similar reasons a number of binaries had to be taught how to recognize the current segment size. Author: Beena Emerson, editorialized by Andres Freund Reviewed-By: Andres Freund, David Steele, Kuntal Ghosh, Michael Paquier, Peter Eisentraut, Robert Hass, Tushar Ahuja Discussion: https://postgr.es/m/CAOG9ApEAcQ--1ieKbhFzXSQPw_YLmepaa4hNdnY5+ZULpt81Mw@mail.gmail.com
This commit is contained in:
31
configure.in
31
configure.in
@ -343,37 +343,6 @@ AC_DEFINE_UNQUOTED([XLOG_BLCKSZ], ${XLOG_BLCKSZ}, [
|
||||
Changing XLOG_BLCKSZ requires an initdb.
|
||||
])
|
||||
|
||||
#
|
||||
# WAL segment size
|
||||
#
|
||||
AC_MSG_CHECKING([for WAL segment size])
|
||||
PGAC_ARG_REQ(with, wal-segsize, [SEGSIZE], [set WAL segment size in MB [16]],
|
||||
[wal_segsize=$withval],
|
||||
[wal_segsize=16])
|
||||
case ${wal_segsize} in
|
||||
1) ;;
|
||||
2) ;;
|
||||
4) ;;
|
||||
8) ;;
|
||||
16) ;;
|
||||
32) ;;
|
||||
64) ;;
|
||||
128) ;;
|
||||
256) ;;
|
||||
512) ;;
|
||||
1024) ;;
|
||||
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.])
|
||||
esac
|
||||
AC_MSG_RESULT([${wal_segsize}MB])
|
||||
|
||||
AC_DEFINE_UNQUOTED([XLOG_SEG_SIZE], [(${wal_segsize} * 1024 * 1024)], [
|
||||
XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
|
||||
and larger than XLOG_BLCKSZ (preferably, a great deal larger than
|
||||
XLOG_BLCKSZ).
|
||||
|
||||
Changing XLOG_SEG_SIZE requires an initdb.
|
||||
])
|
||||
|
||||
#
|
||||
# C compiler
|
||||
#
|
||||
|
Reference in New Issue
Block a user