diff --git a/checkin_notes b/checkin_notes index 8957d4d069..a321804997 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5058,3 +5058,17 @@ David 23 July 2012 client/ current_version.cpp + +David 25 July 2012 + - volunteer data storage: intermediate checkin + + vda/ + vda.cpp + ssim.cpp + vdad.cpp + sched_vda.cpp + vda_lib2.cpp + db/ + boinc_db_types.h + boinc_db.cpp + schema_vda.sql diff --git a/db/boinc_db.cpp b/db/boinc_db.cpp index 1392f13497..a8c7096dec 100644 --- a/db/boinc_db.cpp +++ b/db/boinc_db.cpp @@ -2381,7 +2381,7 @@ void DB_VDA_CHUNK_HOST::db_print(char* buf) { "create_time=%f, " "vda_file_id=%d, " "host_id=%d, " - "chunk_name='%s', " + "physical_file_name='%s', " "present_on_host=%d, " "transfer_in_progress=%d, " "transfer_wait=%d, " @@ -2390,7 +2390,7 @@ void DB_VDA_CHUNK_HOST::db_print(char* buf) { create_time, vda_file_id, host_id, - chunk_name, + physical_file_name, present_on_host, transfer_in_progress, transfer_wait, @@ -2405,7 +2405,7 @@ void DB_VDA_CHUNK_HOST::db_parse(MYSQL_ROW &r) { create_time = atof(r[i++]); vda_file_id = atoi(r[i++]); host_id = atoi(r[i++]); - strcpy(chunk_name, r[i++]); + strcpy(physical_file_name, r[i++]); present_on_host = (atoi(r[i++]) != 0); transfer_in_progress = (atoi(r[i++]) != 0); transfer_wait = (atoi(r[i++]) != 0); diff --git a/db/boinc_db_types.h b/db/boinc_db_types.h index e3839f32df..bd6d2f6e63 100644 --- a/db/boinc_db_types.h +++ b/db/boinc_db_types.h @@ -692,7 +692,7 @@ struct VDA_CHUNK_HOST { double create_time; int vda_file_id; int host_id; - char chunk_name[256]; // C1.C2.Cn + char physical_file_name[256]; // e.g. vda_467_0_file.ext bool present_on_host; bool transfer_in_progress; bool transfer_wait; diff --git a/db/schema_vda.sql b/db/schema_vda.sql index d59a557609..be50135cc9 100644 --- a/db/schema_vda.sql +++ b/db/schema_vda.sql @@ -17,7 +17,7 @@ create table vda_chunk_host ( create_time double not null default 0, vda_file_id integer not null default 0, host_id integer not null default 0, - chunk_name varchar(254) not null, + physical_file_name varchar(254) not null, present_on_host tinyint not null default 0, transfer_in_progress tinyint not null default 0, transfer_wait tinyint not null default 0, diff --git a/doc/projects.inc b/doc/projects.inc index f180529871..59a08e8139 100644 --- a/doc/projects.inc +++ b/doc/projects.inc @@ -26,6 +26,14 @@ $cogsci = array( $biomed = array( tra("Biology and Medicine"), array( + array( + "FightMalaria@Home", + "http://boinc.ucd.ie/fmah", + tra("University College Dublin"), + tra("Antimalarial drug discovery"), + tra("The parasite that causes malaria continues to evolve resistance to available medication. We therefore urgently need to discover new drugs to replace existing drugs. Importantly, these new drugs need to target NEW proteins in the parasite. The FightMalaria@Home project is aimed at finding these new targets."), + "fmah_banner3.png" + ), array( "POEM@HOME", "http://boinc.fzk.de/poem/", diff --git a/vda/sched_vda.cpp b/vda/sched_vda.cpp index 92a076aaaa..2cd7bcefc0 100644 --- a/vda/sched_vda.cpp +++ b/vda/sched_vda.cpp @@ -200,7 +200,7 @@ static void process_present_file(FILE_INFO& fi, CHUNK_LIST& chunks) { } DB_VDA_FILE vf; - sprintf(buf, "file_name='%s'", fname); + sprintf(buf, "where file_name='%s'", fname); retval = vf.lookup(buf); if (retval) { log_messages.printf(MSG_CRITICAL, "No VDA file %s\n", fname); @@ -223,8 +223,8 @@ static void process_present_file(FILE_INFO& fi, CHUNK_LIST& chunks) { ch.create_time = dtime(); ch.vda_file_id = vf.id; ch.host_id = g_reply->host.id; - strcpy(ch.chunk_name, chunk_name); - ch.present_on_host = 1; + strcpy(ch.physical_file_name, fi.name); + ch.present_on_host = true; ch.transfer_in_progress = false; ch.transfer_wait = false; ch.transfer_request_time = 0; @@ -258,12 +258,13 @@ static int process_missing_chunks(CHUNK_LIST& chunks) { if (!ch.found) { if (config.debug_vda) { log_messages.printf(MSG_NORMAL, - "[vda] in DB but not on client: %s\n", ch.chunk_name + "[vda] in DB but not on client: %s\n", ch.physical_file_name ); } char buf[256]; - sprintf(buf, "host_id=%d and vda_file_id=%d and chunk_name='%s'", - ch.host_id, ch.vda_file_id, ch.chunk_name + sprintf(buf, + "host_id=%d and vda_file_id=%d and physical_file_name='%s'", + ch.host_id, ch.vda_file_id, ch.physical_file_name ); int retval = ch.delete_from_db_multi(buf); if (retval) { @@ -296,10 +297,10 @@ static int enforce_quota(CHUNK_LIST& chunks) { DB_VDA_CHUNK_HOST& ch = it->second; if (!ch.found) continue; FILE_INFO fi; - strcpy(fi.name, ch.chunk_name); + strcpy(fi.name, ch.physical_file_name); if (config.debug_vda) { log_messages.printf(MSG_NORMAL, - "[vda] deleting: %s\n", ch.chunk_name + "[vda] deleting: %s\n", ch.physical_file_name ); } DB_VDA_FILE vf; @@ -314,7 +315,7 @@ static int enforce_quota(CHUNK_LIST& chunks) { // issue upload and download commands // static int issue_transfer_commands(CHUNK_LIST& chunks) { - char xml_buf[8192], file_name[1024]; + char xml_buf[8192], chunk_name[256], file_name[1024]; int retval; char url[1024]; @@ -328,20 +329,18 @@ static int issue_transfer_commands(CHUNK_LIST& chunks) { retval = vf.lookup_id(ch.vda_file_id); if (retval) return retval; if (ch.present_on_host) { - if (config.debug_vda) { - log_messages.printf(MSG_NORMAL, - "[vda] sending upload command: %s\n", ch.chunk_name - ); - } // upload // - physical_file_name( - g_reply->host.id, ch.chunk_name, vf.file_name, file_name - ); + if (config.debug_vda) { + log_messages.printf(MSG_NORMAL, + "[vda] sending command to upload %s\n", + ch.physical_file_name + ); + } urls.push_back(config.upload_url); R_RSA_PRIVATE_KEY key; retval = get_file_xml( - file_name, + ch.physical_file_name, urls, vf.chunk_size, dtime() + VDA_HOST_TIMEOUT, @@ -350,22 +349,30 @@ static int issue_transfer_commands(CHUNK_LIST& chunks) { xml_buf ); } else { - if (config.debug_vda) { - log_messages.printf(MSG_NORMAL, - "[vda] sending download command: %s\n", ch.chunk_name - ); - } // download // char md5[64], chunk_dir[1024]; - sprintf(file_name, "%s__%s", ch.chunk_name, vf.file_name); - get_chunk_url(vf, ch.chunk_name, url); + int hostid; + if (config.debug_vda) { + log_messages.printf(MSG_NORMAL, + "[vda] sending command to download %s\n", + ch.physical_file_name + ); + } + parse_physical_filename( + ch.physical_file_name, + hostid, + chunk_name, + file_name + ); + + get_chunk_url(vf, chunk_name, url); urls.push_back(url); - get_chunk_dir(vf, ch.chunk_name, chunk_dir); + get_chunk_dir(vf, chunk_name, chunk_dir); retval = get_chunk_md5(chunk_dir, md5); if (retval) return retval; retval = put_file_xml( - file_name, + ch.physical_file_name, urls, md5, vf.chunk_size, @@ -416,11 +423,12 @@ void handle_vda() { } if (config.debug_vda) { log_messages.printf(MSG_NORMAL, - "[vda] DB: has chunk %s\n", ch.chunk_name + "[vda] DB: has chunk %s, file %d\n", + ch.physical_file_name, ch.vda_file_id ); } chunks.insert( - pair(string(ch.chunk_name), ch) + pair(string(ch.physical_file_name), ch) ); } diff --git a/vda/ssim.cpp b/vda/ssim.cpp index 3f5f633112..915672a6c6 100644 --- a/vda/ssim.cpp +++ b/vda/ssim.cpp @@ -259,7 +259,7 @@ void CHUNK_ON_HOST::start_upload() { transfer_wait = true; t = sim.now + drand()*params.connect_interval; #ifdef EVENT_DEBUG - printf("%s: waiting to start upload of %s\n", now_str(), chunk_name); + printf("%s: waiting to start upload of %s\n", now_str(), physical_file_name); #endif sim.insert(this); } @@ -269,7 +269,7 @@ void CHUNK_ON_HOST::start_download() { transfer_wait = true; t = sim.now + drand()*params.connect_interval; #ifdef EVENT_DEBUG - printf("%s: waiting to start download of %s\n", now_str(), chunk_name); + printf("%s: waiting to start download of %s\n", now_str(), physical_file_name); #endif sim.insert(this); } @@ -282,7 +282,7 @@ void CHUNK_ON_HOST::handle() { transfer_wait = false; if (present_on_host) { #ifdef EVENT_DEBUG - printf("%s: starting upload of %s\n", now_str(), chunk_name); + printf("%s: starting upload of %s\n", now_str(), physical_file_name); #endif chunk->parent->dfile->upload_rate.sample_inc( host->transfer_rate, @@ -291,7 +291,7 @@ void CHUNK_ON_HOST::handle() { ); } else { #ifdef EVENT_DEBUG - printf("%s: starting download of %s\n", now_str(), chunk_name); + printf("%s: starting download of %s\n", now_str(), physical_file_name); #endif chunk->parent->dfile->download_rate.sample_inc( host->transfer_rate, @@ -307,7 +307,7 @@ void CHUNK_ON_HOST::handle() { if (present_on_host) { // it was an upload #ifdef EVENT_DEBUG - printf("%s: upload of %s completed\n", now_str(), chunk_name); + printf("%s: upload of %s completed\n", now_str(), physical_file_name); #endif chunk->parent->dfile->upload_rate.sample_inc( -host->transfer_rate, @@ -318,7 +318,7 @@ void CHUNK_ON_HOST::handle() { } else { present_on_host = true; #ifdef EVENT_DEBUG - printf("%s: download of %s completed\n", now_str(), chunk_name); + printf("%s: download of %s completed\n", now_str(), physical_file_name); #endif chunk->parent->dfile->download_rate.sample_inc( -host->transfer_rate, @@ -397,7 +397,7 @@ int CHUNK::assign() { sim.insert(h); #endif CHUNK_ON_HOST *c = new CHUNK_ON_HOST(); - sprintf(c->chunk_name, "chunk %s on host %d", name, h->id); + sprintf(c->physical_file_name, "chunk %s on host %d", name, h->id); #ifdef EVENT_DEBUG printf("%s: assigning chunk %s to host %d\n", now_str(), name, h->id); #endif @@ -429,7 +429,7 @@ void CHUNK::host_failed(VDA_CHUNK_HOST* p) { set::iterator i = hosts.find(p); hosts.erase(i); #ifdef EVENT_DEBUG - printf("%s: handling loss of %s\n", now_str(), p->chunk_name); + printf("%s: handling loss of %s\n", now_str(), p->physical_file_name); #endif SIM_FILE* sfp = (SIM_FILE*)parent->dfile; sfp->recover(); diff --git a/vda/vda.cpp b/vda/vda.cpp index c210221d2c..bf725292b3 100644 --- a/vda/vda.cpp +++ b/vda/vda.cpp @@ -127,7 +127,7 @@ int handle_add(const char* path) { strcpy(vf.dir, dir); strcpy(vf.file_name, filename); vf.size = size; - vf.chunk_size = policy.chunk_size(); + vf.chunk_size = 0; // don't know this yet; set by vdad vf.need_update = 1; vf.initialized = 0; vf.retrieving = 0; diff --git a/vda/vda_lib2.cpp b/vda/vda_lib2.cpp index 13ef7f56da..4f4df9cfa4 100644 --- a/vda/vda_lib2.cpp +++ b/vda/vda_lib2.cpp @@ -77,7 +77,13 @@ void encoder_filename( } int get_chunk_numbers(VDA_CHUNK_HOST& vch, vector& chunk_numbers) { - char* p = vch.chunk_name; + char buf[256]; + strcpy(buf, vch.physical_file_name); // vda_hostid_chunknums_filename + char* p = buf; + p = strchr(p, '_') + 1; + p = strchr(p, '_') + 1; + char* q = strchr(p, '_') + 1; + *q = 0; while (1) { int i = atoi(p); chunk_numbers.push_back(i); @@ -272,7 +278,9 @@ int CHUNK::assign() { ch.create_time = dtime(); ch.vda_file_id = parent->dfile->id; ch.host_id = host_id; - strcpy(ch.chunk_name, name); + physical_file_name( + host_id, name, parent->dfile->file_name, ch.physical_file_name + ); ch.present_on_host = 0; ch.transfer_in_progress = true; ch.transfer_wait = true; diff --git a/vda/vdad.cpp b/vda/vdad.cpp index 8d4907a2aa..ec4c4ffa6c 100644 --- a/vda/vdad.cpp +++ b/vda/vdad.cpp @@ -72,7 +72,8 @@ int handle_file(VDA_FILE_AUX& vf, DB_VDA_FILE& dvf) { log_messages.printf(MSG_CRITICAL, "vf.init failed %d\n", retval); return retval; } - dvf.update_field("initialized=1"); + sprintf(buf, "initialized=1, chunk_size=%.0f", vf.policy.chunk_size()); + dvf.update_field(buf); } retval = vf.meta_chunk->recovery_plan(); if (retval) { @@ -110,8 +111,13 @@ bool scan_files() { ); exit(1); } else { - vf.need_update = 0; - vf.update(); + retval = vf.update_field("need_update=0"); + if (retval) { + log_messages.printf( + MSG_CRITICAL, "update_field() failed: %d\n", retval + ); + exit(1); + } } } return found;