-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-13228; Ensure ApiVersionRequest is properly handled KRaft co-resident mode #11784
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 4 commits
8f795a4
0e76ad9
ac07a78
d4b9a04
c631dae
58af486
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 |
|---|---|---|
|
|
@@ -140,7 +140,7 @@ class KafkaServer( | |
|
|
||
| var clientToControllerChannelManager: BrokerToControllerChannelManager = null | ||
|
|
||
| var alterIsrManager: AlterPartitionManager = null | ||
| var alterPartitionManager: AlterPartitionManager = null | ||
|
|
||
| var kafkaScheduler: KafkaScheduler = null | ||
|
|
||
|
|
@@ -228,6 +228,8 @@ class KafkaServer( | |
| logContext = new LogContext(s"[KafkaServer id=${config.brokerId}] ") | ||
| this.logIdent = logContext.logPrefix | ||
|
|
||
| val controllerNodeProvider = MetadataCacheControllerNodeProvider(config, metadataCache) | ||
|
|
||
| // initialize dynamic broker configs from ZooKeeper. Any updates made after this will be | ||
| // applied after ZkConfigManager starts. | ||
| config.dynamicConfig.initialize(Some(zkClient)) | ||
|
|
@@ -276,13 +278,14 @@ class KafkaServer( | |
| credentialProvider = new CredentialProvider(ScramMechanism.mechanismNames, tokenCache) | ||
|
|
||
| clientToControllerChannelManager = BrokerToControllerChannelManager( | ||
| controllerNodeProvider = MetadataCacheControllerNodeProvider(config, metadataCache), | ||
| controllerNodeProvider = controllerNodeProvider, | ||
| time = time, | ||
| metrics = metrics, | ||
| config = config, | ||
| channelName = "forwarding", | ||
| threadNamePrefix = threadNamePrefix, | ||
| retryTimeoutMs = config.requestTimeoutMs.longValue) | ||
| retryTimeoutMs = config.requestTimeoutMs.longValue | ||
| ) | ||
| clientToControllerChannelManager.start() | ||
|
|
||
| /* start forwarding manager */ | ||
|
|
@@ -309,20 +312,28 @@ class KafkaServer( | |
| socketServer = new SocketServer(config, metrics, time, credentialProvider, apiVersionManager) | ||
|
|
||
| // Start alter partition manager based on the IBP version | ||
| alterIsrManager = if (config.interBrokerProtocolVersion.isAlterPartitionSupported) { | ||
| alterPartitionManager = if (config.interBrokerProtocolVersion.isAlterPartitionSupported) { | ||
| val alterPartitionChannelManager = BrokerToControllerChannelManager( | ||
|
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. nit: I think I favor creating the
Member
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. I guess we create
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. Consolidation is a little difficult because of head-of-line blocking (sigh). It might be reasonable to combine the alter partition and broker lifecycle channel managers though. Anyway, this is definitely a separate patch. |
||
| controllerNodeProvider, | ||
| time = time, | ||
| metrics = metrics, | ||
| config = config, | ||
| channelName = "alterIsr", | ||
| threadNamePrefix = threadNamePrefix, | ||
| retryTimeoutMs = Long.MaxValue | ||
| ) | ||
| AlterPartitionManager( | ||
| config = config, | ||
| metadataCache = metadataCache, | ||
| alterPartitionChannelManager, | ||
| scheduler = kafkaScheduler, | ||
| time = time, | ||
| metrics = metrics, | ||
| threadNamePrefix = threadNamePrefix, | ||
| brokerEpochSupplier = () => kafkaController.brokerEpoch | ||
| ) | ||
| } else { | ||
| AlterPartitionManager(kafkaScheduler, time, zkClient) | ||
| } | ||
| alterIsrManager.start() | ||
| alterPartitionManager.start() | ||
|
|
||
| // Start replica manager | ||
| _replicaManager = createReplicaManager(isShuttingDown) | ||
|
|
@@ -478,7 +489,7 @@ class KafkaServer( | |
| quotaManagers = quotaManagers, | ||
| metadataCache = metadataCache, | ||
| logDirFailureChannel = logDirFailureChannel, | ||
| alterPartitionManager = alterIsrManager, | ||
| alterPartitionManager = alterPartitionManager, | ||
| brokerTopicStats = brokerTopicStats, | ||
| isShuttingDown = isShuttingDown, | ||
| zkClient = Some(zkClient), | ||
|
|
@@ -755,8 +766,8 @@ class KafkaServer( | |
| if (replicaManager != null) | ||
| CoreUtils.swallow(replicaManager.shutdown(), this) | ||
|
|
||
| if (alterIsrManager != null) | ||
| CoreUtils.swallow(alterIsrManager.shutdown(), this) | ||
| if (alterPartitionManager != null) | ||
| CoreUtils.swallow(alterPartitionManager.shutdown(), this) | ||
|
|
||
| if (clientToControllerChannelManager != null) | ||
| CoreUtils.swallow(clientToControllerChannelManager.shutdown(), this) | ||
|
|
||
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 is the source of the bug, we always assume currentNodeApiVersions=
ApiKeys.zkBrokerApis