Skip to content

KAFKA-6772: Load credentials from ZK before accepting connections#4867

Merged
rajinisivaram merged 4 commits intoapache:trunkfrom
rajinisivaram:KAFKA-6772
Apr 18, 2018
Merged

KAFKA-6772: Load credentials from ZK before accepting connections#4867
rajinisivaram merged 4 commits intoapache:trunkfrom
rajinisivaram:KAFKA-6772

Conversation

@rajinisivaram
Copy link
Copy Markdown
Contributor

@rajinisivaram rajinisivaram commented Apr 13, 2018

Start processing client connections only after completing KafkaServer initialization to ensure that credentials are loaded from ZK into cache before authentications are processed. Acceptors are started earlier so that bound port is known for registering in ZK.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@rajinisivaram rajinisivaram requested a review from junrao April 13, 2018 10:59
@omkreddy
Copy link
Copy Markdown
Contributor

omkreddy commented Apr 13, 2018

LGTM.

Just for my understanding, Will there be any issue, if server starts receiving incoming connections only after completing the initialization of the server?

@rajinisivaram
Copy link
Copy Markdown
Contributor Author

@omkreddy Thanks for the review. At the moment we create and start the acceptors and processors in SocketServer together. We need to start acceptors early on in order to register brokers in ZK with the bound port for the listeners. My second choice was to delay starting processors, but since the simple reordering worked, I didn't actually try that out.

@rajinisivaram
Copy link
Copy Markdown
Contributor Author

@omkreddy I tried out delayed processor start and that wasn't as big a change as I expected. So I have updated the PR. I think this will be easier to maintain compared to managing the ordering within KafkaServer.

Copy link
Copy Markdown
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@rajinisivaram : Thanks for the patch. LGTM. Just a minor comment below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not directly related to this patch. However, it seems that we need some synchronization on processor between the reader and the writer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@junrao Thanks for the review. We were already synchronizing on all read/write accesses to processors apart from shutdown(). I think that was safe anyway, but I have added synchronize in shutdown as well to be consistent.

Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, left a couple of minor comments.


def startProcessors(): Unit = synchronized {
acceptors.values.asScala.foreach { _.startProcessors() }
info("Started processors for " + acceptors.size + " acceptors")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: use string interpolation?

// that credentials have been loaded before processing authentications.
socketServer = new SocketServer(config, metrics, time, credentialProvider)
socketServer.startup()
socketServer.startup(startupProcessors = false)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should document the new parameter in the scaladoc for startup and the reason why it's needed (i.e. people shouldn't have to read the comments in a particular usage to understand it). We should also include the actual behaviour impact (e.g. what happens to the requests that arrive while the processors are not started).

@rajinisivaram
Copy link
Copy Markdown
Contributor Author

@ijuma Thanks for the review, I have addressed the comments.

@rajinisivaram
Copy link
Copy Markdown
Contributor Author

Merging to trunk, 1.1 and 1.0.

@rajinisivaram rajinisivaram merged commit 98bb75a into apache:trunk Apr 18, 2018
rajinisivaram added a commit that referenced this pull request Apr 18, 2018
)

Start processing client connections only after completing KafkaServer initialization to ensure that credentials are loaded from ZK into cache before authentications are processed. Acceptors are started earlier so that bound port is known for registering in ZK.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Jun Rao <junrao@gmail.com>, Ismael Juma <ismael@juma.me.uk>
rajinisivaram added a commit that referenced this pull request Apr 18, 2018
)

Start processing client connections only after completing KafkaServer initialization to ensure that credentials are loaded from ZK into cache before authentications are processed. Acceptors are started earlier so that bound port is known for registering in ZK.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Jun Rao <junrao@gmail.com>, Ismael Juma <ismael@juma.me.uk>
ijuma added a commit to confluentinc/kafka that referenced this pull request Apr 25, 2018
* confluent/1.1: (60 commits)
  MINOR: Fix kafka-run-class for Java 10 (apache#4895)
  KAFKA-6772: Load credentials from ZK before accepting connections (apache#4867)
  KAFKA-6742: TopologyTestDriver error when dealing with stores from GlobalKTable
  MINOR: Mention that -1 disables retention by time (apache#4881)
  KAFKA-6790: Fix Streams processor node broken link (apache#4874)
  MINOR: Java 10 fixes so that the build passes (apache#4839)
  MINOR: Update Jackson to 2.9.5 (apache#4776)
  MINOR: Downgrade to Gradle 4.5.1 (apache#4791)
  MINOR: Java 9/10 fixes, gradle and minor deps update (apache#4725)
  KAFKA-6752: Enable unclean leader election metric (apache#4838)
  KAFKA-6054: Fix upgrade path from Kafka Streams v0.10.0 (apache#4773)
  KAFKA-6747 Check whether there is in-flight transaction before aborting transaction (apache#4826)
  KAFKA-6748: double check before scheduling a new task after the punctuate call (apache#4827)
  KAFKA-6739; Ignore headers when down-converting from V2 to V0/V1 (apache#4813)
  KAFKA-6728: Corrected the worker’s instantiation of the HeaderConverter
  KAFKA-6731: waitOnState should check the state to be the target start. (apache#4808)
  HOTFIX: Enforce a rebalance upon task migration (apache#4802)
  MINOR: Remove 1.2.0 changes from streams doc (apache#4784)
  MINOR: Update version numbers to 1.1.1-SNAPSHOT
  MINOR: Fix ReassignPartitionsClusterTest.testHwAfterPartitionReassignment test (apache#4781)
  ...
jeqo pushed a commit to jeqo/kafka that referenced this pull request May 2, 2018
…ache#4867)

Start processing client connections only after completing KafkaServer initialization to ensure that credentials are loaded from ZK into cache before authentications are processed. Acceptors are started earlier so that bound port is known for registering in ZK.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Jun Rao <junrao@gmail.com>, Ismael Juma <ismael@juma.me.uk>
ying-zheng pushed a commit to ying-zheng/kafka that referenced this pull request Jul 6, 2018
…ache#4867)

Start processing client connections only after completing KafkaServer initialization to ensure that credentials are loaded from ZK into cache before authentications are processed. Acceptors are started earlier so that bound port is known for registering in ZK.

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>, Jun Rao <junrao@gmail.com>, Ismael Juma <ismael@juma.me.uk>
allenxwang pushed a commit to allenxwang/kafka that referenced this pull request Aug 24, 2018
…:1.1-nflx to 1.1-nflx

* commit '84eeea7fe4b3a64b84b87d231969acfee4fb7544':
  Fix a bug where the ReqeustPerSec API version hash map is not updated.
  KAFKA-6772: Load credentials from ZK before accepting connections (apache#4867)
  KAFKA-6742: TopologyTestDriver error when dealing with stores from GlobalKTable
  MINOR: Mention that -1 disables retention by time (apache#4881)
  KAFKA-6790: Fix Streams processor node broken link (apache#4874)
  MINOR: Java 10 fixes so that the build passes (apache#4839)
  MINOR: Update Jackson to 2.9.5 (apache#4776)
  MINOR: Downgrade to Gradle 4.5.1 (apache#4791)
  MINOR: Java 9/10 fixes, gradle and minor deps update (apache#4725)
  KAFKA-6752: Enable unclean leader election metric (apache#4838)
  KAFKA-6054: Fix upgrade path from Kafka Streams v0.10.0 (apache#4773)
  KAFKA-6747 Check whether there is in-flight transaction before aborting transaction (apache#4826)
  KAFKA-6748: double check before scheduling a new task after the punctuate call (apache#4827)
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