Running make refresh induces downtime of about ~2 minutes. This is annoying when refreshing staging servers. The idea of this PR is to create a _temp database, load it and then swap with the original. Unfortunately, there's no RENAME DATABASE command in MySQL and we have to rename it table by table (and recreate views).
how about spinning up another server in a different data directory, loading into that, then shutting down the first mysql server and removing it's data directory and starting the second one?
The more longterm option would be we give all tables uuids and timestamps where they are missing and then change the refresh code to upsert missing rows and delete obsolete ones
Note that owid user on staging cannot create a database. We have to change its privileges in ops to
mysql> GRANT ALL PRIVILEGES ON *.* TO 'owid'@'%';
mysql> FLUSH PRIVILEGES;
SVG tester:
Number of differences (default views): 1264 ([f285de](https://github.com/owid/owid-grapher-svgs/commit/f285deb54690ca80356ed7438b75a9363ca72ac9)) ❌
Number of differences (all views): 531 ([b8e7fe](https://github.com/owid/owid-grapher-svgs/commit/b8e7fe2b0cb1bd6ba9e5a19533e1dd65a1024bdc)) ❌
Running
make refresh
induces downtime of about ~2 minutes. This is annoying when refreshing staging servers. The idea of this PR is to create a_temp
database, load it and then swap with the original. Unfortunately, there's noRENAME DATABASE
command in MySQL and we have to rename it table by table (and recreate views).See slack
Other potential solutions:
Note that
owid
user on staging cannot create a database. We have to change its privileges in ops to