1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +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:
Andres Freund
2017-09-19 22:03:48 -07:00
parent 5ada1fcd0c
commit fc49e24fa6
46 changed files with 898 additions and 501 deletions

54
configure vendored
View File

@ -821,7 +821,6 @@ enable_tap_tests
with_blocksize
with_segsize
with_wal_blocksize
with_wal_segsize
with_CC
enable_depend
enable_cassert
@ -1518,8 +1517,6 @@ Optional Packages:
--with-segsize=SEGSIZE set table segment size in GB [1]
--with-wal-blocksize=BLOCKSIZE
set WAL block size in kB [8]
--with-wal-segsize=SEGSIZE
set WAL segment size in MB [16]
--with-CC=CMD set compiler (deprecated)
--with-icu build with ICU support
--with-tcl build Tcl modules (PL/Tcl)
@ -3733,57 +3730,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
#
# WAL segment size
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WAL segment size" >&5
$as_echo_n "checking for WAL segment size... " >&6; }
# Check whether --with-wal-segsize was given.
if test "${with_wal_segsize+set}" = set; then :
withval=$with_wal_segsize;
case $withval in
yes)
as_fn_error $? "argument required for --with-wal-segsize option" "$LINENO" 5
;;
no)
as_fn_error $? "argument required for --with-wal-segsize option" "$LINENO" 5
;;
*)
wal_segsize=$withval
;;
esac
else
wal_segsize=16
fi
case ${wal_segsize} in
1) ;;
2) ;;
4) ;;
8) ;;
16) ;;
32) ;;
64) ;;
128) ;;
256) ;;
512) ;;
1024) ;;
*) as_fn_error $? "Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." "$LINENO" 5
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${wal_segsize}MB" >&5
$as_echo "${wal_segsize}MB" >&6; }
cat >>confdefs.h <<_ACEOF
#define XLOG_SEG_SIZE (${wal_segsize} * 1024 * 1024)
_ACEOF
#
# C compiler
#