Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 795e94c
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2693047
Choose a head ref
  • 2 commits
  • 15 files changed
  • 2 contributors

Commits on Dec 11, 2025

  1. Add configurable conflict log table for Logical Replication

    This patch adds a feature to provide a structured, queryable record of all
    logical replication conflicts. The current approach of logging conflicts as
    plain text in the server logs makes it difficult to query, analyze, and
    use for external monitoring and automation.
    
    This patch addresses these limitations by introducing a configurable
    conflict_log_table option in the CREATE SUBSCRIPTION command. Key design
    decisions include:
    
    User-Managed Table: The conflict log is stored in a user-managed table
    rather than a system catalog.
    
    Structured Data: Conflict details, including the original and remote tuples,
    are stored in JSON columns, providing a flexible format to accommodate different
    table schemas.
    
    Comprehensive Information: The log table captures essential attributes such as
    local and remote transaction IDs, LSNs, commit timestamps, and conflict type,
    providing a complete record for post-mortem analysis.
    
    This feature will make logical replication conflicts easier to monitor and manage,
    significantly improving the overall resilience and operability of replication setups.
    
    The conflict log tables will not be included in a publication, even if the publication
    is configured to include ALL TABLES or ALL TABLES IN SCHEMA.
    
    Note: A single remote tuple may conflict with multiple local tuples when conflict type
    is CT_MULTIPLE_UNIQUE_CONFLICTS, so for handling this case we create a single row in
    conflict log table with respect to each remote conflict tuple even if it conflicts with
    multiple local tuples and we store the multiple conflict tuples as a single JSON array
    element in format as
    [ { "xid": "1001", "commit_ts": "...", "origin": "...", "tuple": {...} }, ... ]
    We can extract the elements of the local tuples from the conflict log table row
    as given in below example.
    
    SELECT remote_xid, relname, remote_origin, local_conflicts[1] ->> 'xid' AS local_xid,
           local_conflicts[1] ->> 'tuple' AS local_tuple
    FROM myschema.conflict_log_history2;
    
     remote_xid | relname  | remote_origin | local_xid |     local_tuple
    ------------+----------+---------------+-----------+---------------------
            760 | test     | pg_16406      | 771       | {"a":1,"b":10}
            765 | conf_tab | pg_16406      | 775       | {"a":2,"b":2,"c":2}
    Dilip Kumar authored and Commitfest Bot committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    b82ea98 View commit details
    Browse the repository at this point in the history
  2. [CF 6252] v11 - Proposal: Conflict log history table for Logical Repl…

    …ication
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6252
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAFiTN-vrKc6OWzrg6yvpwYcj79k=zkrDp3uwiZzjwrWLJAq6tw@mail.gmail.com
    Author(s): Dilip Kumar
    Commitfest Bot committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    2693047 View commit details
    Browse the repository at this point in the history
Loading