Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf9f6c8

Browse files
committed
Extend yesterday's patch making BLCKSZ and RELSEG_SIZE configurable to also
let XLOG_BLCKSZ and XLOG_SEG_SIZE be set via configure. Per a proposal byMark Wong, though I thought it better to call the switches after "wal" ratherthan "xlog".
1 parentb3fb2d6 commitcf9f6c8

File tree

6 files changed

+220
-31
lines changed

6 files changed

+220
-31
lines changed

‎configure

Lines changed: 113 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,8 +1373,10 @@ Optional Packages:
13731373
--with-libraries=DIRS look for additional libraries in DIRS
13741374
--with-libs=DIRS alternative spelling of --with-libraries
13751375
--with-pgport=PORTNUM set default port number [5432]
1376-
--with-blocksize=BLOCKSIZE set block size in kB [8]
1377-
--with-segsize=SEGSIZE set segment size in GB [1]
1376+
--with-blocksize=BLOCKSIZE set table block size in kB [8]
1377+
--with-segsize=SEGSIZE set table segment size in GB [1]
1378+
--with-wal-blocksize=BLOCKSIZE set WAL block size in kB [8]
1379+
--with-wal-segsize=SEGSIZE set WAL segment size in MB [16]
13781380
--with-tcl build Tcl modules (PL/Tcl)
13791381
--with-tclconfig=DIR tclConfig.sh is in DIR
13801382
--with-perl build Perl modules (PL/Perl)
@@ -2603,7 +2605,7 @@ _ACEOF
26032605

26042606

26052607
#
2606-
#File segment size
2608+
#Relation segment size
26072609
#
26082610
{ echo "$as_me:$LINENO: checking for segment size" >&5
26092611
echo $ECHO_N "checking for segment size... $ECHO_C" >&6; }
@@ -2647,6 +2649,114 @@ cat >>confdefs.h <<_ACEOF
26472649
_ACEOF
26482650

26492651

