Conflict Management
===================

EDB Postgres Distributed is an active/active or multi-master DBMS. If
used asynchronously, writes to the same or related rows from multiple
different nodes can result in data :ref:`bdr_read_all_conflicts <bdr_read_all_conflicts>`  when using standard
data types.

Conflicts aren’t errors. In most cases, they’re events that PGD can
detect and resolve as they occur. Resolution depends on the nature of
the application and the meaning of the data, so it’s important that PGD
provides the application a range of choices as to how to resolve them.

By default, conflicts are resolved at the row level. When changes from
two nodes conflict, either the local or remote tuple is picked and the
other is discarded. For example, the commit timestamps might be compared
for the two conflicting changes and the newer one kept. This approach
ensures that all nodes converge to the same result and establishes
commit-order-like semantics on the whole cluster.

Column-level conflict detection and resolution is available with PGD,
described in :ref:`CLCD <Conflicts>`  .

If you want to avoid conflicts, use :ref:`How Quorum Commit works <How Quorum Commit works>`  or conflict-free data
types (CRDTs), described in :ref:`Handling column-level conflicts using CRDT data types <Handling column-level conflicts using CRDT data types>`  . You can also use Connection
Manager to route all writes to one write-leader, eliminating the chance
for inter-nodal conflicts.

.. toctree::
  :maxdepth: 3

  DEEP_DIVE--conflict-management--conflicts--index
  DEEP_DIVE--conflict-management--column-level-conflicts--index
  DEEP_DIVE--conflict-management--crdt--index
