Skip to content

Commit fc49e24

Browse files
committedSep 20, 2017
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
1 parent 5ada1fc commit fc49e24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+897
-500
lines changed
 

‎configure

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,6 @@ enable_tap_tests
821821
with_blocksize
822822
with_segsize
823823
with_wal_blocksize
824-
with_wal_segsize
825824
with_CC
826825
enable_depend
827826
enable_cassert
@@ -1518,8 +1517,6 @@ Optional Packages:
15181517
--with-segsize=SEGSIZE set table segment size in GB [1]
15191518
--with-wal-blocksize=BLOCKSIZE
15201519
set WAL block size in kB [8]
1521-
--with-wal-segsize=SEGSIZE
1522-
set WAL segment size in MB [16]
15231520
--with-CC=CMD set compiler (deprecated)
15241521
--with-icu build with ICU support
15251522
--with-tcl build Tcl modules (PL/Tcl)
@@ -3733,57 +3730,6 @@ cat >>confdefs.h <<_ACEOF
37333730
_ACEOF
37343731

37353732

3736-
#
3737-
# WAL segment size
3738-
#
3739-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WAL segment size" >&5
3740-
$as_echo_n "checking for WAL segment size... " >&6; }
3741-
3742-
3743-
3744-
# Check whether --with-wal-segsize was given.
3745-
if test "${with_wal_segsize+set}" = set; then :
3746-
withval=$with_wal_segsize;
3747-
case $withval in
3748-
yes)
3749-
as_fn_error $? "argument required for --with-wal-segsize option" "$LINENO" 5
3750-
;;
3751-
no)
3752-
as_fn_error $? "argument required for --with-wal-segsize option" "$LINENO" 5
3753-
;;
3754-
*)
3755-
wal_segsize=$withval
3756-
;;
3757-
esac
3758-
3759-
else
3760-
wal_segsize=16
3761-
fi
3762-
3763-
3764-
case ${wal_segsize} in
3765-
1) ;;
3766-
2) ;;
3767-
4) ;;
3768-
8) ;;
3769-
16) ;;
3770-
32) ;;
3771-
64) ;;
3772-
128) ;;
3773-
256) ;;
3774-
512) ;;
3775-
1024) ;;
3776-
*) as_fn_error $? "Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024." "$LINENO" 5
3777-
esac
3778-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${wal_segsize}MB" >&5
3779-
$as_echo "${wal_segsize}MB" >&6; }
3780-
3781-
3782-
cat >>confdefs.h <<_ACEOF
3783-
#define XLOG_SEG_SIZE (${wal_segsize} * 1024 * 1024)
3784-
_ACEOF
3785-
3786-
37873733
#
37883734
# C compiler
37893735
#

‎configure.in

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -343,37 +343,6 @@ AC_DEFINE_UNQUOTED([XLOG_BLCKSZ], ${XLOG_BLCKSZ}, [
343343
Changing XLOG_BLCKSZ requires an initdb.
344344
])
345345

346-
#
347-
# WAL segment size
348-
#
349-
AC_MSG_CHECKING([for WAL segment size])
350-
PGAC_ARG_REQ(with, wal-segsize, [SEGSIZE], [set WAL segment size in MB [16]],
351-
[wal_segsize=$withval],
352-
[wal_segsize=16])
353-
case ${wal_segsize} in
354-
1) ;;
355-
2) ;;
356-
4) ;;
357-
8) ;;
358-
16) ;;
359-
32) ;;
360-
64) ;;
361-
128) ;;
362-
256) ;;
363-
512) ;;
364-
1024) ;;
365-
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64,128,256,512,1024.])
366-
esac
367-
AC_MSG_RESULT([${wal_segsize}MB])
368-
369-
AC_DEFINE_UNQUOTED([XLOG_SEG_SIZE], [(${wal_segsize} * 1024 * 1024)], [
370-
XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
371-
and larger than XLOG_BLCKSZ (preferably, a great deal larger than
372-
XLOG_BLCKSZ).
373-
374-
Changing XLOG_SEG_SIZE requires an initdb.
375-
])
376-
377346
#
378347
# C compiler
379348
#

0 commit comments

Comments
 (0)