Quick revision
The short answer
We upgrade one node at a time: controlled shutdown, install Kafka 4.1, start, and wait until UnderReplicatedPartitions is back to 0 (or, for a controller, until the quorum shows it caught up) before the next node. metadata.version sets the format of the records in the metadata log and which features the cluster may use, and it stays at the 4.0 level after the binaries change, as do other feature levels such as group.version, transaction.version and kraft.version. Only after the cluster has run well on the new binaries do we finalize with kafka-features.sh upgrade, because lowering metadata.version afterwards may be impossible or lossy.
What to remember
In this answer, we saw that a rolling upgrade restarts one node at a time with controlled shutdown and waits until UnderReplicatedPartitions is 0, or the controller has caught up in the quorum, before the next. metadata.version and the other feature levels, group.version, transaction.version and kraft.version, stay at the old level after the binaries change, so the cluster behaves like 4.0 and rollback stays easy. We finalize with kafka-features.sh upgrade only after the cluster has run well, because lowering metadata.version later may be impossible or lossy, and we prepare with the release notes and a staging rehearsal.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We upgrade one node at a time: controlled shutdown, install Kafka 4.1, start, and wait until UnderReplicatedPartitions is back to 0 (or, for a controller, until the quorum shows it caught up) before the next node. metadata.version sets the format of the records in the metadata log and which features the cluster may use, and it stays at the 4.0 level after the binaries change, as do other feature levels such as group.version, transaction.version and kraft.version. Only after the cluster has run well on the new binaries do we finalize with kafka-features.sh upgrade, because lowering metadata.version afterwards may be impossible or lossy.
Why this question is asked
Upgrades are where a healthy Kafka cluster is most at risk, because every node restarts and the cluster runs with mixed versions for a while. Kafka makes this safe by separating two things that are easy to confuse: the version of the software on each node, and the version of the features the cluster as a whole uses. Interviewers ask this to see whether we understand that separation and when to cross the line that cannot easily be crossed back. In this answer, we will recap binaries and feature versions, walk through the rolling upgrade, explain metadata.version and its siblings, decide when to finalize, and prepare with the release notes and a staging rehearsal.
1A Quick Recap: Binaries Versus Feature Versions
Our cluster has 3 controllers, which run the KRaft quorum and keep the cluster metadata in a replicated log, and 9 brokers, which store and serve the data. Each node runs some version of the Kafka software, the binaries. During a rolling upgrade, some nodes run 4.0 and some run 4.1, and they must still understand each other.
They manage that because the cluster agrees on finalized feature versions, levels that every node must support. As long as the finalized levels stay at what 4.0 understands, a 4.1 node behaves compatibly, writing metadata in the old format and not using new features. So upgrading the binaries and raising the feature levels are two separate steps, done at different times.
2The Rolling Upgrade, One Node at a Time
We restart one node, check that the cluster is fully healthy, and only then touch the next. For a broker, controlled shutdown first moves the leadership of its partitions to other replicas, so clients see a short leader change rather than errors. After the restart, the broker must catch up on what it missed, and we wait until UnderReplicatedPartitions is back to 0, which means every follower on it is in sync again. For a controller, we wait until the quorum shows the restarted node caught up with the leader of the metadata log.
- Controlled shutdownSIGTERM; leaders move away
- Install 4.1 binaries, keep config
metadata.versionunchanged - Start the noderegisters with the controllers
- Broker: UnderReplicatedPartitions = 0?YesNext nodeNoWait, investigate if stuck
- Controller: caught up in quorum?YesNext nodeNoWait for describe --replication lag 0
5 steps in order. Play them, or step through them one at a time.
The waiting step is the one that keeps the cluster safe.
Controllers and brokers are each rolled one at a time; the release's upgrade notes say whether a particular order is required, so we follow them. With 12 nodes and perhaps 10 minutes per broker to catch up, the roll takes a couple of hours, and it should, because the waiting is what keeps every partition with enough in-sync replicas.
3What metadata.version Is
In KRaft, all cluster metadata, topics, partitions, configs, ACLs and broker registrations, is a log of records. metadata.version is a feature level that decides which record formats may be written to that log and which metadata-dependent features are enabled. After all nodes run 4.1, metadata.version is still at the 4.0 level, so the cluster still behaves like 4.0 in every way that depends on it. That is deliberate: if a problem shows up on the new binaries, we can still roll back to 4.0, because nothing has been written that 4.0 cannot read.
Notice the two numbers for each feature. Supported is what every node's binaries can handle; finalized is what the cluster actually uses. A finalized level below the supported maximum means the cluster could move up but has not yet.
4The Other Feature Levels
Kafka 4.x has more feature levels next to metadata.version, each controlling a newer protocol so it can be switched on independently. group.version enables the new consumer group protocol, where the broker coordinates assignments. transaction.version enables the newer transaction protocol with stronger guarantees against zombie transactions. kraft.version controls the KRaft quorum itself, for example whether controllers can be added and removed dynamically. Releases may add further levels for preview features. Each one is finalized with the same tool, and each has its own notes on whether it can be lowered again.
| Feature | Controls | Lower it later? |
|---|---|---|
metadata.version | Metadata record formats, many features | Often not, or only with loss |
group.version | New consumer group protocol | Check the release notes |
transaction.version | Newer transaction protocol | Check the release notes |
kraft.version | Quorum features, dynamic controllers | No once raised |
5Finalizing: When and Why We Wait
Once all 12 nodes run 4.1 and the cluster has behaved well for a while, typically a few days to a week covering a normal weekly traffic cycle, we raise the feature levels.
The reason to wait is that this is the point of no easy return. After metadata.version is raised, new record formats may be written, which 4.0 binaries cannot read. Lowering metadata.version again may be refused outright, or allowed only as an unsafe downgrade that throws away metadata the old version cannot represent. So once we finalize, rolling the binaries back to 4.0 is no longer a simple option. Before that moment, it is.
6Before We Start: Notes and a Rehearsal
Every release's upgrade notes list removed or renamed configs, changed defaults and client compatibility rules. Kafka 4.x, for example, dropped many very old client protocol versions, so a very old client library could stop working against an upgraded broker. Reading the notes and checking our configs against them takes an hour and prevents the most embarrassing failures.
Then we rehearse the same path, 4.0 to 4.1, roll and finalize, on a staging cluster with production-like clients, including the oldest client libraries we have. The rehearsal also tells us how long each node takes to catch up, which sets realistic gates for the production roll.
7Follow-up questions
Can we skip the waiting between nodes if the cluster is small?
No. Waiting for UnderReplicatedPartitions to return to 0 is what guarantees that restarting the next node does not take a partition below min.insync.replicas or offline. Size does not change that; it only changes how long each wait is.
What happens if we never finalize?
The cluster keeps working on the new binaries with old feature levels, but new features that depend on them stay off. Eventually a later release may stop supporting such old levels, so we finalize after each upgrade once it has proved stable.
Do clients need to upgrade first?
Usually not. Brokers support a range of client versions, and a client upgrade is independent. The release notes say which old client versions are no longer supported.
8Conclusion
In this answer, we saw that a rolling upgrade restarts one node at a time with controlled shutdown and waits until UnderReplicatedPartitions is 0, or the controller has caught up in the quorum, before the next. metadata.version and the other feature levels, group.version, transaction.version and kraft.version, stay at the old level after the binaries change, so the cluster behaves like 4.0 and rollback stays easy. We finalize with kafka-features.sh upgrade only after the cluster has run well, because lowering metadata.version later may be impossible or lossy, and we prepare with the release notes and a staging rehearsal.
Open with
I would roll one node at a time. For each broker, a controlled shutdown so leadership moves away, install 4.1 with the same config, start it, and wait until UnderReplicatedPartitions is back to zero before touching the next.
Then, if they want more
For each controller, the same, but I wait until kafka-metadata-quorum describe shows it caught up with the quorum leader. I follow the release notes on ordering. The key concept is that binaries and feature versions are separate. metadata.version decides the format of records in the KRaft metadata log and which features the cluster may use.
After all nodes run 4.1 it is still at the 4.0 level, so the cluster behaves like 4.0, and I can still roll back the binaries. Kafka 4.x has other levels next to it, like group.version for the new consumer group protocol, transaction.version and kraft.version, and kafka-features.sh describe shows supported and finalized levels for each.
Once the cluster has run well on 4.1 for a few days, I finalize with kafka-features.sh upgrade metadata 4.1, or release-version on newer tools. I wait because that is the point of no easy return: lowering metadata.version afterwards may be impossible or lossy, so rolling back to 4.0 is no longer simple.
Before any of this, I would read the upgrade notes for removed configs and client compatibility and rehearse the whole path on staging.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.1
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Describe the rolling upgrade, explain what metadata.version and the other feature...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/f84b5f8f0a/