Node UUIDs v6.0.1
In PGD 6, each node now has a UUID that is used to identify the node in the cluster. This UUID is generated when the node is created and is unique to that node. The UUID can be found in various places in PGD, including:
- The
bdr.node
table, which contains information about each node in the cluster. - The
bdr.node_summary
view, which provides a human-readable view of the nodes in the cluster. - The
bdr.local_node
table, which contains information about the local node. - The uuid values also appear in the naming of the replication slots that are created for each node.
Although used throughour PGD's node management, the use of UUIDs doesn't affect any existing functionality or features in PGD. The UUIDs are used internally to identify nodes and groups and don't change the way that users interact with PGD.
Why UUIDs?
UUIDs are used in PGD to provide a unique identifier for each node in the cluster. Previous versions of PGD used the node name as an identifier, which could lead to conflicts if two nodes had the same name. By using UUIDs, PGD can ensure that each node has a unique identifier that will not change over time. This is especially important in a distributed system like PGD where nodes may be added or removed from the cluster frequently. The UUID ensures that although a new node may have the same name as an existing node, it has a different UUID and doesn't conflict with the existing node.
How are UUIDs generated?
When a new node is created, a UUID is generated for that node. This UUID is created using the kernel's strong random number generator and guaranteed to be uniformly random. This guarantee ensures that the UUID is unique and can't be easily guessed. The generated UUID is then stored in the bdr.node
table and is used to identify the node in the cluster.
What happens if a node is removed and a replacement added?
If a node is removed from the cluster and a replacement node is added, the replacement node is assigned a new UUID. This ensures that the replacement node is treated as a separate entity in the cluster and doesn't conflict with the existing nodes. But PGD requires that the old node be fully parted from the cluster before it accepts the new node. The UUID of the replacement node is then used in the same way as the UUIDs of the other nodes in the cluster.
UUID-related changes in PGD 6
- The
generation
field in thebdr.node
table, which was previously used to differentiate between nodes, is no longer used. It remains at 0 for all nodes. - The
node_uuid
field in thebdr.node
table is never null in PGD 6. It may be null in the future with a mixed version cluster.