Topic: Database fallback mechanism?

It might not be a new idea  - or even a good one - but what if we could have a fallback mechanism
that tries to switch from MySQL to a SQLite backup if the databaseserver is down?
Perhaps someone agrees that it would be a nice feature to have in Wolf.

Re: Database fallback mechanism?

Not sure how this would work efficiently. MySQL and SQL Lite are stored differently, so to have this featured would mean keeping two databases up to date in case one went down. Obviously this increases overheads which aren't really needed.

I guess one thing that could be implemented would be a function that would email you if it can't connect to the database. You at least have the warning then and if you've taken regular backups you should be alright.

But like I said i don't think it would be efficient to implement this fallback mechanism, i may be proven wrong however....

Re: Database fallback mechanism?

snsmurf wrote:

Not sure how this would work efficiently. MySQL and SQL Lite are stored differently, so to have this featured would mean keeping two databases up to date in case one went down. Obviously this increases overheads which aren't really needed.

I guess one thing that could be implemented would be a function that would email you if it can't connect to the database. You at least have the warning then and if you've taken regular backups you should be alright.

But like I said i don't think it would be efficient to implement this fallback mechanism, i may be proven wrong however....

Well since its a fallback mechanism it should only come to action when no connection can be made
with the MySQL databaseserver so as for overhead I really don't think its a problem.
Offcourse it could be made the other way around to, based on what database was choosen during install. There are tools to convert MySQL to SQL Lite, that saves a lot of time.
Especially on external hosting it makes sence to have such a mechanism, it would be a serious thing to consider.

I keep it here for now because I like to know other users opinions, later it could be requested as a new feature smile

Last edited by Fortron (2010-01-21 22:17)

Re: Database fallback mechanism?

Tuupola's Funky Cache plugin should provide a fallback of the non-database-at-all variety. I've not tried it without a database personally, but it would (or could be made to) work in theory.

Then you would just want a way to handle dynamic content that requires a database connection. That said, you could always use a different server and default to that database as a fallback if a database was paramount!?

Just my 10c worth.

Last edited by BlueWolf (2010-01-21 22:56)

Thumbs up

Re: Database fallback mechanism?

BlueWolf wrote:

Tuupola's Funky Cache plugin should provide a fallback of the non-database-at-all variety. I've not tried it without a database personally, but it would (or could be made to) work in theory.

Then you would just want a way to handle dynamic content that requires a database connection. That said, you could always use a different server and default to that database as a fallback if a database was paramount!?

Just my 10c worth.

Well if one has the luxury to use a different server then such a feature is likely less important,
but most users probally do not have that luxury.

Re: Database fallback mechanism?

Fortron wrote:

Well since its a fallback mechanism it should only come to action when no connection can be made
with the MySQL databaseserver so as for overhead I really don't think its a problem.

I meant with regards to the admin side, when you update a page, settings, user etc... the change would have to connect to both databases and update them both to keep them up to date.

Unless, a cron was used to back up to the backup database every night, then it's best of both worlds nearly. The backup may not be 100% up to date but would be up to date enough to run the site.

The cache method BlueWolf mentioned, again in theory would work but by my understanding of it, considerable changes would need to be made in order to be able to revert to these cached files AND allow you to still be able to login / update and manage the site as thought it running of a database. You've then also got problems of, changes made into the cached version, what happens when the database comes back online, there would have to be a way to sync them.

His last suggestion was probably the best on so far, just get another mysql server and keep it up to date.
Manually changing the connection details would also probably be the quickest way.

At the end of the day, all of these are (probably) implementable (if that's a word) it's just whether it would be feasible for it to be put into Wolf and whether or not it would clash with the project goals. Would be up to Martijn, if he feels it's a feature worth adding / whether it would be feasible. My suggestion would be to add it to the issue list as a possible feature, and take it from there.

http://code.google.com/p/wolfcms/issues/list

Re: Database fallback mechanism?

While theoretically nice, I think it would likely create too much overhead if you keep both databases in sync at the same time.

If you're using a less intensive fall back method like nightly backups, there's not really a good reason for Wolf CMS to support automatic restore/fall back natively. Why? Well, let me explain:

- If something goes disastrously wrong, there is usually a good reason and you would want to check the system manually.
- A nightly backup would be missing information, especially on a high load site. (which would confuse/anger users)
- You might want to put back an older backup because your nightly backup might be corrupted as well. (imagine a DB server that has "hiccups")
- How do you detect if a DB server is down... and when do you switch? Automatically after the first downtime? What if it comes back up after 5-10 seconds?

and lastly: my expectation is that hosting providers already run a DB cluster and have hot standby backup nodes available in case something goes wrong... smile

Just a couple of thoughts... smile

Wolf CMS founder and lead developer
Please always check the Support forums and Wiki before asking. (My Ohloh account.)
Like Wolf CMS? Consider making a financial contribution or see our financial report first.