Skip to content

Commit

Permalink
Remove group_sum_starttime
Browse files Browse the repository at this point in the history
It is unclear, what group_sum_starttime is supposed to be, but it seems
to be bogus and is 0 for most groups anyway.

'select count(*) from mxq_group where group_sum_starttime=0'
+----------+
| count(*) |
+----------+
|   539223 |
+----------+
'select count(*) from mxq_group where group_sum_starttime!=0'
+----------+
| count(*) |
+----------+
|    11014 |
+----------+
'select distinct(group_sum_starttime) from mxq_group limit 10'
+---------------------+
| group_sum_starttime |
+---------------------+
|                   0 |
|         62509173560 |
|        682762450608 |
|         50573290960 |
|        126435008048 |
|        328732081280 |
|         75859753168 |
|         75859750064 |
|       1770065450784 |
|         75861674832 |
+---------------------+
  • Loading branch information
donald committed Dec 29, 2023
1 parent 3a36b64 commit 616434d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
4 changes: 1 addition & 3 deletions mxq_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "mx_util.h"
#include "mx_mysql.h"

#define GROUP_FIELDS_CNT 38
#define GROUP_FIELDS_CNT 37
#define GROUP_FIELDS \
" group_id," \
" group_name," \
Expand Down Expand Up @@ -42,7 +42,6 @@
" group_jobs_unknown," \
" group_jobs_restarted," \
" group_slots_running," \
" group_sum_starttime," \
" stats_max_sumrss," \
" stats_max_maxrss," \
" stats_max_utime_sec," \
Expand Down Expand Up @@ -97,7 +96,6 @@ static int bind_result_group_fields(struct mx_mysql_bind *result, struct mxq_gro
res += mx_mysql_bind_var(result, idx++, uint64, &(g->group_jobs_restarted));

res += mx_mysql_bind_var(result, idx++, uint64, &(g->group_slots_running));
res += mx_mysql_bind_var(result, idx++, uint64, &(g->group_sum_starttime));

res += mx_mysql_bind_var(result, idx++, uint64, &(g->stats_max_sumrss));
res += mx_mysql_bind_var(result, idx++, uint64, &(g->stats_max_maxrss));
Expand Down
1 change: 0 additions & 1 deletion mxq_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ struct mxq_group {
uint64_t group_jobs_restarted;

uint64_t group_slots_running;
uint64_t group_sum_starttime;

uint64_t stats_max_sumrss;
uint64_t stats_max_maxrss;
Expand Down
1 change: 0 additions & 1 deletion mysql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ CREATE TABLE IF NOT EXISTS mxq_group (
group_jobs_restarted INT8 UNSIGNED NOT NULL DEFAULT 0,

group_slots_running INT8 UNSIGNED NOT NULL DEFAULT 0,
group_sum_starttime INT8 UNSIGNED NOT NULL DEFAULT 0,

group_mtime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,

Expand Down
10 changes: 1 addition & 9 deletions mysql/create_trigger.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
SET NEW.date_start = NOW();

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime + UNIX_TIMESTAMP(NEW.date_start) * OLD.host_slots,
group_jobs_inq = group_jobs_inq - 1,
group_jobs_running = group_jobs_running + 1,
group_slots_running = group_slots_running + NEW.host_slots
Expand All @@ -68,17 +67,13 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
UPDATE mxq_group SET
group_slots_running = group_slots_running
- OLD.host_slots
+ NEW.host_slots,
group_sum_starttime = group_sum_starttime
- UNIX_TIMESTAMP(OLD.date_start) * OLD.host_slots
+ UNIX_TIMESTAMP(OLD.date_start) * NEW.host_slots
+ NEW.host_slots
WHERE group_id = NEW.group_id;

-- LOADED(150) | RUNNING(200) -> KILLED(400) | FAILED(750)
ELSEIF NEW.job_status IN (400, 750) AND OLD.job_status IN (150, 200) THEN

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime - LEAST(group_sum_starttime, UNIX_TIMESTAMP(OLD.date_start) * OLD.host_slots),
group_slots_running = group_slots_running - OLD.host_slots,
group_jobs_running = group_jobs_running - 1,
group_jobs_failed = group_jobs_failed + 1,
Expand Down Expand Up @@ -107,7 +102,6 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
ELSEIF NEW.job_status = 999 AND OLD.job_status IN (150, 200) THEN

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime - LEAST(group_sum_starttime, UNIX_TIMESTAMP(OLD.date_start) * OLD.host_slots),
group_slots_running = group_slots_running - OLD.host_slots,
group_jobs_running = group_jobs_running - 1,
group_jobs_unknown = group_jobs_unknown + 1
Expand All @@ -125,7 +119,6 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
ELSEIF NEW.job_status = 1000 AND OLD.job_status IN (150, 200) THEN

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime - LEAST(group_sum_starttime, UNIX_TIMESTAMP(OLD.date_start) * OLD.host_slots),
group_slots_running = group_slots_running - OLD.host_slots,
group_jobs_running = group_jobs_running - 1,
group_jobs_finished = group_jobs_finished + 1,
Expand All @@ -146,7 +139,6 @@ CREATE TRIGGER mxq_update_job BEFORE UPDATE ON mxq_job
ELSEIF NEW.job_status = 0 AND OLD.job_status IN (150) THEN

UPDATE mxq_group SET
group_sum_starttime = group_sum_starttime - UNIX_TIMESTAMP(OLD.date_start) * NEW.host_slots,
group_jobs_inq = group_jobs_inq + 1,
group_jobs_running = group_jobs_running - 1,
group_slots_running = group_slots_running - OLD.host_slots
Expand Down

0 comments on commit 616434d

Please sign in to comment.