Skip to content

Conversation

@grutt
Copy link
Contributor

@grutt grutt commented Feb 1, 2026

Description

These changes prevent potential issues where the same task or DAG could appear multiple times in the update queries, which could cause lock contention or duplicate update attempts. Identified in #2829

Type of change

  • Bug fix (non-breaking change which fixes an issue)

What's Changed

  • Use DISTINCT ON when selecting tasks to lock in UpdateTaskOLAPStatus to prevent duplicate rows from being locked
  • Add separate CTE (distinct_tasks_to_lock) to first deduplicate tasks before acquiring FOR UPDATE locks
  • Apply same DISTINCT ON fix to dags_to_update query to prevent duplicate DAG status updates
  • Add proper ORDER BY clauses to ensure deterministic row selection when deduplicating

@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment Feb 1, 2026 1:30am

Request Review

@grutt grutt requested a review from abelanger5 February 1, 2026 01:30
@grutt grutt changed the title Fix dag update distinct locks fix: dag update distinct locks Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants