Exploring conflict handling with PGD v5.6
In a multi-master architecture like PGD, conflicts happen. PGD is built to handle them.
A conflict can occur when one database node has an update from an application to a row and another node has a different update to the same row. This type of conflict is called a row-level conflict. Conflicts aren't errors. Resolving them effectively is core to how Postgres Distributed maintains consistency.
The best way to handle conflicts is to prevent them! Use PGD's Always-on architecture with proxies to ensure that your applications write to the same server in the cluster. is When conflicts occur, though, it's useful to know how PGD resolves them, how you can control that resolution, and how you can find out that they're happening. Row insertion and row updates are two actions that can cause conflicts.
To see how it works, you need to open a command line view of all the servers.
Your quick start configuration
This exploration assumes that you created your PGD cluster using the quick start for Docker, the quick start for AWS, or the quick start for Linux hosts.
At the end of each quick start, you'll have a cluster with four nodes and these roles:
Host name | Host role |
---|---|
kaboom | PGD data node and pgd-proxy co-host |
kaftan | PGD data node and pgd-proxy co-host |
kaolin | PGD data node and pgd-proxy co-host |
kapok | Barman backup node |
You'll use these hostnames throughout this exercise.
Installing xpanes
Xpanes optional
We recommend the xpanes
utility for this exercise. It allows you to easily switch between multiple terminal sessions. If you prefer to use multiple terminals, tmux or another terminal multiplexer, you can do so. Just make sure you can easily switch between multiple terminal sessions.
You'll use xpanes
, a utility that allows you to quickly create multiple terminal sessions that you can easily switch between. It isn't installed by default, so you'll have to install it. Start by connecting to the kaboom node with ssh:
If you're running the quick start on Docker, you'll be using Rocky Linux, a Red Hat derivative. To perform the xpanes install, run: