I have migrated my production MySQL schema to Google Cloud SQL. Various modifications have been necessitated to existing Stored Procedures & Scheduled Events, and some new ones deployed. HOWEVER, I have been noticing that where I leave everything working at 6PM, by the time I arrive back at my desk next morning, many (all?) SP & Event alterations are rolled back to some earlier state to development, and all my routines are failing or going crazy. The Data itself does not appear to be affected or rolled back, and continuous new inserts are succeeding. I'm thinking that the automatic Backup / replication might be overwriting my SP & events. Anyone know how to control this? Thanks, -Paul
Please issue a FLUSH TABLES
after making changes to the stored procedures. That should decrease the chances of MyISAM tables not persisting a server restart.
Cloud SQL will never rollback your database unless you trigger it via a restore from backup. Usually when we see things that look like rollbacks, what's really happening is data loss at the MySQL level. This usually means one of two things is true:
- You're using MyISAM tables, data loss is possible. Switch to InnoDB as soon as you can. We now offer MySQL 5.6 instances if there was a feature that was holding you back from InnoDB.
- You're using InnoDB, but your code isn't running commits, so when the database does shut down, no data is committed, and it's lost.
If both of these things is true, please contact cloud-sql@google.com and we'll look into it further. Hope this helps!
来源:https://stackoverflow.com/questions/23930802/mysql-sps-and-events-being-automatically-rolled-back-by-google-cloud-sql