Skip to content

Commit 862bee3

Browse files
committed
fix(coprocessor): fix query for work duplicate join
1 parent ae92e16 commit 862bee3

3 files changed

Lines changed: 77 additions & 81 deletions

File tree

coprocessor/fhevm-engine/.sqlx/query-3d2589930ab13967234a298b29adde1d816d5474ea496726533befcf5a2118c2.json

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

coprocessor/fhevm-engine/.sqlx/query-63f097acd50a5ec09f959668fce297d0c2c1c9851741c2a5bbb3238af2fe5b75.json

Lines changed: 0 additions & 64 deletions
This file was deleted.

coprocessor/fhevm-engine/tfhe-worker/src/tfhe_worker.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,18 @@ async fn query_for_work<'a>(
300300
let mut s = tracer.start_with_context("query_work_items", loop_ctx);
301301
let the_work = query!(
302302
"
303-
WITH selected_computations AS (
304-
(
303+
-- Acquire all computations from a transaction set
304+
SELECT
305+
c.tenant_id,
306+
c.output_handle,
307+
c.dependencies,
308+
c.fhe_operation,
309+
c.is_scalar,
310+
c.is_allowed,
311+
c.dependence_chain_id,
312+
c.transaction_id
313+
FROM computations c
314+
WHERE c.transaction_id IN (
305315
SELECT DISTINCT
306316
c_creation_order.transaction_id
307317
FROM (
@@ -313,7 +323,7 @@ WITH selected_computations AS (
313323
ORDER BY created_at
314324
LIMIT $1
315325
) as c_creation_order
316-
UNION ALL
326+
UNION
317327
SELECT DISTINCT
318328
c_schedule_order.transaction_id
319329
FROM (
@@ -326,20 +336,6 @@ WITH selected_computations AS (
326336
LIMIT $1
327337
) as c_schedule_order
328338
)
329-
)
330-
-- Acquire all computations from this transaction set
331-
SELECT
332-
c.tenant_id,
333-
c.output_handle,
334-
c.dependencies,
335-
c.fhe_operation,
336-
c.is_scalar,
337-
c.is_allowed,
338-
c.dependence_chain_id,
339-
c.transaction_id
340-
FROM computations c
341-
JOIN selected_computations sc
342-
ON c.transaction_id = sc.transaction_id
343339
FOR UPDATE SKIP LOCKED ",
344340
args.work_items_batch_size as i32,
345341
)

0 commit comments

Comments
 (0)