You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/02/21 11:38:18 UTC
[GitHub] [beam] nbali opened a new pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
nbali opened a new pull request #16909:
URL: https://github.com/apache/beam/pull/16909
**Please** add a meaningful description for your change here
https://github.com/apache/beam/pull/15951 was the original trigger. During my tests the issue that I have encountered was that the graph and the behaviour during the actual execution differed from the one I would have expected strictly based on the `KafkaIO` configurations in the code. It happened due to multiple reasons, but this PR only aims to address one - for the rest see https://github.com/apache/beam/pull/16773 and https://github.com/apache/beam/pull/16888
So the current issue is that not every configration/property available at at the `KafkaIO.Read` works both with the legacy and the SDF implementation. On it's own this wouldn't be a problem, but unfortunately not every property was checked for this so you could configure it thinking it will work, but it won't and to make things ever worse without providing you any notice/warning about it. Also in certain scenarios the internal `PTransform` overrides replaced a working solution with another one that could result in lost functionality, because the new one might not support a feature - and to make this even worse this codepath could completely avoid any check in that regard.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/validate-runner/README.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] aaltay commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
aaltay commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1064324030
@TheNeuralBit - would you be able to reply to the open comment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1049266299
I get the JIRA issue part, but what should I write to dev@?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] chamikaramj commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
chamikaramj commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1054925639
I understand that you are trying to make the existing state better by introducing a compatibility check but we are in the process of going towards SDF for all runners and I/O connectors. I think the effort should be on adding whatever pieces missing for SDF (including better runner support) so that this kind of hacks can be removed. I think the proposed solution (and referenced PRs) add more complexity to the code even though it makes the current state a bit better.
cc: @lukecwik @robertwb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] aaltay commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
aaltay commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1078540942
> @TheNeuralBit - would you be able to reply to the open comment?
ping?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] chamikaramj commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
chamikaramj commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1049085805
Thanks for the contribution. Could you create a Jira describing the work done here ? Also, worth dropping an email to Beam dev@ list if you didn't do so already.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali edited a comment on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali edited a comment on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1054957601
The project is in that progress for `KafkaIO` for over 1.5 year already, and it doesn't look like it will be completely replaced soon. Meanwhile the current state can be such a pita to use and the pipeline could do something different than you want it to do quietly so easily _right now_. I mean personally I don't wish the debug sessions I went through to anyone. I don't mind adding a `TODO` in the code to remove this once the SDF support has been fully implemented and it can finally completely replace the legacy solution, but I don't see how waiting for a future implementation/state that has no ETA would be better than shipping this in the upcoming release.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1046788024
R: @chamikaramj
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] TheNeuralBit commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1057408509
I tend to agree with Cham that this is adding a lot of complexity. But I do want to acknowledge this is a legitimate, frustrating problem you're trying to solve and I'm sorry you had to spend so much time debugging it.
Please understand that we (the Beam community) will need to maintain this code going forward, so we just want to make sure we're not incurring technical debt. Although I suppose you might argue we've already incurred debt and you're helping patch it...
One specific concern I have with this approach is that it doesn't provide a guarantee that any future properties only supported by one implementation will be added to the `KafkaIIOReadProperties` enum. We're depending on future authors or reviewers to be disciplined and add them to it (please correct me if I'm wrong). This isn't better from the status quo, where authors should have added specific checks rejecting unsupported properties, and they did not. It would be great if we could find a solution that:
1) Doesn't rely on reflection
2) Enforces that newly added config properties will need to be handled somehow by both implementations
3) (optional) keeps information about supported/unsupported config properties on the implementations instead of splitting it in another file
One idea might be to map the Read instance to a Map of config properties (we could do this by inferring a schema with `AutoValueSchema`, but there may be other options), then we could enforce that every property is consumed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on a change in pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on a change in pull request #16909:
URL: https://github.com/apache/beam/pull/16909#discussion_r816368169
##########
File path: sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
##########
@@ -1354,17 +1356,29 @@ private boolean runnerRequiresLegacyRead(PipelineOptions options) {
}
}
- private static class ReadFromKafkaViaUnbounded<K, V>
+ private abstract static class AbstractReadFromKafka<K, V>
extends PTransform<PBegin, PCollection<KafkaRecord<K, V>>> {
Read<K, V> kafkaRead;
Coder<K> keyCoder;
Coder<V> valueCoder;
- ReadFromKafkaViaUnbounded(Read<K, V> kafkaRead, Coder<K> keyCoder, Coder<V> valueCoder) {
+ AbstractReadFromKafka(
+ Read<K, V> kafkaRead,
+ Coder<K> keyCoder,
+ Coder<V> valueCoder,
+ KafkaIOReadImplementation implementation) {
+ KafkaIOReadImplementationCompatibility.getCompatibility(kafkaRead)
+ .checkSupport(implementation);
this.kafkaRead = kafkaRead;
this.keyCoder = keyCoder;
this.valueCoder = valueCoder;
}
+ }
+
+ static class ReadFromKafkaViaUnbounded<K, V> extends AbstractReadFromKafka<K, V> {
Review comment:
Same input, same output, same functionality, same fields, same caller. Even without the newly introduced extra shared functionality (`Compatibility.checkSupport`) that screams inheritance to me. Obviously I can replace that if that's the convention here, but strictly theoretically speaking IMO the previous implementation was/would be harder to grasp and this actually makes more sense. When you jump around multiple ptransforms and dofns with barely different names, but (almost) the same fields - like I did during this PR - type/class hierarchy and shared call hierarchy is a big help... but as I said, sure I can duplicate the code so they will be independent ptransforms again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1046787605
R: @lukecwik
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] kennknowles commented on a change in pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
kennknowles commented on a change in pull request #16909:
URL: https://github.com/apache/beam/pull/16909#discussion_r814978064
##########
File path: sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
##########
@@ -1354,17 +1356,29 @@ private boolean runnerRequiresLegacyRead(PipelineOptions options) {
}
}
- private static class ReadFromKafkaViaUnbounded<K, V>
+ private abstract static class AbstractReadFromKafka<K, V>
extends PTransform<PBegin, PCollection<KafkaRecord<K, V>>> {
Read<K, V> kafkaRead;
Coder<K> keyCoder;
Coder<V> valueCoder;
- ReadFromKafkaViaUnbounded(Read<K, V> kafkaRead, Coder<K> keyCoder, Coder<V> valueCoder) {
+ AbstractReadFromKafka(
+ Read<K, V> kafkaRead,
+ Coder<K> keyCoder,
+ Coder<V> valueCoder,
+ KafkaIOReadImplementation implementation) {
+ KafkaIOReadImplementationCompatibility.getCompatibility(kafkaRead)
+ .checkSupport(implementation);
this.kafkaRead = kafkaRead;
this.keyCoder = keyCoder;
this.valueCoder = valueCoder;
}
+ }
+
+ static class ReadFromKafkaViaUnbounded<K, V> extends AbstractReadFromKafka<K, V> {
Review comment:
Please don't do this overriding of `expand`. It is quite confusing. Just have two independent `PTransform` classes that implement it their own way. It is not valuable to share local fields across these, really. If you really must share between the two implementations, use composition rather than inheritance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali edited a comment on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali edited a comment on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1057549098
@TheNeuralBit
1. What is the problem with reflection?
2. A unit test (`testKafkaIOReadPropertiesEnumValuePresence`) fails if a property is missing from that enum, so it is already enforced that there can be no new property introduced without taking care of that enum value as well.
3. That is missing, indeed. I did not want to "pollute" the original class, but if the goal would be that then it would require a mandatory annotation on the properties itself instead of an enum elsewhere. Still that won't work "properly" as developers use the `withX` methods not the properties itself, also in many cases there is no 1-to-1 mapping between setters and withers (for example `withKeyDeserializerAndCoder`, `withDynamicRead`, etc). On the other hand the current implementation already provides a descriptive error message, so they can exactly know what is the problem on the very first run without even a deployment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1054957601
The project is in that progress for `KafkaIO` for over 1.5 year already, and it doesn't look like it will be completely replaced soon. Meanwhile the current state can be such a pita to use and the pipeline could do something different than you want it to do quietly so easily _right now_. I mean personally I don't wish the debug sessions I went through to anyone. I don't mind adding a `TODO` in the code to remove this once the SDF support has been fully implemented and it can finally completely replace the legacy solution, but I don't see how would waiting for a future implementation/state that has no ETA would be better than shipping this in the upcoming release.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] nbali commented on pull request #16909: Introducing KafkaIO.Read implementation compatibility testing
Posted by GitBox <gi...@apache.org>.
nbali commented on pull request #16909:
URL: https://github.com/apache/beam/pull/16909#issuecomment-1057549098
@TheNeuralBit
1. What is the problem with reflection?
2. A unit test (`testKafkaIOReadPropertiesEnumValuePresence`) fails if a property is missing from that enum, so it is already enforced that there can be no new property introduced without taking care of that enum value as well.
3. That is missing, indeed. I did not want to "pollute" the original class, but if the goal would be that then it would require a mandatory annotation on the properties itself instead of an enum elsewhere.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org