Details
-
New Feature
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
In MDEV-37248, I was bitten by some behavior I found to be unexpected. Replicating the statement:
CREATE TABLE test (id int unsigned auto_increment primary key, bool_val bool default false);
led to a different result on the slave from:
my (undef, $create_statement) = $dbh->selectrow_array(q{SHOW CREATE TABLE test}); |
$dbh->do($create_statement); |
It turned out that replicating the former statement honors table defaults (such as which engine to use) that are set on the slave, whereas fetching CREATE TABLE for the CREATE I had just issued and replicating that led to the slave matching the master.
In trying to figure out why anybody would ever want tables to not be replicated exactly on the master, I found this:
https://dev.mysql.com/doc/refman/8.4/en/replication-solutions-diffengines.html
I guess there are some valid possibilities there. However, I would say the principle of least surprise would be for the default behavior to be that the slave should match the master exactly.
I propose that a new option be created, allowing for a slave to either use its own defaults for table creation (the current situation), or to replicate exactly what's on the master (my vastly preferred behavior).
In my opinion, the default behavior should be to match the master, with the option allowing the other behavior. But I understand that it might be required for the option to work the opposite direction, in order to work smoothly with the current Maria behavior.