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

feat: add offset to QueuedCommand and flag to Command #3343

Conversation

stevenpyzhang
Copy link
Member

Description

Breaking down the PR at #3330 into smaller pieces, this one focuses on the simpler task of adding new offset values and flags to the command objects. Validation will be done at a later date after more offline discussion. This PR is a precursor to updating the query id generating code for interactive mode.

The flag in Command is to indicate whether or not a command should use the old query id generation or use the new offset based query id. This is needed to ensure that if a server is relying on a command topic with old commands, the old commands will still follow the same pattern for query id generation and query ids are maintained if the server needs to restore.

The field in QueuedCommand represents the offset that the command was read from, it's assigned from the corresponding Kafka ConsumerRecord.offset()

Testing done

Local tests
Deserialization test for new Command
Update existing unit tests

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 #")

@stevenpyzhang stevenpyzhang requested a review from a team as a code owner September 12, 2019 21:25
@stevenpyzhang stevenpyzhang changed the title feat: add offset QueuedCommand objects and flag to Command objects feat: add offset to QueuedCommand and flag to Command Sep 12, 2019
@stevenpyzhang stevenpyzhang force-pushed the add-offset-to-Commands-and-QueuedCommands branch from 96df4a4 to 9c7f004 Compare September 13, 2019 16:39
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM! Some nits inline. Also make sure that if for some weird reason we don't get to merge the queryID follow up before 5.4 that this is reverted - otherwise we'd be in a state the flag could be true but the commands are actually still using the old queryID generation!

@JsonProperty("streamsProperties") final Map<String, Object> overwriteProperties,
@JsonProperty("originalProperties") final Map<String, String> originalProperties) {
this.statement = statement;
this.isNewQueryIdGeneration =
Copy link
Contributor

Choose a reason for hiding this comment

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

you could just do this.isNewQueryIdGeneration = (isNewQueryIdGeneration != null) but I suppose that's a little tricky icky icky 😄

@agavra agavra requested a review from a team September 13, 2019 17:14
@stevenpyzhang stevenpyzhang force-pushed the add-offset-to-Commands-and-QueuedCommands branch 2 times, most recently from 9fe09aa to 4cdd5ff Compare September 13, 2019 18:16
@stevenpyzhang stevenpyzhang force-pushed the add-offset-to-Commands-and-QueuedCommands branch from 4cdd5ff to c33f56c Compare September 13, 2019 18:26
@stevenpyzhang stevenpyzhang merged commit fd112a4 into confluentinc:master Sep 13, 2019
@stevenpyzhang stevenpyzhang deleted the add-offset-to-Commands-and-QueuedCommands branch September 13, 2019 20:28
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.

2 participants