-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to address a second replica DB "replica2" in the web code #5695
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be a few logic issues in get_aux()
, at least when comparing code vs. comments. Eg. original lines:
- 39 vs. 60: should not error out for
fallback_mode = 1
- 69 vs. 75: the else block doesn't imply
fallback_mode == 0
, if(!$u || !$p || !$n) == false
- 69 vs. 80: likewise,
fallback_mode == 0
isn't guaranteed here. If so, does the logic really represent the logic described for the three fallback modes?
I know these issues are independent of this PR but they need fixing anyway (if I'm not mistaken).
html/inc/boinc_db.inc
Outdated
@@ -63,11 +69,21 @@ class BoincDb extends DbConn { | |||
self::$instance = $instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh, GitHub doesn't let me comment outside of change contexts 🤦♂️ ...
The error_log
two lines above should distinguish between <replica_db_host>
and <replica2_db_host>
or use <replica[2]_db_host>
instead (if that's not too confusing).
@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 Thanks |
The logic in get_aux() is too complex. Is $fallback_mode needed? I can't find any place that uses it.
|
The fallback_mode was introduced by Christian in 2015, see 3481806 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, |
You mean #5697 |
Remove the 'use $db_name' query; don't need that with mysqli
8285a9d
to
255aa04
Compare
255aa04
to
7410470
Compare
I just pushed a new version of the branch that takes David's commits from #5697 and applies a few changes:
|
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 |
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.