-
Notifications
You must be signed in to change notification settings - Fork 162
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
support snappyer #391
support snappyer #391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need credo to run on at least one of the builds.
The credo build faild, so I delete it. |
please don't delete it, instead fix the failures/warnings |
@bjhaid @joshuawscott |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping to improve KafkaEx! Overall, please try to make separate pull requests for independent changes. It makes review much easier and makes it easier to test changes independently. I think this PR could be split into at least 3 separate PRs.
As for snappyer - can you tell us why you want to make this change? I think it may be that we should just change to snappyer instead of making it an option, but I'd like to hear your motivation first.
@@ -1,3 +1,5 @@ | |||
use Mix.Config | |||
|
|||
config :kafka_ex, snappy_module: :snappyer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, please don't override this unless we plan to make snappyer the default. You can (and we should) test snappyer by wrapping a test where we change the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is forced to use in the testenvironment and the ci environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the config for all the tests, meaning we're not protected against regressions when using the old snappy lib.
This is problematic, because it means that the test suite wouldn't cover at all the default config we're shipping (i.e. the old snappy lib).
I suggest modifying the tests that cover compression so that they run twice, once with the default config and one with the new snappy module.
You can change the Application config for a given test (and restore it afterwards) by using Application.put_env
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we even need to test snappyer? is this a case where we need to define a compression behavior(interface in other languages) such that this is swappable in the future without any modification to kafka_ex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not test snappyer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we even need to test snappyer?
If you're talking about the lib itself, we don't. We do need to test the it integrates correctly, though right ? What I mean is: we do need to test that our code, when calling snappyer, works as expected.
Also, to re-iterate my earlier point:
- most of our tests should use as much as possible the default config for the tests (unless we really need to), do be consistent with what we ship in a release.
- whenever there are several configs, we should try to have at least one test checking that the changed config behaves correctly.
is this a case where we need to define a compression behavior [...] ?
Interesting idea ! I don't know much about compression in Kafka, so I don't know how useful that would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addendum: the reason why I would recommend having one test with the new snappyer library is that, if we wish to make it the default for KafkaEx 1.0, we must have at least some experience with it. Including a test in the CI for snappyer allows us to get a bit of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry just seeing this, maybe I wasn't clear, my hope is that we don't have to always have people open PRs like this in the future, we provide them with a interface they need to implement and let them go implement the interface for any new library they want to use for compression, I may be too far away from things and my suggestions might just be flat out wrong, but it seems it's just easier to empower people to change the compression library by implementing an interface rather than always opening PR to kafka_ex every time there is a new shiny/better compression library/support in the elixir ecosystem or kafka.
@dantswain |
@getong I'm sorry it's taken me so long to get back to you on this, I've been very busy. I think in the long term we should simply switch to using snappyer. I'd be a little concerned with doing that right away because it could be a surprise breaking change (though easily fixed). OTOH I don't like the added complexity of supporting two implementations. @joshuawscott @bjhaid @jbruggem I think we have a few options:
@getong If we go with either option (3) or (4), we will need to add tests so that both snappy and snappyer are tested. I can help you accomplish this. |
Make your choice and I will do it. |
My opinion: go for option 4., since it seems supporting both doesn't involve a lot of code. It means:
|
@jbruggem |
I have update the test code, and all the test code are passed, but the coveralls upload error, this is not the test code error, I think the code can be reviewed now.
|
use snappyer as default change doc
@joshuawscott @getong |
No description provided.