kafka/checkstyle
Colin Patrick McCabe f0f918b242
KAFKA-14177: Correctly support older kraft versions without FeatureLevelRecord (#12513)
The main changes here are ensuring that we always have a metadata.version record in the log, making
˘sure that the bootstrap file can be used for records other than the metadata.version record (for
example, we will want to put SCRAM initialization records there), and fixing some bugs.

If no feature level record is in the log and the IBP is less than 3.3IV0, then we assume the minimum KRaft
version for all records in the log.

Fix some issues related to initializing new clusters. If there are no records in the log at all,
then insert the bootstrap records in a single batch. If there are records, but no metadata version,
process the existing records as though they were metadata.version 3.3IV0 and then append a metadata
version record setting version 3.3IV0.  Previously, we were not clearly distinguishing between the
case where the metadata log was empty, and the case where we just needed to add a metadata.version
record.

Refactor BootstrapMetadata into an immutable class which contains a 3-tuple of metadata version,
record list, and source. The source field is used to log where the bootstrap metadata was obtained
from. This could be a bootstrap file, the static configuration, or just the software defaults.
Move the logic for reading and writing bootstrap files into BootstrapDirectory.java.

Add LogReplayTracker, which tracks whether the log is empty.

Fix a bug in FeatureControlManager where it was possible to use a "downgrade" operation to
transition to a newer version. Do not store whether we have seen a metadata version or not in
FeatureControlManager, since that is now handled by LogReplayTracker.

Introduce BatchFileReader, which is a simple way of reading a file containing batches of snapshots
that does not require spawning a thread. Rename SnapshotFileWriter to BatchFileWriter to be
consistent, and to reflect the fact that bootstrap files aren't snapshots.

QuorumController#processBrokerHeartbeat: add an explanatory comment.

Reviewers: David Arthur <mumrah@gmail.com>, Jason Gustafson <jason@confluent.io>
2022-08-25 18:12:31 -07:00
..
.scalafmt.conf Add license header in suppressions.xml (#11753) 2022-02-17 14:35:36 +08:00
checkstyle.xml Add license header in suppressions.xml (#11753) 2022-02-17 14:35:36 +08:00
import-control-core.xml KAFKA-14124: improve quorum controller fault handling (#12447) 2022-08-04 22:49:45 -07:00
import-control-jmh-benchmarks.xml Add license header in suppressions.xml (#11753) 2022-02-17 14:35:36 +08:00
import-control.xml KAFKA-14177: Correctly support older kraft versions without FeatureLevelRecord (#12513) 2022-08-25 18:12:31 -07:00
java.header MINOR: improve license header check by providing head file instead of (prefix) header regex 2017-02-28 12:35:04 -08:00
suppressions.xml KAFKA-14177: Correctly support older kraft versions without FeatureLevelRecord (#12513) 2022-08-25 18:12:31 -07:00