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

Send query heartbeat while spooled data is downloaded #25267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Mar 10, 2025

This prevents a situation when long list of segments is returned and client slowly progresses over it which could take longer than a query abandoned timeout.

This change allows to send a heartbeat while client is progressing over data.

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Mar 10, 2025
@wendigo wendigo requested a review from losipiuk March 10, 2025 12:01
This prevents a situation when long list of segments is returned and client
slowly progresses over it which could take longer than a query abandoned timeout.

This change allows to send a heartbeat while client is progressing over data.
@wendigo wendigo force-pushed the serafin/spooled-heartbeat branch from 070346a to 7b599b7 Compare March 10, 2025 20:06
@@ -388,6 +397,50 @@ public boolean advance()
return executeRequest(request, "fetching next", (e) -> true);
}

public void heartbeat()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename to heartbeatIfNeeded

private final boolean isNull;
private final Runnable heartbeat;

public HeartbeatingResultRows(ResultRows delegate, Runnable heartbeat)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add unit test for this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can try but I need to think how to do it. The default keep-alive interval is 30s

Copy link
Member

Choose a reason for hiding this comment

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

You would need some parametrization; at least @VisibleForTests. And possibly some mockings. See if that is not too much of spaghetti

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.

2 participants