Question

I plan to set up MariaDB replication either in master-master or master-slave mode. The main issue I have now are worries after reading this documentation.

We use foreign keys a LOT and we also use a lot of cascading effects, especially for ON DELETE. I really do not understand why this would be an issue if both slave and master have the same table definitions, with the same cascading ON DELETE triggers.

Can I safely assume that if both DB servers have exact same storage engine (InnoDB) and MariaDB version, then foreign keys and related DELETE statements will work as expected? Or should we remove all of these CASCADEs and rework software to work without them?

Thanks!

Was it helpful?

Solution

This looks like a non-issue, because, obviously, you will be using the same table definitions, including engine, on both servers. The example in the MariaDB Knowledge Base article you linked to has different storage engines: the slave server doesn't have InnoDB, so it defaults to MyISAM, which doesn't support foreign keys. MyISAM does tolerate foreign key constraints in the CREATE TABLE statements, but it silently ignores them, so any defined cascading deletes will not happen.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top