It seems to me that in case of DB migration being required process should look like:
- First HA should try to estimate how long it could take to migrate DB (not sure how, but perhaps performing few sample record changes on temporary created ‘test’ tables?) and evaluating number of records in DB. This should give at least some order of magnitude view on how long the process might take for particular setup.
- Then we should be given options:
a) Migrate to new DB, discarding all of historical data, but process would be instant.
b) Migrate with DB being converted in background, X hours of data will be lost during conversion. HA starts instantly and no service disruption. Data starts to recorded once DB update is completed.
c) Perform full migration, no data lost but HA not available for X hours.
Strangely difference between option b) and c) is that while we anyhow loose X hours of data (either data not being recorded during conversion or HA not working at all), but we have or not HA providing us with some core services… so my preference anyhow would be to start HA and agree to some data loss
Another question to DB gurus… would below process work?
- at start of conversion HA renames old tables to not use them for data recording.
- creates new tables, with new structure in the same DB instance, with old names
- HA starts recording new info instantly to new tables
- background process reads data from old tables, converts as required and writes to new tables
- old tables are deleted after completion
This way we have no data loss and HA services available during conversion. I’m not sure about consistency of data for some queries, if only recent data is available, but historical might be incomplete.
And another side remark. during my ~2 years journey with HA it is only second time that I recall when DB structure was updated. First time it was ~30 minutes for me (but then my setup was way simpler). So with this frequency of DB changes I’m not really sure if this situation shouldn’t be just accpted. If it would be repeated every HA update, this would be another story.
It would obviously help to change wording from ‘could take few minutes’ to ‘could take several hours’, just to set proper expectations At least this could easy stress related to not knowing what is going on… if this is still conversion or something failed…