2652+
#
2653+
# WAL block size
2654+
#
2655+
{ echo "$as_me:$LINENO: checking for WAL block size" >&5
2656+
echo $ECHO_N "checking for WAL block size... $ECHO_C" >&6; }
2657+
2658+
pgac_args="$pgac_args with_wal_blocksize"
2659+
2660+
2661+
# Check whether --with-wal-blocksize was given.
2662+
if test "${with_wal_blocksize+set}" = set; then
2663+
withval=$with_wal_blocksize;
2664+
case $withval in
2665+
yes)
2666+
{ { echo "$as_me:$LINENO: error: argument required for --with-wal-blocksize option" >&5
2667+
echo "$as_me: error: argument required for --with-wal-blocksize option" >&2;}
2668+
{ (exit 1); exit 1; }; }
2669+
;;
2670+
no)
2671+
{ { echo "$as_me:$LINENO: error: argument required for --with-wal-blocksize option" >&5
2672+
echo "$as_me: error: argument required for --with-wal-blocksize option" >&2;}
2673+
{ (exit 1); exit 1; }; }
2674+
;;
2675+
*)
2676+
wal_blocksize=$withval
2677+
;;
2678+
esac
2679+
2680+
else
2681+
wal_blocksize=8
2682+
fi
2683+
2684+
2685+
case ${wal_blocksize} in
2686+
1) XLOG_BLCKSZ=1024;;
2687+
2) XLOG_BLCKSZ=2048;;
2688+
4) XLOG_BLCKSZ=4096;;
2689+
8) XLOG_BLCKSZ=8192;;
2690+
16) XLOG_BLCKSZ=16384;;
2691+
32) XLOG_BLCKSZ=32768;;
2692+
64) XLOG_BLCKSZ=65536;;
2693+
*) { { echo "$as_me:$LINENO: error: Invalid WAL block size. Allowed values are 1,2,4,8,16,32,64." >&5
2694+
echo "$as_me: error: Invalid WAL block size. Allowed values are 1,2,4,8,16,32,64." >&2;}
2695+
{ (exit 1); exit 1; }; }
2696+
esac
2697+
{ echo "$as_me:$LINENO: result: ${wal_blocksize}kB" >&5
2698+
echo "${ECHO_T}${wal_blocksize}kB" >&6; }
2699+
2700+
2701+
cat >>confdefs.h <<_ACEOF
2702+
#define XLOG_BLCKSZ ${XLOG_BLCKSZ}
2703+
_ACEOF
2704+
2705+
2706+
#
2707+
# WAL segment size
2708+
#
2709+
{ echo "$as_me:$LINENO: checking for WAL segment size" >&5
2710+
echo $ECHO_N "checking for WAL segment size... $ECHO_C" >&6; }
2711+
2712+
pgac_args="$pgac_args with_wal_segsize"
2713+
2714+
2715+
# Check whether --with-wal-segsize was given.
2716+
if test "${with_wal_segsize+set}" = set; then
2717+
withval=$with_wal_segsize;
2718+
case $withval in
2719+
yes)
2720+
{ { echo "$as_me:$LINENO: error: argument required for --with-wal-segsize option" >&5
2721+
echo "$as_me: error: argument required for --with-wal-segsize option" >&2;}
2722+
{ (exit 1); exit 1; }; }
2723+
;;
2724+
no)
2725+
{ { echo "$as_me:$LINENO: error: argument required for --with-wal-segsize option" >&5
2726+
echo "$as_me: error: argument required for --with-wal-segsize option" >&2;}
2727+
{ (exit 1); exit 1; }; }
2728+
;;
2729+
*)
2730+
wal_segsize=$withval
2731+
;;
2732+
esac
2733+
2734+
else
2735+
wal_segsize=16
2736+
fi
2737+
2738+
2739+
case ${wal_segsize} in
2740+
1) ;;
2741+
2) ;;
2742+
4) ;;
2743+
8) ;;
2744+
16) ;;
2745+
32) ;;
2746+
64) ;;
2747+
*) { { echo "$as_me:$LINENO: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64." >&5
2748+
echo "$as_me: error: Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64." >&2;}
2749+
{ (exit 1); exit 1; }; }
2750+
esac
2751+
{ echo "$as_me:$LINENO: result: ${wal_segsize}MB" >&5
2752+
echo "${ECHO_T}${wal_segsize}MB" >&6; }
2753+
2754+
2755+
cat >>confdefs.h <<_ACEOF
2756+
#define XLOG_SEG_SIZE (${wal_segsize} * 1024 * 1024)
2757+
_ACEOF
2758+
2759+
26502760
#
26512761
# C compiler
26522762
#

