Skip to content

Fix: Remove dual writes into temp tables for status updates#3829

Open
mrkaye97 wants to merge 4 commits intomainfrom
mk/remove-dual-writes
Open

Fix: Remove dual writes into temp tables for status updates#3829
mrkaye97 wants to merge 4 commits intomainfrom
mk/remove-dual-writes

Conversation

@mrkaye97
Copy link
Copy Markdown
Contributor

@mrkaye97 mrkaye97 commented May 5, 2026

Description

Removes the dual writes into the temp tables by dropping the insert in a trigger (for dags) and dropping the explicit write of the events into the temp table (for tasks)

Type of change

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

Copilot AI review requested due to automatic review settings May 5, 2026 19:54
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment May 5, 2026 7:57pm

Request Review

@mrkaye97 mrkaye97 changed the base branch from main to mk/dual-write-status-updates May 5, 2026 19:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the legacy temp-table writes that duplicated OLAP task/DAG status propagation, shifting the codepath toward the direct in-transaction status update flow already used by the repository.

Changes:

  • Removes the task-status trigger insert into v1_task_status_updates_tmp.
  • Removes the CreateTaskEventsOLAPTmp SQL/copyfrom plumbing for v1_task_events_olap_tmp.
  • Adds a migration to update the deployed trigger definition for existing databases.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sql/schema/v1-olap.sql Removes the task update trigger’s enqueue into the DAG temp table.
pkg/repository/sqlcv1/olap.sql.go Regenerated sqlc output after removing the temp-table copyfrom definition.
pkg/repository/sqlcv1/olap.sql Removes the CreateTaskEventsOLAPTmp copyfrom query.
pkg/repository/sqlcv1/copyfrom.go Removes generated copyfrom iterator/function for temp task events.
pkg/repository/olap.go Stops writing task events into the temp queue in writeTaskEventBatch.
cmd/hatchet-migrate/migrate/migrations/20260505195258_v1_0_104.sql Adds migration to replace the deployed trigger function body.

r.id = n.id
AND r.inserted_at = n.inserted_at
AND r.kind = 'TASK';

Comment thread pkg/repository/olap.go
@@ -1727,16 +1726,6 @@ func (r *OLAPRepositoryImpl) writeTaskEventBatch(ctx context.Context, tenantId u
}

eventsToWrite = append(eventsToWrite, event)
r.id = n.id
AND r.inserted_at = n.inserted_at
AND r.kind = 'TASK';

Base automatically changed from mk/dual-write-status-updates to main May 5, 2026 20:02
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