@@ -2343,14 +2343,26 @@ include_dir 'conf.d'
2343
2343
</term>
2344
2344
<listitem>
2345
2345
<para>
2346
- Specifies whether transaction commit will wait for WAL records
2347
- to be written to disk before the command returns a <quote>success</>
2348
- indication to the client. Valid values are <literal>on</>,
2349
- <literal>remote_apply</>, <literal>remote_write</>, <literal>local</>,
2350
- and <literal>off</>. The default, and safe, setting
2351
- is <literal>on</>. When <literal>off</>, there can be a delay between
2352
- when success is reported to the client and when the transaction is
2353
- really guaranteed to be safe against a server crash. (The maximum
2346
+ Specifies how much WAL processing must complete before
2347
+ the database server returns a <quote>success</quote>
2348
+ indication to the client. Valid values are
2349
+ <literal>remote_apply</literal>, <literal>on</literal>
2350
+ (the default), <literal>remote_write</literal>,
2351
+ <literal>local</literal>, and <literal>off</literal>.
2352
+ </para>
2353
+
2354
+ <para>
2355
+ If <varname>synchronous_standby_names</varname> is empty,
2356
+ the only meaningful settings are <literal>on</literal> and
2357
+ <literal>off</literal>; <literal>remote_apply</literal>,
2358
+ <literal>remote_write</literal> and <literal>local</literal>
2359
+ all provide the same local synchronization level
2360
+ as <literal>on</literal>. The local behavior of all
2361
+ non-<literal>off</literal> modes is to wait for local flush of WAL
2362
+ to disk. In <literal>off</literal> mode, there is no waiting,
2363
+ so there can be a delay between when success is reported to the
2364
+ client and when the transaction is later guaranteed to be safe
2365
+ against a server crash. (The maximum
2354
2366
delay is three times <xref linkend="guc-wal-writer-delay">.) Unlike
2355
2367
<xref linkend="guc-fsync">, setting this parameter to <literal>off</>
2356
2368
does not create any risk of database inconsistency: an operating
@@ -2362,38 +2374,40 @@ include_dir 'conf.d'
2362
2374
exact certainty about the durability of a transaction. For more
2363
2375
discussion see <xref linkend="wal-async-commit">.
2364
2376
</para>
2377
+
2365
2378
<para>
2366
- If <xref linkend="guc-synchronous-standby-names"> is non-empty, this
2367
- parameter also controls whether or not transaction commits will wait
2368
- for their WAL records to be replicated to the standby server(s).
2369
- When set to <literal>on</>, commits will wait until replies
2379
+ If <xref linkend="guc-synchronous-standby-names"> is non-empty,
2380
+ <varname>synchronous_commit</varname> also controls whether
2381
+ transaction commits will wait for their WAL records to be
2382
+ processed on the standby server(s).
2383
+ </para>
2384
+
2385
+ <para>
2386
+ When set to <literal>remote_apply</literal>, commits will wait
2387
+ until replies from the current synchronous standby(s) indicate they
2388
+ have received the commit record of the transaction and applied
2389
+ it, so that it has become visible to queries on the standby(s),
2390
+ and also written to durable storage on the standbys. This will
2391
+ cause much larger commit delays than previous settings since
2392
+ it waits for WAL replay. When set to <literal>on</literal>,
2393
+ commits wait until replies
2370
2394
from the current synchronous standby(s) indicate they have received
2371
- the commit record of the transaction and flushed it todisk . This
2395
+ the commit record of the transaction and flushed it todurable storage . This
2372
2396
ensures the transaction will not be lost unless both the primary and
2373
2397
all synchronous standbys suffer corruption of their database storage.
2374
- When set to <literal>remote_apply</>, commits will wait until replies
2375
- from the current synchronous standby(s) indicate they have received the
2376
- commit record of the transaction and applied it, so that it has become
2377
- visible to queries on the standby(s).
2378
2398
When set to <literal>remote_write</>, commits will wait until replies
2379
2399
from the current synchronous standby(s) indicate they have
2380
- received the commit record of the transaction and written it out to
2381
- their operating system. This setting is sufficient to
2382
- ensure data preservation even if a standby instance of
2383
- <productname>PostgreSQL</> were to crash, but not if the standby
2384
- suffers an operating-system-level crash, since the data has not
2400
+ received the commit record of the transaction and written it to
2401
+ their file systems. This setting ensures data preservation if a standby instance of
2402
+ <productname>PostgreSQL</productname> crashes, but not if the standby
2403
+ suffers an operating-system-level crash because the data has not
2385
2404
necessarily reached durable storage on the standby.
2386
- Finally, the setting <literal>local</> causes commits to wait for
2387
- local flush to disk, but not for replication. This isnot usually
2405
+ The setting <literal>local</literal > causes commits to wait for
2406
+ local flush to disk, but not for replication. This is usually not
2388
2407
desirable when synchronous replication is in use, but is provided for
2389
2408
completeness.
2390
2409
</para>
2391
- <para>
2392
- If <varname>synchronous_standby_names</> is empty, the settings
2393
- <literal>on</>, <literal>remote_apply</>, <literal>remote_write</>
2394
- and <literal>local</> all provide the same synchronization level:
2395
- transaction commits only wait for local flush to disk.
2396
- </para>
2410
+
2397
2411
<para>
2398
2412
This parameter can be changed at any time; the behavior for any
2399
2413
one transaction is determined by the setting in effect when it
@@ -2403,6 +2417,76 @@ include_dir 'conf.d'
2403
2417
asynchronously when the default is the opposite, issue <command>SET
2404
2418
LOCAL synchronous_commit TO OFF</> within the transaction.
2405
2419
</para>
2420
+
2421
+ <para>
2422
+ <xref linkend="synchronous-commit-matrix"> summarizes the
2423
+ capabilities of the <varname>synchronous_commit</varname> settings.
2424
+ </para>
2425
+
2426
+ <table id="synchronous-commit-matrix">
2427
+ <title>synchronous_commit Modes</title>
2428
+ <tgroup cols="5">
2429
+ <colspec colname="col1" colwidth="1.1*">
2430
+ <colspec colname="col2" colwidth="1*">
2431
+ <colspec colname="col3" colwidth="1*">
2432
+ <colspec colname="col4" colwidth="1*">
2433
+ <colspec colname="col5" colwidth="1*">
2434
+ <thead>
2435
+ <row>
2436
+ <entry>synchronous_commit setting</entry>
2437
+ <entry>local durable commit</entry>
2438
+ <entry>standby durable commit after PG crash</entry>
2439
+ <entry>standby durable commit after OS crash</entry>
2440
+ <entry>standby query consistency</entry>
2441
+ </row>
2442
+ </thead>
2443
+
2444
+ <tbody>
2445
+
2446
+ <row>
2447
+ <entry>remote_apply</entry>
2448
+ <entry align="center">•</entry>
2449
+ <entry align="center">•</entry>
2450
+ <entry align="center">•</entry>
2451
+ <entry align="center">•</entry>
2452
+ </row>
2453
+
2454
+ <row>
2455
+ <entry>on</entry>
2456
+ <entry align="center">•</entry>
2457
+ <entry align="center">•</entry>
2458
+ <entry align="center">•</entry>
2459
+ <entry align="center"></entry>
2460
+ </row>
2461
+
2462
+ <row>
2463
+ <entry>remote_write</entry>
2464
+ <entry align="center">•</entry>
2465
+ <entry align="center">•</entry>
2466
+ <entry align="center"></entry>
2467
+ <entry align="center"></entry>
2468
+ </row>
2469
+
2470
+ <row>
2471
+ <entry>local</entry>
2472
+ <entry align="center">•</entry>
2473
+ <entry align="center"></entry>
2474
+ <entry align="center"></entry>
2475
+ <entry align="center"></entry>
2476
+ </row>
2477
+
2478
+ <row>
2479
+ <entry>off</entry>
2480
+ <entry align="center"></entry>
2481
+ <entry align="center"></entry>
2482
+ <entry align="center"></entry>
2483
+ <entry align="center"></entry>
2484
+ </row>
2485
+
2486
+ </tbody>
2487
+ </tgroup>
2488
+ </table>
2489
+
2406
2490
</listitem>
2407
2491
</varlistentry>
2408
2492