GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [SPARK-12177] Refactored some API in Kafka 0.10 to make public API simpler by tdas · Pull Request #13996 · apache/spark Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Test build #61540 has finished for PR 13996 at commit
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import org.apache.spark.annotation.Experimental; | ||
|
|
||
| /** | ||
| * :: Experimental :: Choice of how to create and configure underlying Kafka Consumers on driver and |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
fix docs
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Test build #61541 has finished for PR 13996 at commit
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've got concerns about this, please don't merge these refactorings until I
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Test build #61543 has finished for PR 13996 at commit
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll leave line comments about specific things, but my major overarching concern is about moving the interface to a Java abstract class. As far as I can tell, nothing being done in that class couldn't be done in Scala. If this is just a reaction to not wanting autogenerated apply methods, nothing's stopping us from making a standalone non-companion object with the exact same interface you're proposing. More important in my opinion is the reasoning behind moving to an abstract class. Nothing about the definition of that interface requires constructor state, so a class doesn't make sense. If your thinking here is that you want to be able to later add methods with a default implementation without relying on Java 8 features... I'm really opposed to this line of reasoning. This is prioritizing binary compatibility at the cost of silently breaking people's code when APIs really do need to change. If the interface needs to change, and a bunch of people have already implemented that interface in their own code, which would you rather have as a user? Know at compile time that this interface, (which is marked as experimental) needs to change, figure out how it changed, and write the right thing for your use case? Or silently have it "work"... until you find out at runtime (or in a business meeting about why metrics are now wrong) that the default implementation the spark project added does totally the wrong thing for your use case? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * NOT zookeeper servers, specified in host1:port1,host2:port2 form. | ||
| * @param consumerStrategy In most cases, pass in [[Subscribe]], | ||
| * see [[ConsumerStrategy]] for more details | ||
| * @param consumerStrategy In most cases, pass in [[SubscribeStrategy]], |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You can't hide PreferConsistent and SusbscribeStrategy from users and then tell them to pass it in...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
So another concrete reason I'm against moving the strategy interfaces to java is that LocationStrategy is no longer sealed, so we lose exhaustivity checking on the cases. LocationStrategy is a tagged union / sum type / whatever you want to call it. It's definitely not an OO hierarchy, and users shouldn't be extending it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
See the linked pr #13998 for an example of what I'm proposing. I'll make sure the same thing works for consumer strategy and update that pr. If you let me know where you were actually running into serialization issues I can address those too - see note above. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
|
|
||
| public static LocationStrategy PreferFixed(Map<TopicPartition, String> hostMap) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit: docs?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Let me note down all the concerns clearly.
The resultant public interfaces are as expected. So this should be fine if written in Scala.
Your PR #13998 is going in the right direction. I am stuck for the next couple of hours in meetings. So if you dont mind could you update your PR? In addition, for testing, I noticed that the JavaConsumerStrategySuite used |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
"When abstract class, you can later add defined methods which the users can override if needed, but does not break compatibility of existing implementations." This is what I'm taking issue with. It's confusing binary compatibility with actual api compatibility. Changing the class and silently slipping in a new default method into someone's code may preserve binary compatibility, at the cost of actually breaking their code at runtime and losing them their job. Clearly not a big change from a lines of code perspective to move trait to abstract class, so I can do it quickly, but I'd like to at least hear your response to that concern. Other changes, no concerns, I can add them to my pr |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I am closing this PR. This PR is superseded by #13998 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.