mirror of https://github.com/BOINC/boinc.git
server: more 64-bit ID fixes
negative values are stored in app_version_id fields to represent anonymous platform versions. So need to use %ld rather than %lu for these fields. Also there were a couple of more changes of int do DB_ID_TYPE
This commit is contained in:
parent
ad83e9e0e1
commit
a87d039f49
|
@ -880,7 +880,7 @@ void DB_WORKUNIT::db_print(char* buf){
|
|||
"priority=%d, "
|
||||
"rsc_bandwidth_bound=%.15e, "
|
||||
"fileset_id=%lu, "
|
||||
"app_version_id=%lu, "
|
||||
"app_version_id=%ld, "
|
||||
"transitioner_flags=%d, "
|
||||
"size_class=%d ",
|
||||
create_time, appid,
|
||||
|
@ -923,7 +923,7 @@ void DB_WORKUNIT::db_print_values(char* buf) {
|
|||
"%d, NOW(), "
|
||||
"%f, "
|
||||
"%lu, "
|
||||
"%lu, "
|
||||
"%ld, "
|
||||
"%d, "
|
||||
"%d)",
|
||||
create_time, appid,
|
||||
|
@ -1017,7 +1017,7 @@ void DB_RESULT::db_print(char* buf){
|
|||
"claimed_credit=%.15e, granted_credit=%.15e, opaque=%.15e, random=%d, "
|
||||
"app_version_num=%d, appid=%lu, exit_status=%d, teamid=%lu, "
|
||||
"priority=%d, elapsed_time=%.15e, flops_estimate=%.15e, "
|
||||
"app_version_id=%lu, runtime_outlier=%d, size_class=%d, "
|
||||
"app_version_id=%ld, runtime_outlier=%d, size_class=%d, "
|
||||
"peak_working_set_size=%.0f, "
|
||||
"peak_swap_size=%.0f, "
|
||||
"peak_disk_usage=%.0f ",
|
||||
|
@ -1081,7 +1081,7 @@ int DB_RESULT::mark_as_sent(int old_server_state, int report_grace_period) {
|
|||
int retval;
|
||||
|
||||
sprintf(query,
|
||||
"update result set server_state=%d, hostid=%lu, userid=%lu, sent_time=%d, report_deadline=%d, flops_estimate=%.15e, app_version_id=%lu where id=%lu and server_state=%d",
|
||||
"update result set server_state=%d, hostid=%lu, userid=%lu, sent_time=%d, report_deadline=%d, flops_estimate=%.15e, app_version_id=%ld where id=%lu and server_state=%d",
|
||||
server_state,
|
||||
hostid,
|
||||
userid,
|
||||
|
@ -1322,7 +1322,10 @@ int DB_HOST_APP_VERSION::update_scheduler(DB_HOST_APP_VERSION& orig) {
|
|||
max_jobs_per_day,
|
||||
n_jobs_today
|
||||
);
|
||||
sprintf(clause, "host_id=%lu and app_version_id=%lu", host_id, app_version_id);
|
||||
sprintf(clause,
|
||||
"host_id=%lu and app_version_id=%ld",
|
||||
host_id, app_version_id
|
||||
);
|
||||
return update_fields_noid(query, clause);
|
||||
}
|
||||
|
||||
|
@ -1371,7 +1374,7 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) {
|
|||
max_jobs_per_day
|
||||
);
|
||||
sprintf(clause,
|
||||
"host_id=%lu and app_version_id=%lu ",
|
||||
"host_id=%lu and app_version_id=%ld ",
|
||||
host_id, app_version_id
|
||||
);
|
||||
return update_fields_noid(query, clause);
|
||||
|
@ -1380,7 +1383,7 @@ int DB_HOST_APP_VERSION::update_validator(DB_HOST_APP_VERSION& orig) {
|
|||
void DB_HOST_APP_VERSION::db_print(char* buf) {
|
||||
sprintf(buf,
|
||||
"host_id=%lu, "
|
||||
"app_version_id=%lu, "
|
||||
"app_version_id=%ld, "
|
||||
"pfc_n=%.15e, "
|
||||
"pfc_avg=%.15e, "
|
||||
"et_n=%.15e, "
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
struct BEST_APP_VERSION;
|
||||
|
||||
typedef long DB_ID_TYPE;
|
||||
// in principle should be unsigned long,
|
||||
// but we put negative values in app_version_id to represent
|
||||
// anonymous platform versions
|
||||
|
||||
// A compilation target, i.e. a architecture/OS combination.
|
||||
// Client will be sent applications only for platforms they support.
|
||||
|
|
|
@ -391,7 +391,7 @@ int hav_lookup(
|
|||
) {
|
||||
int retval;
|
||||
char buf[256];
|
||||
sprintf(buf, "where host_id=%lu and app_version_id=%lu", hostid, gen_avid);
|
||||
sprintf(buf, "where host_id=%lu and app_version_id=%ld", hostid, gen_avid);
|
||||
retval = hav.lookup(buf);
|
||||
if (retval != ERR_DB_NOT_FOUND) return retval;
|
||||
|
||||
|
@ -441,9 +441,9 @@ int hav_lookup(
|
|||
if (found) {
|
||||
hav = best_hav;
|
||||
char query[256], where_clause[256];
|
||||
sprintf(query, "app_version_id=%lu", gen_avid);
|
||||
sprintf(query, "app_version_id=%ld", gen_avid);
|
||||
sprintf(where_clause,
|
||||
"host_id=%lu and app_version_id=%lu",
|
||||
"host_id=%lu and app_version_id=%ld",
|
||||
hostid, best_av.id
|
||||
);
|
||||
retval = hav.update_fields_noid(query, where_clause);
|
||||
|
@ -530,7 +530,7 @@ int get_pfc(
|
|||
if (r.app_version_id == 0 || r.app_version_id == 1) {
|
||||
if (config.debug_credit) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[credit] [RESULT#%lu] missing app_version_id (%lu): returning WU default %.2f\n",
|
||||
"[credit] [RESULT#%lu] missing app_version_id (%ld): returning WU default %.2f\n",
|
||||
r.id, r.app_version_id, wu_estimated_credit(wu, app)
|
||||
);
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ int get_pfc(
|
|||
if (strstr(r.stderr_out, "Device Emulation (CPU)")) {
|
||||
if (config.debug_credit) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[credit] [RESULT#%lu][AV#%lu] CUDA app fell back to CPU; returning WU default %.2f\n",
|
||||
"[credit] [RESULT#%lu][AV#%ld] CUDA app fell back to CPU; returning WU default %.2f\n",
|
||||
r.id, r.app_version_id, wu.rsc_fpops_est*COBBLESTONE_SCALE
|
||||
);
|
||||
}
|
||||
|
@ -554,8 +554,6 @@ int get_pfc(
|
|||
return 0;
|
||||
}
|
||||
|
||||
//int gavid = generalized_app_version_id(r.app_version_id, r.appid);
|
||||
|
||||
// transition case: there's no host_app_version record
|
||||
//
|
||||
if (!hav.host_id) {
|
||||
|
@ -732,7 +730,7 @@ int get_pfc(
|
|||
avp = av_lookup(r.app_version_id, app_versions);
|
||||
if (!avp) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"get_pfc() [RESULT#%lu]: No AVP %lu!!\n", r.id, r.app_version_id
|
||||
"get_pfc() [RESULT#%lu]: No AVP %ld!!\n", r.id, r.app_version_id
|
||||
);
|
||||
return ERR_NOT_FOUND;
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ int archive_result(DB_RESULT& result) {
|
|||
" <opaque>%f</opaque>\n"
|
||||
" <random>%d</random>\n"
|
||||
" <app_version_num>%d</app_version_num>\n"
|
||||
" <app_version_id>%lu</app_version_id>\n"
|
||||
" <app_version_id>%ld</app_version_id>\n"
|
||||
" <appid>%lu</appid>\n"
|
||||
" <exit_status>%d</exit_status>\n"
|
||||
" <teamid>%lu</teamid>\n"
|
||||
|
|
|
@ -15,8 +15,14 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// The BOINC scheduling server.
|
||||
// The BOINC scheduler.
|
||||
// Normally runs as a CGI or fast CGI program.
|
||||
// You can also run it:
|
||||
// - manually for debugging, with a single request
|
||||
// - for simulation or performance testing, with a stream of requests
|
||||
// (using --batch)
|
||||
|
||||
// TODO: what does the following mean?
|
||||
// Also, You can call debug_sched() for whatever situation is of
|
||||
// interest to you. It won't do anything unless you create
|
||||
// (touch) the file 'debug_sched' in the project root directory.
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
// got a SUCCESS result. Doesn't mean it's valid!
|
||||
//
|
||||
static inline void got_good_result(SCHED_RESULT_ITEM& sri) {
|
||||
int gavid = generalized_app_version_id(sri.app_version_id, sri.appid);
|
||||
DB_ID_TYPE gavid = generalized_app_version_id(sri.app_version_id, sri.appid);
|
||||
DB_HOST_APP_VERSION* havp = gavid_to_havp(gavid);
|
||||
if (!havp) {
|
||||
if (config.debug_handle_results) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[handle] No app version for %d\n", gavid
|
||||
"[handle] No app version for %ld\n", gavid
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
@ -49,7 +49,7 @@ static inline void got_good_result(SCHED_RESULT_ITEM& sri) {
|
|||
}
|
||||
if (config.debug_quota) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[quota] increasing max_jobs_per_day for %d: %d->%d\n",
|
||||
"[quota] increasing max_jobs_per_day for %ld: %d->%d\n",
|
||||
gavid, havp->max_jobs_per_day, n
|
||||
);
|
||||
}
|
||||
|
@ -63,12 +63,12 @@ static inline void got_good_result(SCHED_RESULT_ITEM& sri) {
|
|||
// - mechanism that categorizes hosts as "reliable"
|
||||
//
|
||||
static inline void got_bad_result(SCHED_RESULT_ITEM& sri) {
|
||||
int gavid = generalized_app_version_id(sri.app_version_id, sri.appid);
|
||||
DB_ID_TYPE gavid = generalized_app_version_id(sri.app_version_id, sri.appid);
|
||||
DB_HOST_APP_VERSION* havp = gavid_to_havp(gavid);
|
||||
if (!havp) {
|
||||
if (config.debug_handle_results) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[handle] No app version for %d\n", gavid
|
||||
"[handle] No app version for %ld\n", gavid
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
@ -84,7 +84,7 @@ static inline void got_bad_result(SCHED_RESULT_ITEM& sri) {
|
|||
}
|
||||
if (config.debug_quota) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[quota] decreasing max_jobs_per_day for %d: %d->%d\n",
|
||||
"[quota] decreasing max_jobs_per_day for %ld: %d->%d\n",
|
||||
gavid, havp->max_jobs_per_day, n
|
||||
);
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ int handle_results() {
|
|||
// if it's a single-thread app, set ET = CPU
|
||||
//
|
||||
if (srip->elapsed_time < srip->cpu_time) {
|
||||
int avid = srip->app_version_id;
|
||||
DB_ID_TYPE avid = srip->app_version_id;
|
||||
if (avid > 0) {
|
||||
APP_VERSION* avp = ssp->lookup_app_version(avid);
|
||||
if (avp && !avp->is_multithread()) {
|
||||
|
|
|
@ -890,7 +890,7 @@ bool work_needed(bool locality_sched) {
|
|||
|
||||
// return the app version ID, or -2/-3/-4 if anonymous platform
|
||||
//
|
||||
inline static int get_app_version_id(BEST_APP_VERSION* bavp) {
|
||||
inline static DB_ID_TYPE get_app_version_id(BEST_APP_VERSION* bavp) {
|
||||
if (bavp->avp) {
|
||||
return bavp->avp->id;
|
||||
} else {
|
||||
|
|
|
@ -264,14 +264,14 @@ PLATFORM* SCHED_SHMEM::lookup_platform(char* name) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PLATFORM* SCHED_SHMEM::lookup_platform_id(int id) {
|
||||
PLATFORM* SCHED_SHMEM::lookup_platform_id(DB_ID_TYPE id) {
|
||||
for (int i=0; i<nplatforms; i++) {
|
||||
if (platforms[i].id == id) return &platforms[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
APP* SCHED_SHMEM::lookup_app(int id) {
|
||||
APP* SCHED_SHMEM::lookup_app(DB_ID_TYPE id) {
|
||||
for (int i=0; i<napps; i++) {
|
||||
if (apps[i].id == id) return &apps[i];
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ APP* SCHED_SHMEM::lookup_app_name(char* name) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
APP_VERSION* SCHED_SHMEM::lookup_app_version(int id) {
|
||||
APP_VERSION* SCHED_SHMEM::lookup_app_version(DB_ID_TYPE id) {
|
||||
APP_VERSION* avp;
|
||||
for (int i=0; i<napp_versions; i++) {
|
||||
avp = &app_versions[i];
|
||||
|
|
|
@ -121,9 +121,9 @@ struct SCHED_SHMEM {
|
|||
void show(FCGI_FILE*);
|
||||
#endif
|
||||
|
||||
APP* lookup_app(int);
|
||||
APP* lookup_app(DB_ID_TYPE);
|
||||
APP* lookup_app_name(char*);
|
||||
APP_VERSION* lookup_app_version(int);
|
||||
APP_VERSION* lookup_app_version(DB_ID_TYPE);
|
||||
APP_VERSION* lookup_app_version_platform_plan_class(
|
||||
int platform, char* plan_class
|
||||
);
|
||||
|
@ -134,7 +134,7 @@ struct SCHED_SHMEM {
|
|||
}
|
||||
return x;
|
||||
}
|
||||
PLATFORM* lookup_platform_id(int);
|
||||
PLATFORM* lookup_platform_id(DB_ID_TYPE);
|
||||
PLATFORM* lookup_platform(char*);
|
||||
};
|
||||
|
||||
|
|
|
@ -1482,7 +1482,7 @@ void read_host_app_versions() {
|
|||
g_wreq->host_app_versions_orig = g_wreq->host_app_versions;
|
||||
}
|
||||
|
||||
DB_HOST_APP_VERSION* gavid_to_havp(int gavid) {
|
||||
DB_HOST_APP_VERSION* gavid_to_havp(DB_ID_TYPE gavid) {
|
||||
for (unsigned int i=0; i<g_wreq->host_app_versions.size(); i++) {
|
||||
DB_HOST_APP_VERSION& hav = g_wreq->host_app_versions[i];
|
||||
if (hav.app_version_id == gavid) return &hav;
|
||||
|
|
|
@ -550,10 +550,10 @@ static inline void add_no_work_message(const char* m) {
|
|||
extern void get_weak_auth(USER&, char*);
|
||||
extern void get_rss_auth(USER&, char*);
|
||||
extern void read_host_app_versions();
|
||||
extern DB_HOST_APP_VERSION* get_host_app_version(int gavid);
|
||||
extern DB_HOST_APP_VERSION* get_host_app_version(DB_ID_TYPE gavid);
|
||||
extern void write_host_app_versions();
|
||||
|
||||
extern DB_HOST_APP_VERSION* gavid_to_havp(int gavid);
|
||||
extern DB_HOST_APP_VERSION* gavid_to_havp(DB_ID_TYPE gavid);
|
||||
extern DB_HOST_APP_VERSION* quota_exceeded_version();
|
||||
|
||||
inline bool is_64b_platform(const char* name) {
|
||||
|
|
|
@ -88,7 +88,7 @@ static int result_timed_out(
|
|||
DB_HOST_APP_VERSION hav;
|
||||
char query[512], clause[512];
|
||||
|
||||
int gavid = generalized_app_version_id(
|
||||
DB_ID_TYPE gavid = generalized_app_version_id(
|
||||
res_item.res_app_version_id, wu_item.appid
|
||||
);
|
||||
int retval = hav_lookup(hav, res_item.res_hostid, gavid);
|
||||
|
@ -115,7 +115,7 @@ static int result_timed_out(
|
|||
}
|
||||
if (config.debug_quota) {
|
||||
log_messages.printf(MSG_NORMAL,
|
||||
"[quota] max_jobs_per_day for %d; %d->%d\n",
|
||||
"[quota] max_jobs_per_day for %ld; %d->%d\n",
|
||||
gavid, hav.max_jobs_per_day, n
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue