provider-sql icon indicating copy to clipboard operation
provider-sql copied to clipboard

fix: remove unneeded flush privileges call for mysql #141

Open mariusziemke opened this issue 2 years ago • 6 comments

Description of your changes

Fixes #141

According to mysql documentation executing FLUSH PRIVILEGES is only required If you modify the grant tables directly using statements such as INSERT, UPDATE, or DELETE (which is not recommended), the changes have no effect on privilege checking until you either tell the server to reload the tables or restart it. (dev.mysql.com/doc/refman/8.0/en/privilege-changes.html). Other references:

stackoverflow.com/questions/36463966/mysql-when-is-flush-privileges-in-mysql-really-needed docs.pingcap.com/tidb/dev/sql-statement-flush-privileges

I have:

  • [x] Read and followed Crossplane's contribution process.
  • [x] Run make reviewable to ensure this PR is ready for review.

How has this code been tested

The change has been running in our various dev and production environments for a few weeks now. We tried to break our database clusters by adding and removing lots of users concurrently and everything works as expected. Before removing the Flush Privileges call we had a lot of trouble in our replicated db setup which tried to protect itself from inconsistency by just shutting down after adding more then one user at the same time.

mariusziemke avatar Aug 22 '23 11:08 mariusziemke

Hi, can anyone look into this PR? Thanks!

mariusziemke avatar Oct 04 '23 10:10 mariusziemke

We are interested on this fix because we have issue with our percona xtradb cluster witch can be stuck because of FLUSH PRIVILEGES. Thanks in advance for the reviewer(s).

Jibux avatar Jan 30 '24 13:01 Jibux

Also interested for having this merged for the next release, thanks in advance.

fgaillot-qosenergy avatar Jan 31 '24 13:01 fgaillot-qosenergy

Would you mind rebasing?

Duologic avatar Jun 10 '24 08:06 Duologic

@Duologic done.

mariusziemke avatar Jun 10 '24 13:06 mariusziemke

Ah sorry, missed that this would conflict with #171, this might even simplify it more.

Duologic avatar Jun 24 '24 20:06 Duologic