KAFKA-8304: Fix registration of Connect REST extensions#6651
KAFKA-8304: Fix registration of Connect REST extensions#6651rhauch merged 6 commits intoapache:trunkfrom
Conversation
|
@wicknicks @mageshn this touches on code that you've both done non-trivial work on (integration test harness changes and REST extensions), I'd be grateful if you could take a look and let me know what you think :) |
|
@C0urante: I'm guessing you want to backport this fix, what version do you think is most appropriate? I think we can go back all the way to 2.0. If so, let's add that to the description for the committer. Thanks! |
|
@wicknicks thanks for the review. I've implemented many of your suggestions and left a comment on any that I'd like to discuss further before including here. Ready for the next round when you have time! |
wicknicks
left a comment
There was a problem hiding this comment.
almost there. last couple of comments.
|
Thanks @wicknicks, I agree with your suggestions and have implemented them accordingly. Ready for the next round |
|
Thanks @wicknicks, I've made the alteration you suggested and this is ready for the next round |
|
Thanks @wicknicks! @rhauch could you please take a look when you have a chance? |
Fix registration of Connect REST extensions to prevent deadlocks when extensions get the list of connectors before the herder is available. Added integration test to check the behavior. Author: Chris Egerton <cegerton@oberlin.edu> Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
Fix registration of Connect REST extensions to prevent deadlocks when extensions get the list of connectors before the herder is available. Added integration test to check the behavior. Author: Chris Egerton <cegerton@oberlin.edu> Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
Fix registration of Connect REST extensions to prevent deadlocks when extensions get the list of connectors before the herder is available. Added integration test to check the behavior. Author: Chris Egerton <cegerton@oberlin.edu> Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
…s-hashcode * apache-github/trunk: KAFKA-8158: Add EntityType for Kafka RPC fields (apache#6503) MINOR: correctly parse version OffsetCommitResponse version < 3 KAFKA-8284: enable static membership on KStream (apache#6673) KAFKA-8304: Fix registration of Connect REST extensions (apache#6651) KAFKA-8275; Take throttling into account when choosing least loaded node (apache#6619) KAFKA-3522: Interactive Queries must return timestamped stores (apache#6661) MINOR: MetricsIntegrationTest should set StreamsConfig.STATE_DIR_CONFIG (apache#6687) MINOR: Remove unused field in `ListenerConnectionQuota` KAFKA-8131; Move --version implementation into CommandLineUtils (apache#6481) KAFKA-8056; Use automatic RPC generation for FindCoordinator (apache#6408) MINOR: Remove workarounds for lz4-java bug affecting byte buffers (apache#6679) KAFKA-7455: Support JmxTool to connect to a secured RMI port. (apache#5968) MINOR: Document improvement (apache#6682) MINOR: Fix ThrottledReplicaListValidator doc error. (apache#6537) KAFKA-8306; Initialize log end offset accurately when start offset is non-zero (apache#6652)
Corrects the system tests to check for either a 404 or a 409 error and sleeping until the Connect REST API becomes available. This corrects a previous change to how REST extensions are initialized (apache#6651), which added the ability of Connect throwing a 404 if the resources are not yet started. The integration tests were already looking for 409. Author: Magesh Nandakumar <magesh.n.kumar@gmail.com> Reviewer: Randall Hauch <rhauch@gmail.com>
Corrects the system tests to check for either a 404 or a 409 error and sleeping until the Connect REST API becomes available. This corrects a previous change to how REST extensions are initialized (#6651), which added the ability of Connect throwing a 404 if the resources are not yet started. The integration tests were already looking for 409. Author: Magesh Nandakumar <magesh.n.kumar@gmail.com> Reviewer: Randall Hauch <rhauch@gmail.com>
Corrects the system tests to check for either a 404 or a 409 error and sleeping until the Connect REST API becomes available. This corrects a previous change to how REST extensions are initialized (#6651), which added the ability of Connect throwing a 404 if the resources are not yet started. The integration tests were already looking for 409. Author: Magesh Nandakumar <magesh.n.kumar@gmail.com> Reviewer: Randall Hauch <rhauch@gmail.com>
Corrects the system tests to check for either a 404 or a 409 error and sleeping until the Connect REST API becomes available. This corrects a previous change to how REST extensions are initialized (#6651), which added the ability of Connect throwing a 404 if the resources are not yet started. The integration tests were already looking for 409. Author: Magesh Nandakumar <magesh.n.kumar@gmail.com> Reviewer: Randall Hauch <rhauch@gmail.com>
Fix registration of Connect REST extensions to prevent deadlocks when extensions get the list of connectors before the herder is available. Added integration test to check the behavior. Author: Chris Egerton <cegerton@oberlin.edu> Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
Corrects the system tests to check for either a 404 or a 409 error and sleeping until the Connect REST API becomes available. This corrects a previous change to how REST extensions are initialized (apache#6651), which added the ability of Connect throwing a 404 if the resources are not yet started. The integration tests were already looking for 409. Author: Magesh Nandakumar <magesh.n.kumar@gmail.com> Reviewer: Randall Hauch <rhauch@gmail.com>
Jira
Currently, a REST extension can cause deadlock if it requests the list of connectors from its
ConnectRestExtensionContext.clusterState()in itsConnectRestExtension.register(...)method. This is because theConnectClusterStateimplementation is backed by aHerderProviderthat, at that time, has no associatedHerderinstance, and since thatHerderis given to theHerderProviderlater by the same thread, deadlock occurs until the call toHerderProvider.get()made by theConnectClusterStateImpltimes out. At this point, startup fails and the Connect worker dies.The changes here separate
RestServer.start(...)into two separate methods. The first,RestServer.initializeServer(), starts the Jetty server and binds to a port, which ensure the accuracy of theRestServer.advertisedUrl()method that is used later on by both theConnectStandaloneandConnectDistributedclasses to determine the worker ID. The second,RestServer.initializeResources(Herder herder)actually creates the Connect REST resources (RootResource,ConnectorsResource, etc.) and registers all REST extensions.Since these changes make
HerderProviderobsolete and it is not part of any public API, that interface is also removed.This approach ensures that the Connect REST interface is started only when all of its REST extensions have been successfully registered, which is important for security use cases where request filters are installed and parts of the Connect REST API are subject to authentication/authorization.
Between the call to
RestServer.intializeServer()andRestServer.initializeResources(...), any requests made to the worker will result in a 404 response. This is slightly less desirable than the current behavior, which is to block on requests until the herder is up and running, but shouldn't be too much of an issue.A new integration test is added that verifies that a call to
ConnectRestExtensionContext.clusterState().connectors()succeeds. This test fails on the currenttrunkbranch, and succeeds with the changes involved in this PR.These changes should be backported through to 2.0.
Committer Checklist (excluded from commit message)