- GUI RPC: switching to the new XML parser

(which won't parse a double as an int)
    revealed a type mismatch in FILE_TRANSFER::next_request_time
    between client and server.


svn path=/trunk/boinc/; revision=25125
This commit is contained in:
David Anderson 2012-01-23 05:03:52 +00:00
parent be9e807e31
commit c05444ad1e
11 changed files with 216 additions and 10 deletions

View File

@ -863,3 +863,23 @@ Rom 21 Jan 2012
sched/
sched_customize.cpp
David 22 Jan 2012
- GUI RPC: switching to the new XML parser
(which won't parse a double as an int)
revealed a type mismatch in FILE_TRANSFER::next_request_time
between client and server.
db/
boinc_db.cpp,h
schema_vda.sql (new)
lib/
gui_rpc_client_ops.cpp
gui_rpc_client.h
ssim/
vda.cpp
vda_lib.cpp,h
vda_transitioner.cpp
makefile
client/
net_stats.cpp

View File

@ -420,6 +420,9 @@ void DAILY_XFER_HISTORY::totals(int ndays, double& up, double& down) {
}
}
// tell the scheduler how much we've used in the quota period
// (currently not used by scheduler)
//
void DAILY_XFER_HISTORY::write_scheduler_request(MIOFILE& mf, int ndays) {
double up, down;
totals(ndays, up, down);

View File

@ -86,6 +86,8 @@ void SCHED_TRIGGER_ITEM::clear() {
working_set_removal = false;
}
void FILESET_SCHED_TRIGGER_ITEM::clear() {memset(this, 0, sizeof(*this));}
void VDA_FILE::clear() {memset(this, 0, sizeof(*this));}
void VDA_CHUNK_HOST::clear() {memset(this, 0, sizeof(*this));}
DB_PLATFORM::DB_PLATFORM(DB_CONN* dc) :
DB_BASE("platform", dc?dc:&boinc_db){}
@ -147,6 +149,10 @@ DB_FILESET_SCHED_TRIGGER_ITEM::DB_FILESET_SCHED_TRIGGER_ITEM(DB_CONN* dc) :
DB_BASE_SPECIAL(dc?dc:&boinc_db){}
DB_FILESET_SCHED_TRIGGER_ITEM_SET::DB_FILESET_SCHED_TRIGGER_ITEM_SET(DB_CONN* dc) :
DB_BASE_SPECIAL(dc?dc:&boinc_db){}
DB_VDA_FILE::DB_VDA_FILE(DB_CONN* dc) :
DB_BASE("vda_file", dc?dc:&boinc_db){}
DB_VDA_CHUNK_HOST::DB_VDA_CHUNK_HOST(DB_CONN* dc) :
DB_BASE("vda_chunk_host", dc?dc:&boinc_db){}
int DB_PLATFORM::get_id() {return id;}
int DB_APP::get_id() {return id;}
@ -163,6 +169,7 @@ int DB_STATE_COUNTS::get_id() {return appid;}
int DB_FILE::get_id() {return id;}
int DB_FILESET::get_id() {return id;}
int DB_SCHED_TRIGGER::get_id() {return id;}
int DB_VDA_FILE::get_id() {return id;}
void DB_PLATFORM::db_print(char* buf){
sprintf(buf,
@ -2320,4 +2327,64 @@ int DB_FILESET_SCHED_TRIGGER_ITEM_SET::contains_trigger(const char* fileset_name
return 0;
}
void DB_VDA_FILE::db_print(char* buf){
sprintf(buf,
"dir='%s', "
"name='%s', "
"size=%f, "
"chunk_size=%f, "
"created=%f, "
"need_update=%d",
dir,
name,
size,
chunk_size,
created,
need_update?1:0
);
}
void DB_VDA_FILE::db_parse(MYSQL_ROW &r) {
int i=0;
clear();
id = atoi(r[i++]);
strcpy(dir, r[i++]);
strcpy(name, r[i++]);
size = atof(r[i++]);
chunk_size = atof(r[i++]);
created = atof(r[i++]);
need_update = (atoi(r[i++]) != 0);
}
void DB_VDA_CHUNK_HOST::db_print(char* buf) {
sprintf(buf,
"vda_file_id=%d, "
"host_id=%d, "
"name='%s', "
"present_on_host=%d, "
"transfer_in_progress=%d, "
"transfer_wait=%d, "
"transition_time=%f ",
vda_file_id,
host_id,
name,
present_on_host,
transfer_in_progress,
transfer_wait,
transition_time
);
}
void DB_VDA_CHUNK_HOST::db_parse(MYSQL_ROW &r) {
int i=0;
clear();
vda_file_id = atoi(r[i++]);
host_id = atoi(r[i++]);
strcpy(name, r[i++]);
present_on_host = (atoi(r[i++]) != 0);
transfer_in_progress = (atoi(r[i++]) != 0);
transfer_wait = (atoi(r[i++]) != 0);
transition_time = atof(r[i++]);
}
const char *BOINC_RCSID_ac374386c8 = "$Id$";

View File

@ -1117,4 +1117,39 @@ public:
std::vector<DB_FILESET_SCHED_TRIGGER_ITEM> items;
};
struct VDA_FILE {
int id;
char dir[256];
char name[256];
double size;
double chunk_size;
double created;
bool need_update;
void clear();
};
struct VDA_CHUNK_HOST {
int vda_file_id;
int host_id; // zero if we're waiting for a host
char name[256];
bool present_on_host;
bool transfer_in_progress;
bool transfer_wait;
double transition_time;
void clear();
};
struct DB_VDA_FILE : public DB_BASE, public VDA_FILE {
DB_VDA_FILE(DB_CONN* p=0);
int get_id();
void db_print(char*);
void db_parse(MYSQL_ROW &row);
};
struct DB_VDA_CHUNK_HOST : public DB_BASE, public VDA_CHUNK_HOST {
DB_VDA_CHUNK_HOST(DB_CONN* p=0);
void db_print(char*);
void db_parse(MYSQL_ROW &row);
};
#endif

27
db/schema_vda.sql Normal file
View File

@ -0,0 +1,27 @@
create table vda_file (
id integer not null auto_increment,
dir varchar(254) not null,
name varchar(254) not null,
size double not null default 0,
chunk_size double not null default 0,
created double not null default 0,
need_update tinyint not null default 0,
primary key(id)
) engine = InnoDB;
alter table vda_file add unique(name);
create table vda_chunk_host (
vda_file_id integer not null default 0,
name varchar[256] not null,
host_id integer not null default 0,
present_on_host tinyint not null default 0,
transfer_in_progress tinyint not null default 0,
transfer_wait tinyint not null default 0,
transition_time double not null default 0
) engine = InnoDB;
alter table vda_chunk_host
add index vch_file (vda_file_id),
add index vch_host (host_id),
add index vch_tt (transition_time);

View File

@ -308,8 +308,8 @@ public:
bool pers_xfer_active;
bool xfer_active;
int num_retries;
int first_request_time;
int next_request_time;
double first_request_time;
double next_request_time;
int status;
double time_so_far;
double bytes_xferred;

View File

@ -624,8 +624,8 @@ int FILE_TRANSFER::parse(XML_PARSER& xp) {
is_upload = generated_locally;
}
if (xp.parse_int("num_retries", num_retries)) continue;
if (xp.parse_int("first_request_time", first_request_time)) continue;
if (xp.parse_int("next_request_time", next_request_time)) continue;
if (xp.parse_double("first_request_time", first_request_time)) continue;
if (xp.parse_double("next_request_time", next_request_time)) continue;
if (xp.parse_int("status", status)) continue;
if (xp.parse_double("time_so_far", time_so_far)) continue;
if (xp.parse_double("last_bytes_xferred", bytes_xferred)) continue;

View File

@ -1,7 +1,10 @@
all: ssim
vda.o: vda.cpp vda.h
g++ -c vda.cpp
ssim: ssim.cpp des.h vda.o
g++ -g -Wall -o ssim ssim.cpp vda.o
all: ssim vda vda_transitioner
vda_lib.o: vda_lib.cpp vda_lib.h
g++ -c vda_lib.cpp
ssim: ssim.cpp des.h vda_lib.o
g++ -g -Wall -o ssim ssim.cpp vda_lib.o
vda_transitioner: vda_transitioner.cpp vda_lib.o
g++ -g -Wall -o vda_transitioner vda_transitioner.cpp vda_lib.o
vda: vda.cpp vda_lib.o
g++ -g -Wall -o vda vda.cpp vda_lib.o

51
ssim/vda_transitioner.cpp Normal file
View File

@ -0,0 +1,51 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2012 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#include "boinc_db.h"
void handle_file(VDA_FILE& vf) {
}
bool scan_files() {
DB_VDA_FILE vf;
bool found = false;
while (vda_file.enum("need_update<>0")) {
found = true;
handle_file(vf);
}
return found;
}
void handle_chunk(VDA_CHUNK_HOST* ch) {
}
void scan_chunks() {
DB_VDA_CHUNK_HOST ch;
double now = dtime();
while (ch.enum("transition_time < %f")) {
}
}
int main(int argc, char** argv) {
while(1) {
bool action = scan_files();
action != scan_chunks();
if (!action) boinc_sleep(5.);
}
}