Skip to content

Commit

Permalink
sql: Add column job_cancelled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
donald committed Dec 28, 2023
1 parent c976987 commit 4743e02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mysql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions mysql/migrate_015_add_job_cancelled.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE mxq_job
ADD COLUMN
job_cancelled BOOLEAN NOT NULL DEFAULT FALSE
AFTER
job_priority;

0 comments on commit 4743e02

Please sign in to comment.