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

Refactor and test the 0.8.0 implementation #264

Merged
merged 7 commits into from
Dec 15, 2017

Conversation

dantswain
Copy link
Collaborator

My ultimate goal is to first move to Protocol implementations for the wire requests and then ultimately support the various message format changes with version changes (see #261, #245). To make these changes more manageable, I want to do some fairly heavy refactoring of the server implementations, so that they are better factored to reason about and share more implementation at the base level.

I started with the 0.8.0 implementation because it is the simplest. Even though we are discussing dropping support for it (see #260), I think this is not wasted effort since it allows me to start with the simplest implementation and sort out some of the basic issues.

The way that I am testing this could be controversial. I am connecting the 0.8.0 implementation to the 0.9.0 test broker with an SSL connection. 0.8.0 does not support SSL so this required allowing the 0.8.0 implementation to attempt a connection with SSL. I am emitting a warning message when the user attempts to do this. The only alternative that I could think of was to actually spin up a 0.8.0 cluster in test, which would significantly increase the complexity of the test setup and the duration of the test run on travis.

@@ -47,6 +51,21 @@ defmodule KafkaEx.Server do
ssl_options: KafkaEx.ssl_options,
use_ssl: boolean
}

@spec increment_correlation_id(t) :: t
def increment_correlation_id(state = %State{correlation_id: cid}) do

Choose a reason for hiding this comment

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

File has the variable name before the pattern while most of the files have the variable name after the pattern when naming parameter pattern matches

request.topic,
request.partition
)

Choose a reason for hiding this comment

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

There should be no trailing white-space at the end of a line.

wire_request = request
|> client_request(updated_state)
|> module.create_request

Choose a reason for hiding this comment

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

There should be no trailing white-space at the end of a line.

config_sync_timeout()
)
|> module.parse_response

Choose a reason for hiding this comment

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

There should be no trailing white-space at the end of a line.

|> module.parse_response

state_out = State.increment_correlation_id(updated_state)

Choose a reason for hiding this comment

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

There should be no trailing white-space at the end of a line.

@sourcelevel-bot
Copy link

Ebert has finished reviewing this Pull Request and has found:

  • 1 possible new issue (including those that may have been commented here).
  • 6 fixed issues! 🎉

You can see more details about this review at https://ebertapp.io/github/kafkaex/kafka_ex/pulls/264.

Copy link
Member

@joshuawscott joshuawscott left a comment

Choose a reason for hiding this comment

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

I don't know if it's worth addressing the 0.8 SSL issue at all, given that we will be dropping 0.8 support soon one way or another.

The refactor seems reasonable to me. I think we might want to take a look at testing against the correct broker versions when we move on to refactor 0.9 and add 0.10/0.11/1.0

@ashwini709
Copy link
Contributor

Can we get this one merged soon, if it is ok?

@dantswain
Copy link
Collaborator Author

@ashwini709 I will try to get it merged tomorrow if @bjhaid has no objections. Do you mind if I ask for your motivation for this? The reason I’m asking is that we are assessing if anyone is using the 0.8.x implementations. See #260

@ashwini709
Copy link
Contributor

@dantswain We are using Kafka version 0.11.0, But I could see relevant file changes that might conflict with #235 done for #233

@dantswain dantswain merged commit f04ccc0 into master Dec 15, 2017
@dantswain dantswain deleted the refactor_and_test_0_p_8_p_0 branch December 15, 2017 19:39
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.

4 participants