From d17217ea37dfc567031f837d2d3edb35c4281779 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 25 Dec 2023 18:15:23 +0100 Subject: [PATCH] sql: Add column job_cancelled When mxqkill is used against a running job, it has to communicate the fact, that the job should be aborted to the daemon handling it. Add a boolean (=TINYINT) column to mxq_job for that. Other options were considered but discarded, mostly because it would lead to more complex code: - Further overload job_status - Utilize a bit of job_flags - use of MySQL BIT data type - use of MySQL SET data type --- mysql/create_tables.sql | 2 ++ mysql/migrate_015_add_job_cancelled.sql | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 mysql/migrate_015_add_job_cancelled.sql diff --git a/mysql/create_tables.sql b/mysql/create_tables.sql index fe0b7581..cd0c553b 100644 --- a/mysql/create_tables.sql +++ b/mysql/create_tables.sql @@ -72,6 +72,8 @@ CREATE TABLE IF NOT EXISTS mxq_job ( job_status INT2 UNSIGNED NOT NULL DEFAULT 0, job_priority INT2 UNSIGNED NOT NULL DEFAULT 127, + job_cancelled BOOLEAN NOT NULL DEFAULT FALSE, + group_id INT8 UNSIGNED NOT NULL, job_workdir VARCHAR(4096) NOT NULL, diff --git a/mysql/migrate_015_add_job_cancelled.sql b/mysql/migrate_015_add_job_cancelled.sql new file mode 100644 index 00000000..adc3c0d6 --- /dev/null +++ b/mysql/migrate_015_add_job_cancelled.sql @@ -0,0 +1,5 @@ +ALTER TABLE mxq_job + ADD COLUMN + job_cancelled BOOLEAN NOT NULL DEFAULT FALSE + AFTER + job_priority;