Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close StatementClient when hitting client-side timeout #136

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

takezoe
Copy link
Member

@takezoe takezoe commented Feb 5, 2025

Purpose

Ensure sending a query cancel request when hitting client-side timeout.

Overview

StatementClient.close sends a query cancel request but it doesn't work after hitting the client-side timeout because the internal state has been changed by raise_timeout_error! when close is called.

In order to ensure sending a query cancel request, call close automatically before throwing the exception when hitting the client-side timeout.

This is a port of trinodb/trino#24446

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

@takezoe takezoe requested a review from a team as a code owner February 5, 2025 07:46
Copy link
Member

@miniway miniway left a comment

Choose a reason for hiding this comment

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

The change looks good to me. We might need to fix test failure if possible also

@ganmacs
Copy link
Member

ganmacs commented Feb 5, 2025

We need to add HTTP stub stub_request(:delete, "localhost/v1/next_uri") to failed tests.

@takezoe takezoe force-pushed the close_on_timeout branch 2 times, most recently from ae58958 to f1491d4 Compare February 5, 2025 08:57
@takezoe
Copy link
Member Author

takezoe commented Feb 5, 2025

Yes, with verification to check that cancel request was sent.

@takezoe takezoe force-pushed the close_on_timeout branch 2 times, most recently from b192071 to 8ad8a54 Compare February 5, 2025 11:48
@takezoe takezoe merged commit b3261b1 into treasure-data:master Feb 6, 2025
10 checks passed
@takezoe takezoe deleted the close_on_timeout branch February 6, 2025 03:24
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