Skip to content

Commit a850e99

Browse files
committed
fix(db): correct arguments for get_task_queue_wm_2,
deprecates `get_task_queue_wm`.
1 parent b5a268f commit a850e99

File tree

8 files changed

+74
-7
lines changed

8 files changed

+74
-7
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
audience: general
2+
level: patch
3+
---
4+
Fix arguments for `get_task_queue_wm_2` (`get_task_queue_wm` is now deprecated).

db/fns.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
* [`get_non_stopped_workers_quntil_providers`](#get_non_stopped_workers_quntil_providers)
148148
* [`get_queue_worker_with_wm_join`](#get_queue_worker_with_wm_join)
149149
* [`get_queue_workers_with_wm_join`](#get_queue_workers_with_wm_join)
150-
* [`get_task_queue_wm`](#get_task_queue_wm)
150+
* [`get_task_queue_wm_2`](#get_task_queue_wm_2)
151151
* [`get_task_queues_wm`](#get_task_queues_wm)
152152
* [`get_worker_2`](#get_worker_2)
153153
* [`get_worker_pool_error`](#get_worker_pool_error)
@@ -2327,7 +2327,7 @@ If the hashed session id does not exist, then an error code `P0002` will be thro
23272327
* [`get_non_stopped_workers_quntil_providers`](#get_non_stopped_workers_quntil_providers)
23282328
* [`get_queue_worker_with_wm_join`](#get_queue_worker_with_wm_join)
23292329
* [`get_queue_workers_with_wm_join`](#get_queue_workers_with_wm_join)
2330-
* [`get_task_queue_wm`](#get_task_queue_wm)
2330+
* [`get_task_queue_wm_2`](#get_task_queue_wm_2)
23312331
* [`get_task_queues_wm`](#get_task_queues_wm)
23322332
* [`get_worker_2`](#get_worker_2)
23332333
* [`get_worker_pool_error`](#get_worker_pool_error)
@@ -2555,22 +2555,20 @@ If the pagination arguments are both NULL, all rows are returned.
25552555
Otherwise, page_size rows are returned at offset page_offset.
25562556
This also performs an outer join with the worker_manager.worker table for more data.
25572557

2558-
### get_task_queue_wm
2558+
### get_task_queue_wm_2
25592559

25602560
* *Mode*: read
25612561
* *Arguments*:
25622562
* `task_queue_id_in text`
25632563
* `expires_in timestamptz`
2564-
* `page_size_in integer`
2565-
* `page_offset_in integer`
25662564
* *Returns*: `table`
25672565
* `task_queue_id text`
25682566
* `expires timestamptz`
25692567
* `last_date_active timestamptz`
25702568
* `description text`
25712569
* `stability text`
25722570
* `etag uuid`
2573-
* *Last defined on version*: 74
2571+
* *Last defined on version*: 75
25742572

25752573
Get a non-expired task queue by task_queue_id.
25762574

@@ -2857,6 +2855,7 @@ the return value is an empty set.
28572855
### deprecated methods
28582856

28592857
* `get_non_stopped_workers_quntil(worker_pool_id_in text, worker_group_in text, worker_id_in text, page_size_in integer, page_offset_in integer)` (compatibility guaranteed until v46.0.0)
2858+
* `get_task_queue_wm(task_queue_id_in text, expires_in timestamptz, page_size_in integer, page_offset_in integer)` (compatibility guaranteed until v46.0.0)
28602859
* `get_worker_pool_with_capacity(worker_pool_id_in text)` (compatibility guaranteed until v46.0.0)
28612860
* `get_worker_pools_with_capacity(page_size_in integer, page_offset_in integer)` (compatibility guaranteed until v46.0.0)
28622861
* `update_worker_pool_with_capacity(worker_pool_id_in text, provider_id_in text, description_in text, config_in jsonb, last_modified_in timestamptz, owner_in text, email_on_error_in boolean)` (compatibility guaranteed until v46.0.0)

db/test/fns/worker_manager_test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,4 +1103,16 @@ suite(testing.suiteName(), function() {
11031103
assert.equal(pools[1].current_capacity, 5);
11041104
});
11051105
});
1106+
1107+
suite(`${testing.suiteName()} - TaskQueue`, function() {
1108+
helper.dbTest('no such task queue', async function(db) {
1109+
const res = await db.fns.get_task_queue_wm_2('prov/wt', new Date());
1110+
assert.deepEqual(res, []);
1111+
});
1112+
1113+
helper.dbTest('get_task_queues_wm empty', async function(db) {
1114+
const res = await db.fns.get_task_queues_wm(null, null, null, null);
1115+
assert.deepEqual(res, []);
1116+
});
1117+
});
11061118
});

db/test/versions/0075_test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const testing = require('taskcluster-lib-testing');
2+
3+
suite(testing.suiteName(), function() {
4+
// this version only updates method,
5+
// to trigger index usage, so no tests are needed
6+
});

db/versions/0075.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 75
2+
description: fix get_task_queue_wm args
3+
methods:
4+
get_task_queue_wm:
5+
deprecated: true
6+
get_task_queue_wm_2:
7+
description: |-
8+
Get a non-expired task queue by task_queue_id.
9+
mode: read
10+
serviceName: worker_manager
11+
args: task_queue_id_in text, expires_in timestamptz
12+
returns: table(task_queue_id text, expires timestamptz, last_date_active timestamptz, description text, stability text, etag uuid)
13+
body: |-
14+
begin
15+
return query
16+
select
17+
task_queues.task_queue_id,
18+
task_queues.expires,
19+
task_queues.last_date_active,
20+
task_queues.description,
21+
task_queues.stability,
22+
public.gen_random_uuid()
23+
from task_queues
24+
where
25+
task_queues.task_queue_id = task_queue_id_in and
26+
task_queues.expires > expires_in;
27+
end

db/versions/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ If this invariant is violated, it must be indicated clearly in the changelog.
8484
| [0072](./0072.yml) | v44.12.0 | add last_date_active to queue_workers |
8585
| [0073](./0073.yml) | v44.15.0 | include worker manager data to in queue worker responses |
8686
| [0074](./0074.yml) | v44.15.3 | get task queue(s) via worker manager service |
87+
| [0075](./0075.yml) | (pending release) | fix get_task_queue_wm args |
8788
<!-- AUTOGENERATED DO NOT EDIT - END -->

generated/db-schema.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/worker-manager/src/queue-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TaskQueue {
4242

4343
// Get a worker type from the DB, or undefined
4444
static async get(db, taskQueueId, expires) {
45-
return TaskQueue.fromDbRows(await db.fns.get_task_queue_wm(taskQueueId, expires));
45+
return TaskQueue.fromDbRows(await db.fns.get_task_queue_wm_2(taskQueueId, expires));
4646
}
4747

4848
// Call db.get_task_queues.

0 commit comments

Comments
 (0)