‎configure.in

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.558 2008/05/0201:08:26 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.559 2008/05/0219:52:37 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -221,7 +221,7 @@ AC_SUBST(enable_dtrace)
221221
# Block size
222222
#
223223
AC_MSG_CHECKING([for block size])
224-
PGAC_ARG_REQ(with, blocksize, [ --with-blocksize=BLOCKSIZE set block size in kB [[8]]],
224+
PGAC_ARG_REQ(with, blocksize, [ --with-blocksize=BLOCKSIZE settableblock size in kB [[8]]],
225225
[blocksize=$withval],
226226
[blocksize=8])
227227
case ${blocksize} in
@@ -250,10 +250,10 @@ AC_DEFINE_UNQUOTED([BLCKSZ], ${BLCKSZ}, [
250250
])
251251

252252
#
253-
#File segment size
253+
#Relation segment size
254254
#
255255
AC_MSG_CHECKING([for segment size])
256-
PGAC_ARG_REQ(with, segsize, [ --with-segsize=SEGSIZE set segment size in GB [[1]]],
256+
PGAC_ARG_REQ(with, segsize, [ --with-segsize=SEGSIZE settablesegment size in GB [[1]]],
257257
[segsize=$withval],
258258
[segsize=1])
259259
# this expression is set up to avoid unnecessary integer overflow
@@ -280,6 +280,61 @@ AC_DEFINE_UNQUOTED([RELSEG_SIZE], ${RELSEG_SIZE}, [
280280
Changing RELSEG_SIZE requires an initdb.
281281
])
282282

283+
#
284+
# WAL block size
285+
#
286+
AC_MSG_CHECKING([for WAL block size])
287+
PGAC_ARG_REQ(with, wal-blocksize, [ --with-wal-blocksize=BLOCKSIZE set WAL block size in kB [[8]]],
288+
[wal_blocksize=$withval],
289+
[wal_blocksize=8])
290+
case ${wal_blocksize} in
291+
1) XLOG_BLCKSZ=1024;;
292+
2) XLOG_BLCKSZ=2048;;
293+
4) XLOG_BLCKSZ=4096;;
294+
8) XLOG_BLCKSZ=8192;;
295+
16) XLOG_BLCKSZ=16384;;
296+
32) XLOG_BLCKSZ=32768;;
297+
64) XLOG_BLCKSZ=65536;;
298+
*) AC_MSG_ERROR([Invalid WAL block size. Allowed values are 1,2,4,8,16,32,64.])
299+
esac
300+
AC_MSG_RESULT([${wal_blocksize}kB])
301+
302+
AC_DEFINE_UNQUOTED([XLOG_BLCKSZ], ${XLOG_BLCKSZ}, [
303+
Size of a WAL file block. This need have no particular relation to BLCKSZ.
304+
XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
305+
XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
306+
buffers, else direct I/O may fail.
307+
308+
Changing XLOG_BLCKSZ requires an initdb.
309+
])
310+
311+
#
312+
# WAL segment size
313+
#
314+
AC_MSG_CHECKING([for WAL segment size])
315+
PGAC_ARG_REQ(with, wal-segsize, [ --with-wal-segsize=SEGSIZE set WAL segment size in MB [[16]]],
316+
[wal_segsize=$withval],
317+
[wal_segsize=16])
318+
case ${wal_segsize} in
319+
1) ;;
320+
2) ;;
321+
4) ;;
322+
8) ;;
323+
16) ;;
324+
32) ;;
325+
64) ;;
326+
*) AC_MSG_ERROR([Invalid WAL segment size. Allowed values are 1,2,4,8,16,32,64.])
327+
esac
328+
AC_MSG_RESULT([${wal_segsize}MB])
329+
330+
AC_DEFINE_UNQUOTED([XLOG_SEG_SIZE], [(${wal_segsize} * 1024 * 1024)], [
331+
XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
332+
and larger than XLOG_BLCKSZ (preferably, a great deal larger than
333+
XLOG_BLCKSZ).
334+
335+
Changing XLOG_SEG_SIZE requires an initdb.
336+
])
337+
283338
#
284339
# C compiler
285340
#

‎doc/src/sgml/installation.sgml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.308 2008/05/0201:08:26 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.309 2008/05/0219:52:37 tgl Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -1103,6 +1103,34 @@ su - postgres
11031103
</listitem>
11041104
</varlistentry>
11051105

1106+
<varlistentry>
1107+
<term><option>--with-wal-segsize=<replaceable>SEGSIZE</replaceable></option></term>
1108+
<listitem>
1109+
<para>
1110+
Set the <firstterm>WAL segment size</>, in megabytes. This is
1111+
the size of each individual file in the WAL log. It may be useful
1112+
to adjust this size to control the granularity of WAL log shipping.
1113+
The default size is 16 megabytes.
1114+
The value must be a power of 2 between 1 and 64 (megabytes).
1115+
Note that changing this value requires an initdb.
1116+
</para>
1117+
</listitem>
1118+
</varlistentry>
1119+
1120+
<varlistentry>
1121+
<term><option>--with-wal-blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
1122+
<listitem>
1123+
<para>
1124+
Set the <firstterm>WAL block size</>, in kilobytes. This is the unit
1125+
of storage and I/O within the WAL log. The default, 8 kilobytes,
1126+
is suitable for most situations; but other values may be useful
1127+
in special cases.
1128+
The value must be a power of 2 between 1 and 64 (kilobytes).
1129+
Note that changing this value requires an initdb.
1130+
</para>
1131+
</listitem>
1132+
</varlistentry>
1133+
11061134
<varlistentry>
11071135
<term><option>--disable-spinlocks</option></term>
11081136
<listitem>

