- feeder: include all app versions that have maximal version num

within their plan class

svn path=/trunk/boinc/; revision=16714
This commit is contained in:
David Anderson 2008-12-17 21:58:54 +00:00
parent 1f8365e5da
commit 90740c7690
2 changed files with 29 additions and 17 deletions

View File

@ -10224,3 +10224,10 @@ Rom 17 Dec 2008
/ /
configure.ac configure.ac
version.h version.h
David 17 Dec 2008
- feeder: include all app versions that have maximal version num
within their plan class
sched/
sched_shmem.cpp

View File

@ -115,33 +115,38 @@ int SCHED_SHMEM::scan_tables() {
n = 0; n = 0;
// for each (app, platform) pair, // for each (app, platform) pair,
// find the greatest version num of a non-deprecated version // get all versions with numbers maximal in their plan class.
// greater than app.min_version, if any.
// Then get all versions with that number.
// //
for (i=0; i<nplatforms; i++) { for (i=0; i<nplatforms; i++) {
PLATFORM& splatform = platforms[i]; PLATFORM& splatform = platforms[i];
for (j=0; j<napps; j++) { for (j=0; j<napps; j++) {
char query[1024];
int max_version;
APP& sapp = apps[j]; APP& sapp = apps[j];
vector<APP_VERSION> avs;
char query[1024];
sprintf(query, sprintf(query,
"select max(version_num) from app_version where appid=%d and platformid=%d and version_num>=%d and deprecated=0", "where appid=%d and platformid=%d and deprecated=0",
sapp.id, splatform.id, sapp.min_version sapp.id, splatform.id, max_version
); );
retval = app_version.get_integer(query, max_version); while (!app_version.enumerate(query)) {
if (!retval) { avs.push_back(app_version);
sprintf(query, }
"where appid=%d and platformid=%d and version_num=%d and deprecated=0", for (unsigned int k=0; k<avs.size(); k++) {
sapp.id, splatform.id, max_version APP_VERSION& av1 = avs[k];
); for (unsigned int kk=k+1; kk<avs.size(); kk++) {
while (!app_version.enumerate(query)) { APP_VERSION& av2 = avs[kk];
app_versions[n++] = app_version; if (!strcmp(av1.plan_class, av2.plan_class) && av1.version_num > av2.version_num) {
if (n == MAX_APP_VERSIONS) { av2.deprecated = 1;
overflow("app_versions", "MAX_APP_VERSIONS");
} }
} }
} }
for (unsigned int k=0; k<avs.size(); k++) {
APP_VERSION& av1 = avs[k];
if (av1.deprecated) continue;
app_versions[n++] = av1;
if (n == MAX_APP_VERSIONS) {
overflow("app_versions", "MAX_APP_VERSIONS");
}
}
} }
} }
napp_versions = n; napp_versions = n;