-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-1683: persisting session information in Requests #155
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
Changes from 1 commit
d97449d
e55c50b
d4d4ed7
ba8a334
8d40258
48821bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| package kafka.network | ||
|
|
||
| import java.nio.ByteBuffer | ||
| import java.security.Principal | ||
| import java.util.concurrent._ | ||
|
|
||
| import com.yammer.metrics.core.Gauge | ||
|
|
@@ -44,7 +45,9 @@ object RequestChannel extends Logging { | |
| byteBuffer | ||
| } | ||
|
|
||
| case class Request(processor: Int, connectionId: String, private var buffer: ByteBuffer, startTimeMs: Long, securityProtocol: SecurityProtocol) { | ||
| case class Session(principal: Principal, host: String) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
update: I can see some methods/fields related to valid session state (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the name is bad, but we didn't really plan on session IDs.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, nice. :) 👍 Yeah... maybe |
||
|
|
||
| case class Request(processor: Int, connectionId: String, session: Session = null, private var buffer: ByteBuffer, startTimeMs: Long, securityProtocol: SecurityProtocol) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normally, one would use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope :) Actually, since we always have a Session, I don't think Option is needed.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, even better. |
||
| @volatile var requestDequeueTimeMs = -1L | ||
| @volatile var apiLocalCompleteTimeMs = -1L | ||
| @volatile var responseCompleteTimeMs = -1L | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -404,7 +404,10 @@ private[kafka] class Processor(val id: Int, | |
| } | ||
| collection.JavaConversions.collectionAsScalaIterable(selector.completedReceives).foreach(receive => { | ||
| try { | ||
| val req = RequestChannel.Request(processor = id, connectionId = receive.source, buffer = receive.payload, startTimeMs = time.milliseconds, securityProtocol = protocol) | ||
|
|
||
| val channel = selector.channelForId(receive.source); | ||
| val session = RequestChannel.Session(channel.principal(), channel.socketDescription()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: |
||
| val req = RequestChannel.Request(processor = id, connectionId = receive.source, session = session, buffer = receive.payload, startTimeMs = time.milliseconds, securityProtocol = protocol) | ||
| requestChannel.sendRequest(req) | ||
| } catch { | ||
| case e @ (_: InvalidRequestException | _: SchemaException) => { | ||
|
|
||
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.
should we log a warning here
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.
yeah, since we are caching the Principal in the authenticator, warning here makes sense.
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.
btw. this is pretty weird - the session and the tests are on the server side, but since we are using the client network layer, you need to have log4j.logger.org.apache.kafka=WARN to see this warning.
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.
Just for my benefit, what would this warning indicate to a Kafka user? Can they do something about it?
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 will indicate that even though they are using SSL, it is SSL without authentication (just encryption). It could be intentional, but could also be a misconfiguration (such as misplaced key files), hence warning.
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.
Understood, thanks.