From 43a3036101135a606f9a5654adccae16f6339fa7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 28 Jan 2011 22:03:46 +0000 Subject: [PATCH] - back end: allow the specification of a read-only DB replica (in config.xml) to include DB name, user, and password. - back end: add read-only replica info to SCHED_CONFIG, so that C++ programs can use the replica (currently only PHP code can use it) - db_dump: use the read-only DB replica if it exists. svn path=/trunk/boinc/; revision=22958 --- checkin_notes | 704 +++++++++++++++++++++-------------------- html/inc/boinc_db.inc | 6 + html/inc/db.inc | 15 +- sched/db_dump.cpp | 8 +- sched/sched_config.cpp | 16 + sched/sched_config.h | 4 + 6 files changed, 401 insertions(+), 352 deletions(-) diff --git a/checkin_notes b/checkin_notes index f5777d510e..854e4ca710 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1,345 +1,359 @@ -David 1 Jan 2011 - - fix some bad file permissions - - delist defunct stats site - - clientgui/ - DlgItemProperties.cpp,h - AsynRPC.cpp - html/inc/ - stats_sites.inc - samples/ - wrapper/ - wrapper.cpp - example_app/ - uc2.cpp - client/ - sim_control.cpp - -David 2 Jan 2011 - - unix build: remove hardwired -ldl - - lib/ - Makefile.am - -David 3 Jan 2011 - - client: show a given system notice at most once a week - - client/ - client_msgs.cpp - sim_control.cpp - cs_notice.cpp - -Charlie 4 Jan 2010 - - Mac: Fix symbol table generation. - - mac_build/ - boinc.xcodeproj/ - project.pbxproj - -David 6 Jan 2011 - - user web: fix bugs in server status page - - fix some indentation - - html/user/ - server_status.php - client/ - *.cpp - -David 6 Jan 2011 - - simulator work - - fix some indentation - - various files - -David 11 Jan 2011 - - client: use std::deque instead of std::vector - for RR sim's pending-job lists. - Erasing head of vector is slow. - - lib: allow GPU peak FLOPS to be specified in XML (for simulator) - - simulator work - - client: old work fetch policy: projects may need enough jobs - for all device instances, not just resource_share*ninst. - E.g. a project that has only CPU jobs in a CPU/GPU client - - client: with REC scheduling, don't ask for work for - secondary resources if project has negative priority. - - client: in RR sim, make sure we saturate devices if possible. - Otherwise we may report a shortfall incorrectly - - client/ - coproc_detect.cpp - cpu_sched.cpp - rr_sim.cpp,h - sim.cpp - sim_control.php - sim_scenario.php (new) - work_fetch.cpp,h - lib/ - coproc.cpp,h - sched/ - sched_customize.cpp - sched_types.cpp - -David 11 Jan 2011 - - client: set PROJECT::last_upload_start when a job completes, - NOT when its first upload starts. - This prevents a scheduler RPC from happening between the two. - This was a bug in [22841] - - client/ - cs_apps.cpp - pers_file_xfer.cpp - -David 12 Jan 2011 - - client: tweak [22842] so that system clock changes - of < 60 seconds are ignored - - client/ - client_state.h - -Rom 12 Jan 2011 - - MGR: Embed the BOINC skin in the executable using XPM files. - - clientgui/res/skins/default/graphic/ - - clientgui/ - SkinManager.cpp - win_build/ - boincmgr.vcproj - -David 12 Jan 2011 - - single-job submission system: don't hardwire i686 architecture; - make it work on any Linux system. - From Steffen Moller. - - html/ops/ - single_job_setup.php - -Rom 13 Jan 2011 - - MGR: Disable the background repaint events for the SGUI Messages and - SGUI Preferences dialog. Changing the font color wasn't as easy as - I had hoped and the black background for the skin doesn't do any - good when the text itself is black as well. - - clientgui/ - sg_DlgMessages.cpp - sg_DlgPreferences.cpp - -David 13 Jan 2011 - - scheduler/client/API: pass user ID and team ID from scheduler to client, - and from client to app (host ID is already passed). - E@h asked for this, not sure why. - - client/ - client_types.cpp,h - app_start.cpp - lib/ - app_ipc.cpp,h - sched/ - sched_types.cpp - -Rom 13 Jan 2010 - - MGR: re-enable background painting and just change the default background - color for the new default skin to light gray. - - clientgui/ - sg_DlgMessages.cpp - sg_DlgPreferences.cpp - -Bernd 14 Jan 2011 - - unix build system: generate_svn_version - - generate version string from plain git repositories, too - - define SVN_REPOSITORY (URL) and SVN_REVISION (numerical) separately - so these could be used in proprocessor directives - - generate_svn_version.sh - -David 14 Jan 2011 - - make the Manager build on FC11 - - simulator work - - clientgui/ - Makefile.am - sched/ - edf_sim.cpp - client/ - sim.cpp - sim_control.php - -David 15 Jan 2011 - - client: fix job scheduling bug. - Scenario: we have 2 CPUs and 1GB RAM - Project A has jobs that use 1GB. - Project B has small-mem jobs. - Currently, we ignore RAM usage in building the runnable job list, - so we might pick 2 jobs from project A. - enforce_schedule() (which checks RAM usage) will run just one of them, - and the other CPU will be idle. - Solution: keep track of RAM usage while building the runnable job list. - client/ - cpu_sched.cpp - -David 15 Jan 2011 - - client: code cleanup in CPU scheduling; - eliminate global variable - - client/ - client_state.cpp,h - cpu_sched.cpp - sim.cpp - -Charlie 18 Jan 2011 - Mac: update release script to remove install of separate BOINC skin. - - mac_installer/ - release_boinc.sh - -David 18 Jan 2011 - - simulator work - - client/ - cpu_sched.cpp - work_fetch.h - sim.cpp - sim_control.cpp - client_types.cpp - -David 19 Jan 2011 - - client: eliminate unnecessary CPU reschedules. - Currently we do a reschedule any time a job checkpoints, - in case there's a job that has finished a time slice - but hasn't checkpointed yet. - Instead: flag such jobs, and trigger a reschedule - on checkpoint only for flagged jobs. - - client: fix instability in job scheduling that happens - if a job's estimated completion time in RR sim is close to its deadline. - It can alternate between making and missing deadline, - causing the scheduler to alternate rapidly between jobs. - Solution: if RR sim has marked a job as deadline miss - any time in the last (CPU scheduling period), - treat it as a deadline miss. - - client/ - app.cpp,h - rr_sim.cpp - app_control.cpp - cpu_sched.cpp - -David 19 Jan 2011 - - client: if we're using an acct mgr, - and we're attached to a project manually (not via acct mgr) - and the acct mgr tells us to detach from it, don't. - - client/ - acct_mgr.cpp - -David 19 Jan 2011 - - server: fix for EmBOINC - - sched/ - sched_util.cpp - -David 24 Jan 2011 - - server: disable upload certificates by default. - These increase server load and it's not clear they're needed. - - py/Boinc/ - setup_project.py - -Rom 25 Jan 2011 - - MGR: Fix advanced view button is Simple GUI. - (Button Text is Verdana 8pt. in MS Paint) - - clientgui/res/skins/default/graphic/ - advanced_link_image.xpm - clientgui/res/templates/skins/ - advanced_link_image.gif (Added) - btnAdvancedView.png (Removed) - -David 25 Jan 2011 - - client: accept and in cc_config.xml - - client: reset log flags (as well as options) when rereading cc_config.xml - - client/ - log_flags.cpp,h - -David 25 Jan 2011 - - web: tweaks so that BOINC-Wide Teams site can warn people if - their email address is not validated - - html/ - inc/ - user.inc - user/ - edit_email_action.php - -Charlie 27 Jan 2011 - Mac: update Mac_SA_Insecure.sh script to not require BOIN Client in - BOINC Data folder. - - mac_build/ - Mac_SA_Insecure.sh - -Charlie 27 Jan 2011 - - MGR: Add new Simple GUI. - - clientgui/ - AdvancedFrame.cpp, .h - BOINCGUIApp.cpp, .h - Events.h - sg_BoincSimpleFrame.cpp, .h (new) - sg_CustomControls.cpp, .h - sg_TaskPanel.cpp, .h (new) - sg_PanelBase.cpp, .h (new) - sg_ProjectCommandPopup.cpp, .h (new) - sg_ProjectPanel.cpp, .h (new) - sg_ProjectWebSitesPopup.cpp, .h (new) - sg_TaskCommandPopup.cpp, .h (new) - SkinManager.cpp - mac/ - MacBitmapComboBox.cpp, .h (new) - res/ - RedDot16.xpm (new) - YellowDot16.xpm (new) - GreenDot16.xpm (new) - mac_build/ - boinc.xcodeproj/ - project.pbxproj - win_build/ - boincmgr.vcproj - -David 27 Jan 2011 - - client: fix bug in setting GPU peak flops - - client/ - coproc_detect.cpp - lib/ - coproc.cpp,h - -Charlie 28 Jan 2011 - - MGR: Fix default skin selection display in Simple Preferences - dialog. - - MGR: Use standard native buttons in Simple Preferences and - Simple Notices dialogs. - - MGR: Use our control IDs instead of wxID_HELP for Help buttons - for Mac accessibility (wxID_HELP makes a bitmap button on - Macs which VoiceOver screen reader can't read.) - - MGR: Disable tooltips on Mac while new simple GUI menus are - popped up because they cover menus. - - clientgui/ - DlgAdvPreferences.cpp - DlgAdvPreferencesBase.cpp - sg_BoincSimpleFrame.cpp - sg_DlgMessages.cpp - sg_DlgPreferences.cpp - sg_ProjectCommandPopup.cpp - sg_ProjectWebSitesPopup.cpp - sg_TaskCommandPopup.cpp - wizardex.cpp - SkinManager.cpp - mac/ - MacBitmapComboBox.cpp, .h - mac_build/ - boinc.xcodeproj/ - project.pbxproj - \ No newline at end of file +David 1 Jan 2011 + - fix some bad file permissions + - delist defunct stats site + + clientgui/ + DlgItemProperties.cpp,h + AsynRPC.cpp + html/inc/ + stats_sites.inc + samples/ + wrapper/ + wrapper.cpp + example_app/ + uc2.cpp + client/ + sim_control.cpp + +David 2 Jan 2011 + - unix build: remove hardwired -ldl + + lib/ + Makefile.am + +David 3 Jan 2011 + - client: show a given system notice at most once a week + + client/ + client_msgs.cpp + sim_control.cpp + cs_notice.cpp + +Charlie 4 Jan 2010 + - Mac: Fix symbol table generation. + + mac_build/ + boinc.xcodeproj/ + project.pbxproj + +David 6 Jan 2011 + - user web: fix bugs in server status page + - fix some indentation + + html/user/ + server_status.php + client/ + *.cpp + +David 6 Jan 2011 + - simulator work + - fix some indentation + + various files + +David 11 Jan 2011 + - client: use std::deque instead of std::vector + for RR sim's pending-job lists. + Erasing head of vector is slow. + - lib: allow GPU peak FLOPS to be specified in XML (for simulator) + - simulator work + - client: old work fetch policy: projects may need enough jobs + for all device instances, not just resource_share*ninst. + E.g. a project that has only CPU jobs in a CPU/GPU client + - client: with REC scheduling, don't ask for work for + secondary resources if project has negative priority. + - client: in RR sim, make sure we saturate devices if possible. + Otherwise we may report a shortfall incorrectly + + client/ + coproc_detect.cpp + cpu_sched.cpp + rr_sim.cpp,h + sim.cpp + sim_control.php + sim_scenario.php (new) + work_fetch.cpp,h + lib/ + coproc.cpp,h + sched/ + sched_customize.cpp + sched_types.cpp + +David 11 Jan 2011 + - client: set PROJECT::last_upload_start when a job completes, + NOT when its first upload starts. + This prevents a scheduler RPC from happening between the two. + This was a bug in [22841] + + client/ + cs_apps.cpp + pers_file_xfer.cpp + +David 12 Jan 2011 + - client: tweak [22842] so that system clock changes + of < 60 seconds are ignored + + client/ + client_state.h + +Rom 12 Jan 2011 + - MGR: Embed the BOINC skin in the executable using XPM files. + + clientgui/res/skins/default/graphic/ + + clientgui/ + SkinManager.cpp + win_build/ + boincmgr.vcproj + +David 12 Jan 2011 + - single-job submission system: don't hardwire i686 architecture; + make it work on any Linux system. + From Steffen Moller. + + html/ops/ + single_job_setup.php + +Rom 13 Jan 2011 + - MGR: Disable the background repaint events for the SGUI Messages and + SGUI Preferences dialog. Changing the font color wasn't as easy as + I had hoped and the black background for the skin doesn't do any + good when the text itself is black as well. + + clientgui/ + sg_DlgMessages.cpp + sg_DlgPreferences.cpp + +David 13 Jan 2011 + - scheduler/client/API: pass user ID and team ID from scheduler to client, + and from client to app (host ID is already passed). + E@h asked for this, not sure why. + + client/ + client_types.cpp,h + app_start.cpp + lib/ + app_ipc.cpp,h + sched/ + sched_types.cpp + +Rom 13 Jan 2010 + - MGR: re-enable background painting and just change the default background + color for the new default skin to light gray. + + clientgui/ + sg_DlgMessages.cpp + sg_DlgPreferences.cpp + +Bernd 14 Jan 2011 + - unix build system: generate_svn_version + - generate version string from plain git repositories, too + - define SVN_REPOSITORY (URL) and SVN_REVISION (numerical) separately + so these could be used in proprocessor directives + + generate_svn_version.sh + +David 14 Jan 2011 + - make the Manager build on FC11 + - simulator work + + clientgui/ + Makefile.am + sched/ + edf_sim.cpp + client/ + sim.cpp + sim_control.php + +David 15 Jan 2011 + - client: fix job scheduling bug. + Scenario: we have 2 CPUs and 1GB RAM + Project A has jobs that use 1GB. + Project B has small-mem jobs. + Currently, we ignore RAM usage in building the runnable job list, + so we might pick 2 jobs from project A. + enforce_schedule() (which checks RAM usage) will run just one of them, + and the other CPU will be idle. + Solution: keep track of RAM usage while building the runnable job list. + client/ + cpu_sched.cpp + +David 15 Jan 2011 + - client: code cleanup in CPU scheduling; + eliminate global variable + + client/ + client_state.cpp,h + cpu_sched.cpp + sim.cpp + +Charlie 18 Jan 2011 + Mac: update release script to remove install of separate BOINC skin. + + mac_installer/ + release_boinc.sh + +David 18 Jan 2011 + - simulator work + + client/ + cpu_sched.cpp + work_fetch.h + sim.cpp + sim_control.cpp + client_types.cpp + +David 19 Jan 2011 + - client: eliminate unnecessary CPU reschedules. + Currently we do a reschedule any time a job checkpoints, + in case there's a job that has finished a time slice + but hasn't checkpointed yet. + Instead: flag such jobs, and trigger a reschedule + on checkpoint only for flagged jobs. + - client: fix instability in job scheduling that happens + if a job's estimated completion time in RR sim is close to its deadline. + It can alternate between making and missing deadline, + causing the scheduler to alternate rapidly between jobs. + Solution: if RR sim has marked a job as deadline miss + any time in the last (CPU scheduling period), + treat it as a deadline miss. + + client/ + app.cpp,h + rr_sim.cpp + app_control.cpp + cpu_sched.cpp + +David 19 Jan 2011 + - client: if we're using an acct mgr, + and we're attached to a project manually (not via acct mgr) + and the acct mgr tells us to detach from it, don't. + + client/ + acct_mgr.cpp + +David 19 Jan 2011 + - server: fix for EmBOINC + + sched/ + sched_util.cpp + +David 24 Jan 2011 + - server: disable upload certificates by default. + These increase server load and it's not clear they're needed. + + py/Boinc/ + setup_project.py + +Rom 25 Jan 2011 + - MGR: Fix advanced view button is Simple GUI. + (Button Text is Verdana 8pt. in MS Paint) + + clientgui/res/skins/default/graphic/ + advanced_link_image.xpm + clientgui/res/templates/skins/ + advanced_link_image.gif (Added) + btnAdvancedView.png (Removed) + +David 25 Jan 2011 + - client: accept and in cc_config.xml + - client: reset log flags (as well as options) when rereading cc_config.xml + + client/ + log_flags.cpp,h + +David 25 Jan 2011 + - web: tweaks so that BOINC-Wide Teams site can warn people if + their email address is not validated + + html/ + inc/ + user.inc + user/ + edit_email_action.php + +Charlie 27 Jan 2011 + Mac: update Mac_SA_Insecure.sh script to not require BOIN Client in + BOINC Data folder. + + mac_build/ + Mac_SA_Insecure.sh + +Charlie 27 Jan 2011 + - MGR: Add new Simple GUI. + + clientgui/ + AdvancedFrame.cpp, .h + BOINCGUIApp.cpp, .h + Events.h + sg_BoincSimpleFrame.cpp, .h (new) + sg_CustomControls.cpp, .h + sg_TaskPanel.cpp, .h (new) + sg_PanelBase.cpp, .h (new) + sg_ProjectCommandPopup.cpp, .h (new) + sg_ProjectPanel.cpp, .h (new) + sg_ProjectWebSitesPopup.cpp, .h (new) + sg_TaskCommandPopup.cpp, .h (new) + SkinManager.cpp + mac/ + MacBitmapComboBox.cpp, .h (new) + res/ + RedDot16.xpm (new) + YellowDot16.xpm (new) + GreenDot16.xpm (new) + mac_build/ + boinc.xcodeproj/ + project.pbxproj + win_build/ + boincmgr.vcproj + +David 27 Jan 2011 + - client: fix bug in setting GPU peak flops + + client/ + coproc_detect.cpp + lib/ + coproc.cpp,h + +Charlie 28 Jan 2011 + - MGR: Fix default skin selection display in Simple Preferences + dialog. + - MGR: Use standard native buttons in Simple Preferences and + Simple Notices dialogs. + - MGR: Use our control IDs instead of wxID_HELP for Help buttons + for Mac accessibility (wxID_HELP makes a bitmap button on + Macs which VoiceOver screen reader can't read.) + - MGR: Disable tooltips on Mac while new simple GUI menus are + popped up because they cover menus. + + clientgui/ + DlgAdvPreferences.cpp + DlgAdvPreferencesBase.cpp + sg_BoincSimpleFrame.cpp + sg_DlgMessages.cpp + sg_DlgPreferences.cpp + sg_ProjectCommandPopup.cpp + sg_ProjectWebSitesPopup.cpp + sg_TaskCommandPopup.cpp + wizardex.cpp + SkinManager.cpp + mac/ + MacBitmapComboBox.cpp, .h + mac_build/ + boinc.xcodeproj/ + project.pbxproj + +David 28 Jan 2011 + - back end: allow the specification of a read-only DB replica + (in config.xml) to include DB name, user, and password. + - back end: add read-only replica info to SCHED_CONFIG, + so that C++ programs can use the replica + (currently only PHP code can use it) + - db_dump: use the read-only DB replica if it exists. + + html/inc/ + boinc_db.inc + db.inc + sched/ + sched_config.cpp,h + db_dump.cpp diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index 679a90e43c..6fd6de8975 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -40,6 +40,12 @@ class BoincDb extends DbConn { } $instance = new DbConn(); if ($readonly && $replica_host) { + $x = parse_config($config, ''); + if ($x) $user = $x; + $x = parse_config($config, ''); + if ($x) $passwd = $x; + $x = parse_config($config, ''); + if ($x) $name = $x; $retval = $instance->init_conn($user, $passwd, $replica_host, $name); if ($retval) { self::$instance = $instance; diff --git a/html/inc/db.inc b/html/inc/db.inc index 17db43db55..ae7617cc6a 100644 --- a/html/inc/db.inc +++ b/html/inc/db.inc @@ -26,9 +26,19 @@ function db_init_aux($try_replica=false) { $config = get_config(); $user = parse_config($config, ""); $pass = parse_config($config, ""); + $db_name = parse_config($config, ""); $host = null; - if ($try_replica == true) { - $host = parse_config($config, ""); + if ($try_replica) { + $x = parse_config($config, ""); + if ($x) { + $host = $x; + $x = parse_config($config, ""); + if ($x) $user = $x; + $x = parse_config($config, ""); + if ($x) $pass = $x; + $x = parse_config($config, ""); + if ($x) $db_name = $x; + } } if ($host == null) { $host = parse_config($config, ""); @@ -40,7 +50,6 @@ function db_init_aux($try_replica=false) { if (!$link) { return 1; } - $db_name = parse_config($config, ""); if (!mysql_select_db($db_name, $link)) { echo "selecting $db_name\n"; return 2; diff --git a/sched/db_dump.cpp b/sched/db_dump.cpp index 96c3e9cdd6..a0059a43bb 100644 --- a/sched/db_dump.cpp +++ b/sched/db_dump.cpp @@ -838,10 +838,10 @@ int main(int argc, char** argv) { exit(1); } retval = boinc_db.open( - config.db_name, - db_host?db_host:config.db_host, - config.db_user, - config.db_passwd + config.replica_db_name, + db_host?db_host:config.replica_db_host, + config.replica_db_user, + config.replica_db_passwd ); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't open DB\n"); diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index e6355a0356..084ef58e91 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -101,6 +101,18 @@ int SCHED_CONFIG::parse(FILE* f) { char hostname[256]; gethostname(hostname, 256); if (!strcmp(hostname, db_host)) strcpy(db_host, "localhost"); + if (!strlen(replica_db_host)) { + strcpy(replica_db_host, db_host); + } + if (!strlen(replica_db_name)) { + strcpy(replica_db_name, db_name); + } + if (!strlen(replica_db_user)) { + strcpy(replica_db_user, db_user); + } + if (!strlen(replica_db_passwd)) { + strcpy(replica_db_passwd, db_passwd); + } return 0; } if (xp.parse_str(tag, "master_url", master_url, sizeof(master_url))) continue; @@ -109,6 +121,10 @@ int SCHED_CONFIG::parse(FILE* f) { if (xp.parse_str(tag, "db_user", db_user, sizeof(db_user))) continue; if (xp.parse_str(tag, "db_passwd", db_passwd, sizeof(db_passwd))) continue; if (xp.parse_str(tag, "db_host", db_host, sizeof(db_host))) continue; + if (xp.parse_str(tag, "replica_db_name", replica_db_name, sizeof(replica_db_name))) continue; + if (xp.parse_str(tag, "replica_db_user", replica_db_user, sizeof(replica_db_user))) continue; + if (xp.parse_str(tag, "replica_db_passwd", replica_db_passwd, sizeof(replica_db_passwd))) continue; + if (xp.parse_str(tag, "replica_db_host", replica_db_host, sizeof(replica_db_host))) continue; if (xp.parse_str(tag, "project_dir", project_dir, sizeof(project_dir))) continue; if (xp.parse_int(tag, "shmem_key", shmem_key)) continue; if (xp.parse_str(tag, "key_dir", key_dir, sizeof(key_dir))) continue; diff --git a/sched/sched_config.h b/sched/sched_config.h index 9766c8d989..92d40a8ba5 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -47,6 +47,10 @@ struct SCHED_CONFIG { char db_user[256]; char db_passwd[256]; char db_host[256]; + char replica_db_name[256]; + char replica_db_user[256]; + char replica_db_passwd[256]; + char replica_db_host[256]; int shmem_key; char project_dir[256]; char key_dir[256];