Skip to content

Commit

Permalink
server software: handle 64-bit database IDs
Browse files Browse the repository at this point in the history
The SETI@home result table is about to run out of 32-bit IDs,
so we need to move to 64-bit result IDs.
This will happen to the workunit table at some point too.

I changed the server C++ code to use the "long" type for all DB IDs
(and to use appropriate conversion codes like %lu).
"long" is 64 bit on 64-bit machines.
For uniformity I did this for all tables,
even ones (like app) that will never get big.

I chose NOT to change the DB schema for now.
The new code will work with 32-bit ID fields in the DB.
As projects approach the 32-bit limit on a table they can change
its ID field, and fields that reference this table, to BIGINT.
This is likely to happen only on the result and workunit tables.
I put functions in html/ops/db_update.php
to change the IDs of these tables.
  • Loading branch information
davidpanderson committed Jul 23, 2015
1 parent 94e3162 commit 8cd8c8e
Show file tree
Hide file tree
Showing 55 changed files with 793 additions and 709 deletions.
304 changes: 153 additions & 151 deletions db/boinc_db.cpp

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions db/boinc_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
extern DB_CONN boinc_db;

struct TRANSITIONER_ITEM {
int id; // WARNING: this is the WU ID
DB_ID_TYPE id; // WARNING: this is the WU ID
char name[256];
int appid;
DB_ID_TYPE appid;
int min_quorum;
bool need_validate;
int canonical_resultid;
DB_ID_TYPE canonical_resultid;
int transition_time;
int delay_bound;
int error_mask;
Expand All @@ -53,20 +53,20 @@ struct TRANSITIONER_ITEM {
int priority;
int hr_class;
int batch;
int app_version_id;
DB_ID_TYPE app_version_id;
int transitioner_flags;
int size_class;
int res_id; // This is the RESULT ID
DB_ID_TYPE res_id; // This is the RESULT ID
char res_name[256];
int res_report_deadline;
int res_server_state;
int res_outcome;
int res_validate_state;
int res_file_delete_state;
int res_sent_time;
int res_hostid;
DB_ID_TYPE res_hostid;
int res_received_time;
int res_app_version_id;
DB_ID_TYPE res_app_version_id;
int res_exit_status;

void clear();
Expand All @@ -88,7 +88,7 @@ struct DB_USER_SUBMIT : public DB_BASE, public USER_SUBMIT {
};

struct STATE_COUNTS {
int appid;
DB_ID_TYPE appid;
int last_update_time;
int result_server_state_2;
int result_server_state_4;
Expand Down Expand Up @@ -262,12 +262,12 @@ class DB_VALIDATOR_ITEM_SET : public DB_BASE_SPECIAL {
int nitems_this_query;

int enumerate(
int appid,
DB_ID_TYPE appid,
int nresult_limit,
int wu_id_modulus,
int wu_id_remainder,
int wu_id_min,
int wu_id_max,
DB_ID_TYPE wu_id_min,
DB_ID_TYPE wu_id_max,
std::vector<VALIDATOR_ITEM>& items
);
int update_result(RESULT&);
Expand All @@ -278,7 +278,7 @@ class DB_VALIDATOR_ITEM_SET : public DB_BASE_SPECIAL {
// used by the feeder and scheduler for outgoing work
//
struct WORK_ITEM {
int res_id;
DB_ID_TYPE res_id;
int res_priority;
int res_server_state;
double res_report_deadline;
Expand All @@ -287,7 +287,7 @@ struct WORK_ITEM {
};

class DB_WORK_ITEM : public WORK_ITEM, public DB_BASE_SPECIAL {
int start_id;
DB_ID_TYPE start_id;
// when enumerate_all is used, keeps track of which ID to start from
public:
DB_WORK_ITEM(DB_CONN* p=0);
Expand Down Expand Up @@ -322,7 +322,7 @@ struct IN_PROGRESS_RESULT {
class DB_IN_PROGRESS_RESULT : public IN_PROGRESS_RESULT, public DB_BASE_SPECIAL {
public:
DB_IN_PROGRESS_RESULT(DB_CONN* p=0);
int enumerate(int hostid, const char* result_names);
int enumerate(DB_ID_TYPE hostid, const char* result_names);
};

// Used by the scheduler to handle results reported by clients
Expand All @@ -331,17 +331,17 @@ class DB_IN_PROGRESS_RESULT : public IN_PROGRESS_RESULT, public DB_BASE_SPECIAL

struct SCHED_RESULT_ITEM {
char queried_name[256]; // name as reported by client
int id;
DB_ID_TYPE id;
char name[256];
int workunitid;
int appid;
DB_ID_TYPE workunitid;
DB_ID_TYPE appid;
int server_state;
int client_state;
int validate_state;
int outcome;
int hostid;
int userid;
int teamid;
DB_ID_TYPE hostid;
DB_ID_TYPE userid;
DB_ID_TYPE teamid;
int sent_time;
int received_time;
double cpu_time;
Expand All @@ -351,7 +351,7 @@ struct SCHED_RESULT_ITEM {
int exit_status;
int file_delete_state;
double elapsed_time;
int app_version_id;
DB_ID_TYPE app_version_id;
double peak_working_set_size;
double peak_swap_size;
double peak_disk_usage;
Expand Down Expand Up @@ -379,7 +379,7 @@ class DB_SCHED_RESULT_ITEM_SET : public DB_BASE_SPECIAL {
};

struct FILE_ITEM {
int id;
DB_ID_TYPE id;
char name[254];
char md5sum[34];
double size;
Expand All @@ -397,7 +397,7 @@ class DB_FILE : public DB_BASE, public FILE_ITEM {
};

struct FILESET_ITEM {
int id;
DB_ID_TYPE id;
char name[254];

void clear();
Expand All @@ -416,8 +416,8 @@ class DB_FILESET : public DB_BASE, public FILESET_ITEM {
};

struct FILESET_FILE_ITEM {
int fileset_id;
int file_id;
DB_ID_TYPE fileset_id;
DB_ID_TYPE file_id;

void clear();
};
Expand All @@ -431,8 +431,8 @@ class DB_FILESET_FILE : public DB_BASE, public FILESET_FILE_ITEM {
};

struct SCHED_TRIGGER_ITEM {
int id;
int fileset_id;
DB_ID_TYPE id;
DB_ID_TYPE fileset_id;
bool need_work;
bool work_available;
bool no_work_available;
Expand Down
Loading

0 comments on commit 8cd8c8e

Please sign in to comment.