Skip to content

Fix cancel query grafana#335

Open
laserninja wants to merge 1 commit intotrinodb:mainfrom
laserninja:fix-cancel-query-grafana
Open

Fix cancel query grafana#335
laserninja wants to merge 1 commit intotrinodb:mainfrom
laserninja:fix-cancel-query-grafana

Conversation

@laserninja
Copy link
Copy Markdown
Contributor

@laserninja laserninja commented Mar 14, 2026

Fixes #310

@cla-bot cla-bot bot added the cla-signed label Mar 14, 2026
Track active queries per panel and cancel in-flight queries when a new
QueryData request arrives for the same panel (e.g. user changes filters
or presses cancel). The context cancellation propagates through
database/sql to the Trino driver, which sends a DELETE request to
terminate the query on the Trino server.

Fixes trinodb#310
@laserninja laserninja force-pushed the fix-cancel-query-grafana branch from f5a0a63 to b6e4dba Compare March 14, 2026 03:34
ctx, cancel := context.WithCancel(ctx)
defer cancel()

queryID := ds.queryCounter.Add(1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are race conditions possible here? Wouldn't it be better to create a random uuid for the queryID?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will bulk fix it ones someone/you does a through review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

issue on cancel query with Trino as datasource

2 participants