> MySQL’s replication architecture means that if bugs do cause table corruption, the problem is unlikely to cause a catastrophic failure. Replication happens at the logical layer, so an operation like rebalancing a B-tree can never cause an index to become corrupted. A typical MySQL replication issue is the case of a statement being skipped (or, less frequently, applied twice). This may cause data to be missing or invalid, but it won’t cause a database outage.
So, data might be invalid or missing, but it will not cause a database outage...
Missing or invalid data can however cause an application outage instead when the guarantees of the RDBMS are no longer true. You can't win so don't try. Go for consistency throughout or handle lack of it and choose a different class of tool for storage.
It's gotten better in recent versions, but implicit type conversion and truncation of data is a common "feature" of MySQL.
0000-00-00 isn't a valid date; but in MySQL it is a "null" data on a column with a NOT NULL constraint.
PostgreSQL is more anal about what you put into it, if you try to insert into a row with no value for a NOT NULL constrained column it will fail the transaction.
Once data is in the system mysql will tend to favour binary replicated statement level queries; where postgresql's built-in replication is block level.
This means that if you delete a row on a mysql replica the replication will continue and you will only notice that you're out of sync when you try to alter the (now missing) row from the master; then replication will fail.. It's impossible to even modify data on a postgresql replica.
My understanding is that mysql will also truncate data in a column if the column is altered to where a value would no longer fit (IE; from varchar(20) to varchar(8)) where postgresql will fail and abort the transaction.
(This is my experience from using PGSQL and MySQL with varying degrees of scale for 15 years).
PostgreSQL has/had problems to be sure, the auto vacuum was an issue on the 8.0->8.2 line; and they're slow to adopt features (like baked-in replication and upsert) but I treat this as a feature itself; better to have a working feature that is cleanly engineered than a feature which is half-baked.
MySQL isn't prone to "corruption" (meaning, random unpredictable data loss or lack of validity) unless you are using MyISAM, a legacy storage engine that has no valid use-case for persistent data in 2018.
This is my experience as someone who has also been using MySQL for 15 years, including at literally the largest scale on the planet. I am not saying MySQL is perfect (no database is) or "better" than Postgres (both are great databases for different use-cases), nor am I agreeing with Uber's original post or motivations. But I do wish people would stop spreading FUD about MySQL-isms that are long out of date.
Most of your post is describing data conversion issues, which follows predictable (if admittedly esoteric) logic. This is different than random corruption. In MySQL 5.7+ (released in 2015), this undesirable data conversion behavior simply does not occur with default settings. Those settings were also available and widely used in prior versions, just not enabled by default.
> 0000-00-00 isn't a valid date; but in MySQL it is a "null" data on a column with a NOT NULL constraint.
> This means that if you delete a row on a mysql replica
MySQL replicas should be read-only unless you're doing something horribly unusual or non-standard. And with global transaction ID enabled (increasingly common on modern MySQL setups), errant transactions that were manually run on non-read-only replicas are more apparent and much easier to detect with automation. Still, I agree this could be improved to be less of a footgun for new users.
> My understanding is that mysql will also truncate data in a column if the column is altered to where a value would no longer fit (IE; from varchar(20) to varchar(8))
Your understanding is out of date. With strict sql mode (again, default since 2015) such an ALTER will fail loudly rather than truncate data.
Corruption in the sense of allowing data that is invalid ( clobbering valid data even on transaction error) is corruption by my definition.
>0000-00-00 will error upon insert by default since 2015
How many people have noticed they have invalid data only because of this change? how many people have avoided upgrading to 5.7 because of this change (and, admittedly other issues regarding the new revamped query planner which makes software like Zabbix slow to a crawl)... But, yes, it's a change in the right direction.
>MySQL replicas should be read-only
Ah, the old "it's not a footgun if you know better" argument.
> Corruption in the sense of allowing data that is invalid ( clobbering valid data even on transaction error) is corruption by my definition.
OK. Do you have any examples of a modern version of MySQL or InnoDB doing this?
> how many people have avoided upgrading to 5.7 because of this change
As I said, 5.7 just changed the default. This setting has been available since mysql 5.0.2 in early 2004 -- it just wasn't the default. Or you can use 5.7 and override the new default to get the old unsafe behavior. This change is absolutely a non-issue in terms of avoiding upgrades.
> other issues regarding the new revamped query planner which makes software like Zabbix slow to a crawl
I have heard of very few issues from the query planner improvements. Anecdotal, sure, but I am pretty "in the loop" fwiw.
> Ah, the old "it's not a footgun if you know better" argument.
How is that my argument? I directly said "I agree this could be improved to be less of a footgun for new users"!
The database won't force read_only for replicas because there are replication topologies (e.g. master-master) where nodes are replicating but also still need to be directly writable. These topologies are a bad practice (IMO) but nonetheless are used by enough places that MySQL cannot simply force read_only for replicas.
In any case, these days administrators who are completely unfamiliar with MySQL replication concepts should probably be using a DBaaS rather than setting up replication manually. The DBaaS platforms enforce read_only properly, making this all a non-issue.
> MySQL’s replication architecture means that if bugs do cause table corruption, the problem is unlikely to cause a catastrophic failure. Replication happens at the logical layer, so an operation like rebalancing a B-tree can never cause an index to become corrupted. A typical MySQL replication issue is the case of a statement being skipped (or, less frequently, applied twice). This may cause data to be missing or invalid, but it won’t cause a database outage.
So, data might be invalid or missing, but it will not cause a database outage...