Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9d645fd

Browse files
committed
Support syncing WAL log to disk using either fsync(), fdatasync(),
O_SYNC, or O_DSYNC (as available on a given platform). Add GUC parameter to control sync method. Also, add defense to XLogWrite to prevent it from going nuts if passed a target write position that's past the end of the buffers so far filled by XLogInsert.
1 parent 4eb5e27 commit 9d645fd

File tree

6 files changed

+287
-62
lines changed

6 files changed

+287
-62
lines changed

doc/src/sgml/runtime.sgml

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.56 2001/03/13 01:17:05 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.57 2001/03/16 05:44:33 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1224,8 +1224,8 @@ env PGOPTIONS='-c geqo=off' psql
12241224
<term>WAL_BUFFERS (<type>integer</type>)</term>
12251225
<listitem>
12261226
<para>
1227-
Number of disk-page buffers for WAL log. This option can only be set
1228-
at server start.
1227+
Number of disk-page buffers in shared memory for WAL log.
1228+
This option can only be set at server start.
12291229
</para>
12301230
</listitem>
12311231
</varlistentry>
@@ -1250,6 +1250,23 @@ env PGOPTIONS='-c geqo=off' psql
12501250
</para>
12511251
</listitem>
12521252
</varlistentry>
1253+
1254+
<varlistentry>
1255+
<term>WAL_SYNC_METHOD (<type>string</type>)</term>
1256+
<listitem>
1257+
<para>
1258+
Method used for forcing WAL updates out to disk. Possible
1259+
values are
1260+
<literal>FSYNC</> (call fsync() at each commit),
1261+
<literal>FDATASYNC</> (call fdatasync() at each commit),
1262+
<literal>OPEN_SYNC</> (write WAL files with open() option O_SYNC), or
1263+
<literal>OPEN_DATASYNC</> (write WAL files with open() option O_DSYNC).
1264+
Not all of these choices are available on all platforms.
1265+
This option can only be set at server start or in the
1266+
<filename>postgresql.conf</filename> file.
1267+
</para>
1268+
</listitem>
1269+
</varlistentry>
12531270
</variablelist>
12541271
</para>
12551272
</sect2>

doc/src/sgml/wal.sgml

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.4 2001/03/13 01:17:05 tgl Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.5 2001/03/16 05:44:33 tgl Exp $ -->
22

33
<chapter id="wal">
44
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
@@ -281,15 +281,6 @@
281281
<command>CHECKPOINT</command>.
282282
</para>
283283

284-
<para>
285-
Setting the <varname>WAL_DEBUG</varname> parameter to any non-zero
286-
value will result in each <function>LogInsert</function> and
287-
<function>LogFlush</function> <acronym>WAL</acronym> call being
288-
logged to standard error. At present, it makes no difference what
289-
the non-zero value is. This option may be replaced by a more
290-
general mechanism in the future.
291-
</para>
292-
293284
<para>
294285
The <varname>COMMIT_DELAY</varname> parameter defines for how many
295286
microseconds the backend will sleep after writing a commit
@@ -304,6 +295,24 @@
304295
ten milliseconds, so that any nonzero <varname>COMMIT_DELAY</varname>
305296
setting between 1 and 10000 microseconds will have the same effect.
306297
</para>
298+
299+
<para>
300+
The <varname>WAL_SYNC_METHOD</varname> parameter determines how
301+
Postgres will ask the kernel to force WAL updates out to disk.
302+
All the options should be the same as far as reliability goes,
303+
but it's quite platform-specific which one will be the fastest.
304+
Note that this parameter is irrelevant if <varname>FSYNC</varname>
305+
has been turned off.
306+
</para>
307+
308+
<para>
309+
Setting the <varname>WAL_DEBUG</varname> parameter to any non-zero
310+
value will result in each <function>LogInsert</function> and
311+
<function>LogFlush</function> <acronym>WAL</acronym> call being
312+
logged to standard error. At present, it makes no difference what
313+
the non-zero value is. This option may be replaced by a more
314+
general mechanism in the future.
315+
</para>
307316
</sect1>
308317
</chapter>
309318

0 commit comments

Comments
 (0)