Skip to content

Commit 7a97abe

Browse files
committed
Add unchangeable GUC "variables" segment_size, wal_block_size, and
wal_segment_size to make those configuration parameters available to clients, in the same way that block_size was previously exposed. Bernd Helmle, with comments from Abhijit Menon-Sen and some further tweaking by me.
1 parent eaf1b5d commit 7a97abe

File tree

2 files changed

+85
-3
lines changed

2 files changed

+85
-3
lines changed

doc/src/sgml/config.sgml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.182 2008/07/01 21:49:04 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.183 2008/07/10 22:08:17 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -4865,6 +4865,22 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
48654865
</listitem>
48664866
</varlistentry>
48674867

4868+
<varlistentry id="guc-segment-size" xreflabel="segment_size">
4869+
<term><varname>segment_size</varname> (<type>integer</type>)</term>
4870+
<indexterm>
4871+
<primary><varname>segment_size</> configuration parameter</primary>
4872+
</indexterm>
4873+
<listitem>
4874+
<para>
4875+
Reports the number of blocks (pages) that can be stored within a file
4876+
segment. It is determined by the value of <literal>RELSEG_SIZE</>
4877+
when building the server. The maximum size of a segment file in bytes
4878+
is equal to <varname>segment_size</> multiplied by
4879+
<varname>block_size</>; by default this is 1GB.
4880+
</para>
4881+
</listitem>
4882+
</varlistentry>
4883+
48684884
<varlistentry id="guc-server-encoding" xreflabel="server_encoding">
48694885
<term><varname>server_encoding</varname> (<type>string</type>)</term>
48704886
<indexterm>
@@ -4901,12 +4917,42 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
49014917
</indexterm>
49024918
<listitem>
49034919
<para>
4904-
Reports the version number of the server as an integer. It is determined
4920+
Reports the version number of the server as an integer. It is determined
49054921
by the value of <literal>PG_VERSION_NUM</> when building the server.
49064922
</para>
49074923
</listitem>
49084924
</varlistentry>
49094925

4926+
<varlistentry id="guc-wal-block-size" xreflabel="wal_block_size">
4927+
<term><varname>wal_block_size</varname> (<type>integer</type>)</term>
4928+
<indexterm>
4929+
<primary><varname>wal_block_size</> configuration parameter</primary>
4930+
</indexterm>
4931+
<listitem>
4932+
<para>
4933+
Reports the size of a WAL disk block. It is determined by the value
4934+
of <literal>XLOG_BLCKSZ</> when building the server. The default value
4935+
is 8192 bytes.
4936+
</para>
4937+
</listitem>
4938+
</varlistentry>
4939+
4940+
<varlistentry id="guc-wal-segment-size" xreflabel="wal_segment_size">
4941+
<term><varname>wal_segment_size</varname> (<type>integer</type>)</term>
4942+
<indexterm>
4943+
<primary><varname>wal_segment_size</> configuration parameter</primary>
4944+
</indexterm>
4945+
<listitem>
4946+
<para>
4947+
Reports the number of blocks (pages) in a WAL segment file.
4948+
The total size of a WAL segment file in bytes is equal to
4949+
<varname>wal_segment_size</> multiplied by <varname>wal_block_size</>;
4950+
by default this is 16MB. See <xref linkend="wal-configuration"> for
4951+
more information.
4952+
</para>
4953+
</listitem>
4954+
</varlistentry>
4955+
49104956
</variablelist>
49114957
</sect1>
49124958

src/backend/utils/misc/guc.c

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.463 2008/07/08 02:07:29 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.464 2008/07/10 22:08:17 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -377,6 +377,9 @@ static int max_function_args;
377377
static int max_index_keys;
378378
static int max_identifier_length;
379379
static int block_size;
380+
static int segment_size;
381+
static int wal_block_size;
382+
static int wal_segment_size;
380383
static bool integer_datetimes;
381384

382385
/* should be static, but commands/variable.c needs to get at these */
@@ -1753,6 +1756,39 @@ static struct config_int ConfigureNamesInt[] =
17531756
BLCKSZ, BLCKSZ, BLCKSZ, NULL, NULL
17541757
},
17551758

1759+
{
1760+
{"segment_size", PGC_INTERNAL, PRESET_OPTIONS,
1761+
gettext_noop("Shows the number of pages per disk file."),
1762+
NULL,
1763+
GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1764+
},
1765+
&segment_size,
1766+
RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE, NULL, NULL
1767+
},
1768+
1769+
{
1770+
{"wal_block_size", PGC_INTERNAL, PRESET_OPTIONS,
1771+
gettext_noop("Shows the block size in the write ahead log."),
1772+
NULL,
1773+
GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1774+
},
1775+
&wal_block_size,
1776+
XLOG_BLCKSZ, XLOG_BLCKSZ, XLOG_BLCKSZ, NULL, NULL
1777+
},
1778+
1779+
{
1780+
{"wal_segment_size", PGC_INTERNAL, PRESET_OPTIONS,
1781+
gettext_noop("Shows the number of pages per write ahead log segment."),
1782+
NULL,
1783+
GUC_UNIT_XBLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1784+
},
1785+
&wal_segment_size,
1786+
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
1787+
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
1788+
(XLOG_SEG_SIZE / XLOG_BLCKSZ),
1789+
NULL, NULL
1790+
},
1791+
17561792
{
17571793
{"autovacuum_naptime", PGC_SIGHUP, AUTOVACUUM,
17581794
gettext_noop("Time to sleep between autovacuum runs."),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy