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

fix: KeyQueryMetadata not available on Pull query after stream is created #6633

Closed
wants to merge 1 commit into from

Conversation

spena
Copy link
Member

@spena spena commented Nov 17, 2020

Description

Fixes #6249

A KeyQueryMetadata.NOT_AVAILABLE is usually caused when resources (hosts/streams) are not ready to access the state store. You can see this error when executing a pull query right after the stream is created. It takes some time for the streams to create the materialization in all the hosts.

To fix this issue, the clients must retry the pull query after some time in order to access the state store. This PR allows clients to retry requests that are marked as ERROR_CODE_RESOURCE_NOT_READY for a maximum number of retries and for some waiting time between retries.

By default, a request will wait for 500ms between retries and up to 10 retries. Users can configure this with the following config:

ksql> set 'ksql.retriable.requests.max.retries'='5';
ksql> set 'ksql.retriable.requests.sleep.ms'='1000';

Testing done

Describe the testing strategy. Unit and integration tests are expected for any behavior changes.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@spena spena added the bug label Nov 17, 2020
@spena spena added this to the 0.15.0 milestone Nov 17, 2020
@spena spena requested review from AlanConfluent and a team November 17, 2020 19:05
…ated

A KeyQueryMetadata.NOT_AVAILABLE is usually caused when resources (hosts/streams)
are not ready to access the state store. This fix allows clients to retry
the pull query when such state is found.
@@ -366,6 +366,18 @@
public static final String KSQL_VARIABLE_SUBSTITUTION_ENABLE_DOC
= "Enable variable substitution on SQL statements.";

public static final String KSQL_RETRIABLE_REQUESTS_MAX_RETRIES
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't looked at the code yet, but I wanted to comment that I don't think we should set the default behavior to retry or sleep. For pull queries, I suspect a better default behavior is to fail fast than to hang - so that the user can decide whether they want to retry or not. What's important is to make sure that we have a good error message returned to the user.

@spena
Copy link
Member Author

spena commented Dec 3, 2020

Closing this now the issue is fixed here: #6709

@spena spena closed this Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyQueryMetadata not available for state store Aggregate-Aggregate-Materialize and key Struct{X=X}
2 participants