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: change query id generation to work with planned commands #4149

Merged
merged 2 commits into from
Dec 19, 2019

Conversation

rodesai
Copy link
Contributor

@rodesai rodesai commented Dec 16, 2019

Description

This patch changes up how we generate query IDs to play nice with
planned commands. Before this change, statements would get the current
offset as their query id. However planned commands get their query IDs
before being enqueued, so they should really get the next expected
offset as their ID. This patch changes up the id generation to work
this way. The next ID is set after statements/plans are executed,
and is set to the next expected offset.

This patch changes up how we generate query IDs to play nice with
planned commands. Before this change, statements would get the current
offset as their query id. However planned commands get their query IDs
before being enqueued, so they should really get the _next_ expected
offset as their ID. This patch changes up the id generation to work
this way. The next ID is set _after_ statemetns/plans are executed,
and is set to the next expected offset.
@rodesai rodesai requested a review from a team as a code owner December 16, 2019 21:50
@stevenpyzhang
Copy link
Member

@rodesai Just to clarify the behavior to expect, If I have (beginning of command topic) CS, CT, CSAS, CT, CT, CTAS, the ID's would be CSAS_0 and CTAS_2 correct?

@stevenpyzhang stevenpyzhang self-assigned this Dec 16, 2019
@stevenpyzhang
Copy link
Member

stevenpyzhang commented Dec 17, 2019

@rodesai This PR got me thinking, with the Transactional Protocol in place, isn't it possible that we create a Plan with a QueryId (which uses up the current identifier in the generator), but the server fails to enqueue the plan to the command topic. Wouldn't that mean the server wouldn't be able to send a CSAS/CTAS to the command topic unless it executes another CSAS/CTAS sent there by another server?

@rodesai
Copy link
Contributor Author

rodesai commented Dec 18, 2019

which uses up the current identifier in the generator

When generating plans, the distributor uses a snapshot engine and generator, which doesn't consume an ID from the actual engine/generator.

Copy link
Contributor

@vcrfxia vcrfxia left a comment

Choose a reason for hiding this comment

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

LGTM!

…utation/InteractiveStatementExecutorTest.java

Co-Authored-By: Victoria Xia <[email protected]>
@rodesai rodesai merged commit 91c421a into confluentinc:master Dec 19, 2019
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