4 ms·
The technique described in the article would fail if you'd have instances of different versions of software each expecting different version of database to conn
by unnouinceput 8y ago
The technique described in the article would fail if you'd have instances of different versions of software each expecting different version of database to connect to in a distributed database environment. So let me tell you how I did it. So my client was running multiple venues each having a database with local records and the client (meaning the CEO, the company board, and middle managers too, so in total more then 100 people running the software on their laptop) would connect to one venue or even to multiple venues at once to get reports of what is going on. So downtime of the venues was out of the question.
Also some of them would have some other problems to solve and would fire up the software on their laptop even a month later, meaning the venues would already have different DB schema. So to solve this I've done the following:
-each venue would have a table for SQL statements to upgrade the software local database. Also this would specify what schema No is current one.
-each venue would have a table for software upgrades, that's it inside a blob field the software was there for that specific version.
The software on client laptops would also have a local database, used for aggregating reports from multiple venues mainly, but also to automatically perform a venue DB schema upgrade if required:
-a table with SQL statements to upgrade the connected venue schema DB to latest one.
-a table the software upgrades, the same blob as described above.
So, when the CTO (usually he was the one receiving the latest and the greatest) would get a new software version from DevOps, he would basically receive it by connecting his software to my DevOps DB. The software on his laptop would see that it has lower number than the connected DB schema No, access the upgrading fields, get the new software version in a temporary file and restart the software. The restart process would upgrade the software from that temporary file, run the necessary SQL commands to modify the local DB as well, if it was the case and launch the software with the latest upgrade. Now the CTO would connect to multiple venues, usually by just asking for the daily report on those and for each connected venue the software would see the connected venues schema No are older. Would run the necessary SQL commands to upgrade those venues, pushing the software latest blob as well and then get the records to compile the actual report. When the other members would connect to those upgraded venues they would receive the latest software as well same as the CTO received from my DevOps one. This ripple effect of upgrading software and schema was done without a single second of downtime from those venues.
Also the venues did ran a local software on their own, which was also restarted and upgraded as soon as it was detecting the changes, in the same fashion as the software on the client laptops was upgraded. In practice, since the venues were scattered around US and Mexico from Boston all the way down to California and Mexico City, took around 30 seconds each, as they were all connected through VPN. So the most downtime was experienced by CTO for like 2 hours (~100 venues), and usually the guy would do this during lunch leaving the laptop to do this while he was attending other matters. The rest were only seeing the message "Upgrade in progress, please wait" for only 30 seconds and was very acceptable. Also the local venue software was less then 5 seconds with this message up, since it was connecting to a local DB, not over VPN.
I did this in 2010, and while I departed in 2015 from that company this methodology is still in use without hiccups today by them.