Synchronous Commit v5.6

Commit scope kind: SYNCHRONOUS COMMIT

Overview

PGD's SYNCHRONOUS COMMIT is a commit scope kind that works in a way that's more like PostgreSQL's synchronous_commit option in its underlying operation. Unlike the PostgreSQL option, though, it's configured as a commit scope and is easier to configure and interact with in PGD.

Unlike other commit scope kinds, such as GROUP COMMIT and CAMO, the transactions in a SYNCHRONOUS COMMIT operation aren't transformed into a two-phase commit (2PC) transaction. They work more like a Postgres synchronous_commit.

Example

In this example, when this commit scope is in use, any node in the left_dc group uses SYNCHRONOUS COMMIT to replicate changes to the other nodes in the left_dc group. It looks for a majority of nodes in the left_dc group to confirm that they committed the transaction.

SELECT bdr.add_commit_scope(
    commit_scope_name := 'example_sc_scope',
    origin_node_group := 'left_dc',
    rule := 'MAJORITY (left_dc) SYNCHRONOUS COMMIT',
    wait_for_ready := true
);

Configuration

SYNCHRONOUS COMMIT supports the optional DEGRADE ON clause. See the SYNCHRONOUS COMMIT commit scope reference for specific configuration parameters or see this section regarding Degrade on options.

Confirmation

Confirmation levelPGD Synchronous Commit handling
receivedA remote PGD node confirms the transaction once it's been fully received and is in the in-memory write queue.
replicatedSame behavior as received.
durableConfirms the transaction after all of its changes are flushed to disk. Analogous to synchronous_commit = on in legacy synchronous replication.
visible (default)Confirms the transaction after all of its changes are flushed to disk and it's visible to concurrent transactions. Analogous to synchronous_commit = remote_apply in legacy synchronous replication.

Details

Currently SYNCHRONOUS COMMIT doesn't use the confirmation levels of the commit scope rule syntax.

In commit scope rules, the original keyword SYNCHRONOUS_COMMIT is now aliased to SYNCHRONOUS COMMIT. The use of a space instead of an underscore helps distinguish it from Postgres's native SYNCHRONOUS_COMMIT.