From 45b76a218081e6a1dee7683abf4aa485ac465fa8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 24 Sep 2004 20:48:07 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4238 --- checkin_notes | 19 +++++++++++++++++++ db/db_base.C | 10 +++++++--- db/db_base.h | 2 +- sched/db_dump.C | 19 +++++++++++++++---- sched/handle_request.C | 2 +- 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/checkin_notes b/checkin_notes index 850f174edf..50973cf0c6 100755 --- a/checkin_notes +++ b/checkin_notes @@ -17689,5 +17689,24 @@ David 24 Sept 2004 This required adding the set of CORE_VERSIONs to shared mem sched/ + handle_request.C sched_config.C,h sched_shmem.C,h + +David 24 Sept 2004 + - db_dump: use mysql_use_result() instead of mysql_store_result() + for the enumeration of users. + Otherwise it has to store the entire result set in memory, + which could be prohibitive. + NOTE: still have to use mysql_store_result() for hosts + because of the user lookup to get show_hosts flag. + Could deal with this by doing a join. + - added use_use_result arg to DB_BASE::enumerate() (default false) + - change printfs to log_messages.printf in db_dump + - db_dump: don't show user host list + (can't do this if use mysql_use_result()) + + db/ + db_base.C,h + sched/ + db_dump.C diff --git a/db/db_base.C b/db/db_base.C index a08423365a..4080893239 100644 --- a/db/db_base.C +++ b/db/db_base.C @@ -183,7 +183,7 @@ int DB_BASE::lookup_id(int id) { return 0; } -int DB_BASE::enumerate(char* clause) { +int DB_BASE::enumerate(char* clause, bool use_use_result) { int x; char query[MAX_QUERY_LEN]; MYSQL_ROW row; @@ -200,10 +200,14 @@ int DB_BASE::enumerate(char* clause) { x = db->do_query(query); if (x) return mysql_errno(db->mysql); - // can't use mysql_use_results() here; if you do, + // if you use mysql_use_result() here, // any other transactions will fail // - cursor.rp = mysql_store_result(db->mysql); + if (use_use_result) { + cursor.rp = mysql_use_result(db->mysql); + } else { + cursor.rp = mysql_store_result(db->mysql); + } if (!cursor.rp) return mysql_errno(db->mysql); } row = mysql_fetch_row(cursor.rp); diff --git a/db/db_base.h b/db/db_base.h index 4edceec1a7..cbce13d7fe 100644 --- a/db/db_base.h +++ b/db/db_base.h @@ -86,7 +86,7 @@ public: int get_field_int(char*, int&); int lookup_id(int id); int lookup(char*); - int enumerate(char* clause=""); + int enumerate(char* clause="", bool use_use_result=false); int end_enumerate(); int count(int&, char* clause=""); int sum(double&, char* field, char* clause=""); diff --git a/sched/db_dump.C b/sched/db_dump.C index 28d12e4a8d..56ca4a2830 100644 --- a/sched/db_dump.C +++ b/sched/db_dump.C @@ -127,11 +127,17 @@ int OUTPUT::parse(FILE* in) { } else if (!strcmp(buf2, "zip")) { compression = COMPRESSION_ZIP; } else { - printf("unrecognized: %s", buf); + log_messages.printf( + SCHED_MSG_LOG::CRITICAL, + "unrecognized compression type: %s", buf + ); } continue; } - printf("unrecognized: %s", buf); + log_messages.printf( + SCHED_MSG_LOG::CRITICAL, + "OUTPUT::parse: unrecognized: %s", buf + ); } return ERR_XML_PARSE; } @@ -213,7 +219,10 @@ public: f = fopen(filename, "w"); if (!f) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, "db_dump: Couldn't open %s for output\n", filename); + log_messages.printf( + SCHED_MSG_LOG::CRITICAL, + "Couldn't open %s for output\n", filename + ); } fprintf(f, "\n<%s>\n", tag.c_str() @@ -396,6 +405,7 @@ void write_user(USER& user, FILE* f, bool detail) { " \n" ); } +#if 0 if (detail && user.show_hosts) { sprintf(buf, "where userid=%d", user.id); while (!host.enumerate(buf)) { @@ -404,6 +414,7 @@ void write_user(USER& user, FILE* f, bool detail) { } } } +#endif fprintf(f, "\n" ); @@ -630,7 +641,7 @@ int ENUMERATION::make_it_happen(char* output_dir) { switch(table) { case TABLE_USER: n = 0; - while (!user.enumerate(clause)) { + while (!user.enumerate(clause, true)) { for (i=0; iversion_num > req_version) { sprintf(reply.message, - "A new version (%d.%2d) of the BOINC core client is available from this project's web site.", + "A new version (%d.%02d) of the BOINC core client is available from this project's web site.", cvp->version_num/100, cvp->version_num%100 );