Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This command will 1) create a meta.properties file in metadata.log.dir with a randomly generated directory.id, 2) create a snapshot at 00000000000000000000-0000000000.checkpoint with the necessary control records (KRaftVersionRecord kraft.versionRecord and AddVoterRecord) to make this Kafka node the only voter for the quorum.

...

This command will parse the release-version to the matching MetadataVersion and KRaftVersionkraft.version. It will send a UpdateFeatures request to a node with both features set to the matching version. KRaft will write the KRaftVersionRecord kraft.versionRecord control record, if all of the controllers and brokers support the new version. KRaft will use the information in the controller registration, broker registration and add voter records to determine if the new version is compatible.

...

  1. kafka-storage format command will generate a directory id for all of the log directories including the metadata log dir.
  2. meta.properties exists but it doesn't include a directory.id property. This case will generate and persist a directory id to support upgrade from Kafka versions that don't support this feature to versions that support this feature.

Supported features

This feature can only be enabled if all of the voters (controllers) and observers (brokers) support this feature. This is required mainly because this feature needs two write two new control records (AddVoter and RemoveVoter) to the KRaft cluster metadata partition. All replicas need to be able to read and decode these new records.

There will be a new SupportedFeature added to the ApiVersions response of the Kafka nodes. The name of this new supported feature will be kraft.version. The default value be 0 and represents that only KIP-595: A Raft Protocol for the Metadata QuorumKIP-630: Kafka Raft Snapshot and KIP-996: Pre-Vote are supported. Version 1 means that this KIP is supported.

When the clients sends a UpdateFeatures RPC to the active controller, if the FeatureUpdates.Feature property is kraft.version, the associated information will be passed to KRaft client. The KRaft client will implement two different algorithm if the upgrade is supported by voters and observers. For voters the KRaft client will comparing the upgraded version against all of the persisted AddVoter and RemoveVoter records for the KRaft cluster metadata partition. The KRaft client cannot do this for observers (brokers) since their supported versions are not persisted in the log. The controller will instead push the broker registration information to the KRaft clientTODO: Talk about ApiVersions and UpdateFeatures RPCs.

Voter Changes

Adding Voters

...

If there are no pending voter change operations the leader send an ApiVersions request to the new voter's endpoint to discover it's KRaftVersion kraft.version support features. If the new leader supports the current KRaftVersion kraft.version, it will write a AddVoterRecord to the log and immediately update its in-memory quorum state to include this voter as part of the quorum. Any replica that replicates and reads this AddVoterRecord will update their in-memory voter set to include this new voter. Voters will not wait for these records to get committed before updating their voter set.

...

This is a static quorum configuration where all of the voters' ID, host and port are specified. An example value for this configuration is 1@localhost:9092,2@localhost:9093,3@localhost:9094 .

If the KRaftVersion kraft.version is 0, this properties will be used to configure the set of voters for the KRaft cluster metadata partition.

When the KRaftVersion kraft.version is upgraded to a version greater 0 and the version is supported by the voters, the leader will write a control record batch that will include the KRaftVersion kraft.version record and all of the AddVoter records for all of the voters. This will allow KRaft to ignore the controller.quorum.voters properties and instead rely solely on the log state when it is upgraded to KRaftVersion kraft.version 1.

controller.quorum.bootstrap.servers

...

When using this configuration for a new cluster, the quorum should be started with only one voter. This voter is bootstrapped by running the kafka- storage tool format command. This tool will create the cluster metadata partition and append one AddVoterRecord to it. Additional voters can get added by using the AddVoter RPC as described in this KIP.

...