Hello,

I currently have a database cluster with one standby node. My problem is that some of the tables doesn’t have a PK, so i keep getting the “database’s functionality is at risk” warning mail. My question is the following: Does the replication fails globally or only for the tables without PK? Because if its only for the tables without PK, i don’t care, but if it means that the whole DB replication fails, that’s a problem.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there

Thanks for reaching out to DigitalOcean Support. I understand you are concerned about primary keys if replication fails globally or only for the tables without primary key.

DigitalOcean uses the row-based replication (RBR) format, in which the primary node writes events to the binary log that indicate how individual table rows have changed. 

Row based replication works well as long as database tables have a primary key. MySQL primary key lookups are fast and the target server can find the rows to update and delete very quickly, but when tables lack primary keys, sequential table scans are required for each individual update/delete statement and replication can become extremely slow, especially if tables are large (> 5,000 rows).  

DigitalOcean uses replication to enable communication and synchronization between cluster nodes, which ensures that primary, standby and read-only nodes associated with a cluster remain in sync. In addition to cluster node communication, a full replication stream is applied anytime a new node is created based on an existing backup; the following features provided by the service depend on replication:

*Restoring a service from backup

*Automatically recovering a node from a failure

*Forking a new service from an existing service

*Migrating an existing service to a new data center region

*Scaling an existing service to a larger size

*Adding standby or read-only nodes to an existing service


When new nodes are created, they need to perform replication and having large tables without primary keys may make these operations take an extremely long time or depending on the situation not complete at all without manual operator intervention.

To make the service operate correctly and avoid such drastic measures you should ensure the primary keys exist for any tables that are not trivially small.

Please let us know if you have additional questions/concerns.

Regards
DigitalOcean Support

Submit an Answer