‎doc/src/sgml/wal.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/wal.sgml,v 1.52 2007/12/29 17:55:07 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/wal.sgml,v 1.53 2008/05/02 19:52:37 tgl Exp $ -->
22

33
<chapter id="wal">
44
<title>Reliability and the Write-Ahead Log</title>
@@ -487,8 +487,11 @@
487487
<para>
488488
<acronym>WAL</acronym> logs are stored in the directory
489489
<filename>pg_xlog</filename> under the data directory, as a set of
490-
segment files, normally each 16 MB in size. Each segment is divided into
491-
pages, normally 8 kB each. The log record headers are described in
490+
segment files, normally each 16 MB in size (but the size can be changed
491+
by altering the <option>--with-wal-segsize</> configure option when
492+
building the server). Each segment is divided into pages, normally
493+
8 kB each (this size can be changed via the <option>--with-wal-blocksize</>
494+
configure option). The log record headers are described in
492495
<filename>access/xlog.h</filename>; the record content is dependent
493496
on the type of event that is being logged. Segment files are given
494497
ever-increasing numbers as names, starting at

‎src/include/pg_config.h.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,18 @@
747747
first (like Motorola and SPARC, unlike Intel and VAX). */
748748
#undef WORDS_BIGENDIAN
749749

750+
/* Size of a WAL file block. This need have no particular relation to BLCKSZ.
751+
XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
752+
XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
753+
buffers, else direct I/O may fail. Changing XLOG_BLCKSZ requires an initdb.
754+
*/
755+
#undef XLOG_BLCKSZ
756+
757+
/* XLOG_SEG_SIZE is the size of a single WAL file. This must be a power of 2
758+
and larger than XLOG_BLCKSZ (preferably, a great deal larger than
759+
XLOG_BLCKSZ). Changing XLOG_SEG_SIZE requires an initdb. */
760+
#undef XLOG_SEG_SIZE
761+
750762
/* Number of bits in a file offset, on hosts where this is settable. */
751763
#undef _FILE_OFFSET_BITS
752764

‎src/include/pg_config_manual.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,10 @@
66
* for developers.If you edit any of these, be sure to do a *full*
77
* rebuild (and an initdb if noted).
88
*
9-
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.32 2008/05/0201:08:27 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.33 2008/05/0219:52:37 tgl Exp $
1010
*------------------------------------------------------------------------
1111
*/
1212

13-
/*
14-
* Size of a WAL file block. This need have no particular relation to BLCKSZ.
15-
* XLOG_BLCKSZ must be a power of 2, and if your system supports O_DIRECT I/O,
16-
* XLOG_BLCKSZ must be a multiple of the alignment requirement for direct-I/O
17-
* buffers, else direct I/O may fail.
18-
*
19-
* Changing XLOG_BLCKSZ requires an initdb.
20-
*/
21-
#defineXLOG_BLCKSZ8192
22-
23-
/*
24-
* XLOG_SEG_SIZE is the size of a single WAL file.This must be a power of 2
25-
* and larger than XLOG_BLCKSZ (preferably, a great deal larger than
26-
* XLOG_BLCKSZ).
27-
*
28-
* Changing XLOG_SEG_SIZE requires an initdb.
29-
*/
30-
#defineXLOG_SEG_SIZE(16*1024*1024)
31-
3213
/*
3314
* Maximum length for identifiers (e.g. table names, column names,
3415
* function names). It must be a multiple of sizeof(int) (typically

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp