boinc
boinc copied to clipboard
Allow to address a second replica DB "replica2" in the web code
The current server setup of Einstein@Home uses two replicas. This patch is to allow accessing the second replica in the web code by calling get_aux(2); get_aux(1) or get_aux(true) still addresses the standard replica.
For this to work, config.xml needs to have a second set of tags "<replica2_db_(host|name|user|password)>" analog to the current "<replica_db_(host|name|user|password)>".
This code will probably never be used by anyone else, it's just to bring upstream BOINC in sync with the web code that we're using on E@H for easier updates.
@davidpanderson, could you please take a look at this PR?
Also, thanks to @RichardHaselgrove, we should make sure the docs get updated.
@davidpanderson while at it, please note that that doc contains a lot of syntax errors, presumably by a flawed trac -> markdown conversion. Just search for \< in it to see what I mean.
Thanks
The logic in get_aux() is too complex. I'd prefer to clean it up (and handle replica2 in the process)
Is $fallback_mode needed? I can't find any place that uses it. It would be simpler if we assume that
- each replica has its own user/host/passwd in config.xml
- if connection to replica 1 or 2 fails, use main DB
The fallback_mode was introduced by Christian in 2015, see 3481806b6d418c0a33be08166f007d3de539b89c No idea (anymore) what it was used for, or in which projects, or which projects would break now if it was removed.
I added support for multiple readonly replicas in #5695, using the same <replica2_db_host> config syntax. This PR also greatly simplifies the get_aux() logic. Please see if it works for you.
You mean #5697
I just pushed a new version of the branch that takes David's commits from #5697 and applies a few changes:
- Hiding a change that affects the whole web code ("use mysqli everywhere") in another commit with very limited scope and not even mentioning it in the commit message is just asking for trouble.. So I split that commit in two (leaving the author intact).
- I added commit d1f99043877552ea48ac2912dc4ec9ac9a1efdddI mentioned above that is required to make this work for us. It allows to address multiple DB hosts in sequence.
- I also changed the debug output to suit my needs, then reverted it. You can re-add it by reverting the 'Revert' commit if needed.
What's the use case? i.e. why would you need to access one replica, then another?
Different parts of the system use different replicas to spread the load and we're also showing the replication lag (of both replicas) on the SSP such that people can judge whether all data they see is up to date.
Actually the server status page where we show the status of all the replicas is the only case where we need to access all of these on the same page. With a bit of internal caching it should be possible to make sure there's only one connection open at a time, but I didn't think about that initially.
Closing this since #5697 was already merged to master