Search code examples
cadence-workflowuber-cadence

Why is cadence only doing task deletion queries on my DB


For the past 30 minutes, this is the only db query being done by my cadence server

delete from
  tasks
where
  domain_id = ?
  and task_list_name = ?
  and task_type = ?
  and task_id <= ?
order by
  domain_id,
  task_list_name,
  task_type,
  task_id
limit
  ?

Any idea why this might be happening ? None of my workflows are getting picked and are getting timed out.


Solution

  • It’s for cleaning up the unused tasks entries.

    This is also due to the fact that SQL databases like MySQL doesn’t have TTL features. If a task doesn’t get pulled within its timeout , it will stay there forever until it's scanned and removed.

    See the code here: https://github.com/uber/cadence/blob/c5863ebf7c646ff6e60205ef3f0895199e823749/service/worker/scanner/tasklist/scavenger.go#L116