mumrah commented on code in PR #23338:
URL: https://github.com/apache/kafka/pull/23338#discussion_r3980332938
##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -1240,11 +1243,16 @@ class CompleteActivationEvent implements
ControllerWriteOperation<Void> {
@Override
public ControllerResult<Void> generateRecordsAndResult() {
try {
+ Set<Integer> stillZkRegisteredBrokerIds =
clusterControl.brokerRegistrations().values().stream()
+ .filter(BrokerRegistration::isMigratingZkBroker)
+ .map(BrokerRegistration::id)
+ .collect(Collectors.toCollection(TreeSet::new));
Review Comment:
I am guessing you are putting these into a TreeSet so they will appear in
order in the log message?
If that's the case, maybe name this variable
`sortedStillZkRegisteredBrokerIds` or similar.
##########
metadata/src/main/java/org/apache/kafka/controller/ActivationRecordsGenerator.java:
##########
@@ -182,10 +184,17 @@ static ControllerResult<Void> recordsForNonEmptyLog(
// This can happen if controller leadership transfers
to a controller with migrations enabled
// after another controller had finalized the
migration. For example, during a rolling restart
// of the controller quorum during which the migration
config is being set to false.
- logMessageBuilder
- .append("Completing the ZK migration since this
controller was configured with ")
- .append("'zookeeper.metadata.migration.enable' set
to 'false'. ");
-
records.add(ZkMigrationState.POST_MIGRATION.toRecord());
+ if (!stillZkRegisteredBrokerIds.isEmpty()) {
+ logMessageBuilder
+ .append("Cannot complete ZK migration because
the following broker(s) are still registered as ZK brokers: ")
Review Comment:
For the actual error message, we should indicate what the problem is (like
you've done) but also how to fix it.
```
Staying in ZK migration mode even though
'zookeeper.metadata.migration.enable' set to 'false' because the following
broker(s) are still registered as ZK brokers: [0, 1]. These brokers must be
migrated to KRaft before the controller can finalize the migration.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]