Commit Graph

317 Commits

Author SHA1 Message Date
José Armando García Sancio 7d1b0926fa
KAFKA-13883: Implement NoOpRecord and metadata metrics (#12183)
Implement NoOpRecord as described in KIP-835. This is controlled by the new
metadata.max.idle.interval.ms configuration.

The KRaft controller schedules an event to write NoOpRecord to the metadata log if the metadata
version supports this feature. This event is scheduled at the interval defined in
metadata.max.idle.interval.ms. Brokers and controllers were improved to ignore the NoOpRecord when
replaying the metadata log.

This PR also addsffour new metrics to the KafkaController metric group, as described KIP-835.

Finally, there are some small fixes to leader recovery. This PR fixes a bug where metadata version
3.3-IV1 was not marked as changing the metadata. It also changes the ReplicaControlManager to
accept a metadata version supplier to determine if the leader recovery state is supported.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2022-06-01 10:48:24 -07:00
dengziming 54d60ced86
KAFKA-13833: Remove the min_version_level from the finalized version range written to ZooKeeper (#12062)
Reviewers: David Arthur <mumrah@gmail.com>
2022-05-25 14:02:34 -04:00
David Arthur 1135f22eaf
KAFKA-13830 MetadataVersion integration for KRaft controller (#12050)
This patch builds on #12072 and adds controller support for metadata.version. The kafka-storage tool now allows a
user to specify a specific metadata.version to bootstrap into the cluster, otherwise the latest version is used.

Upon the first leader election of the KRaft quroum, this initial metadata.version is written into the metadata log. When
writing snapshots, a FeatureLevelRecord for metadata.version will be written out ahead of other records so we can
decode things at the correct version level.

This also includes additional validation in the controller when setting feature levels. It will now check that a given
metadata.version is supportable by the quroum, not just the brokers.

Reviewers: José Armando García Sancio <jsancio@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, dengziming <dengziming1993@gmail.com>, Alyssa Huang <ahuang@confluent.io>
2022-05-18 12:08:36 -07:00
José Armando García Sancio e94934b6b7
MINOR; DeleteTopics version tests (#12141)
Add a DeleteTopics test for all supported versions. Convert the
DeleteTopicsRequestTest to run against both ZK and KRaft mode.

Reviewers: Colin Patrick McCabe <cmccabe@apache.org>, dengziming <dengziming1993@gmail.com>
2022-05-12 13:04:48 -07:00
dengziming bf7cd675f8
MINOR: Remove duplicated test cases in MetadataVersionTest (#12116)
These tests belongs to ApiVersionsResponseTest, and accidentally copied them to MetadataVersionTest when working on #12072.

Reviewer: Luke Chen <showuon@gmail.com>
2022-05-04 11:10:39 +08:00
Alyssa Huang 8245c9a3d5
KAFKA-13854 Refactor ApiVersion to MetadataVersion (#12072)
Refactoring ApiVersion to MetadataVersion to support both old IBP versioning and new KRaft versioning (feature flags)
for KIP-778.

IBP versions are now encoded as enum constants and explicitly prefixed w/ IBP_ instead of KAFKA_, and having a
LegacyApiVersion vs DefaultApiVersion was not necessary and replaced with appropriate parsing rules for extracting
the correct shortVersions/versions.

Co-authored-by: David Arthur <mumrah@gmail.com>
Reviewers: Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>, dengziming <dengziming1993@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
2022-05-02 16:27:52 -07:00
Jason Gustafson b2cb6caa1e
MINOR: Move `KafkaYammerMetrics` to server-common (#11970)
With major server components like the new quorum controller being moved outside of the `core` module, it is useful to have shared dependencies moved into `server-common`. An example of this is Yammer metrics which server components still rely heavily upon. All server components should have access to the default registry used by the broker so that new metrics can be registered and metric naming conventions should be standardized. This is particularly important in KRaft where we are attempting to recreate identically named metrics in the controller context. This patch takes a step in this direction. It moves `KafkaYammerMetrics` into `server-common` and it implements
standard metric naming utilities there. 

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
2022-03-30 13:59:22 -07:00
Jason Gustafson fc20c551d6
MINOR: Clearer field names for ProducerIdsRecord and related classes (#11747)
The current naming of the fields in `ProducerIdsRecord` is a little confusing in regard to whether the block range was inclusive or exclusive. This patch tries to improve naming to make this clearer. In the record class, instead of `ProducerIdsEnd`, we use `NextProducerId`. We have also updated related classes such as `ProducerIdsBlock.java` with similar changes.

Reviewers: dengziming <dengziming1993@gmail.com>, David Arthur <mumrah@gmail.com>
2022-02-11 16:14:31 -08:00
Satish Duggana 6288b5370d
MINOR: Renamed a few record definition files with the existing convention. (#11414)
Reviewers: Jun Rao <junrao@gmail.com>
2021-10-21 13:44:08 -07:00
Colin Patrick McCabe 3f3a0e0d9e
KAFKA-13280: Avoid O(N) behavior in KRaftMetadataCache#topicNamesToIds (#11311)
Avoid O(N) behavior in KRaftMetadataCache#topicNamesToIds and
KRaftMetadataCache#topicIdsToNames by returning a map subclass that
exposes the TopicsImage data structures without copying them.

Reviewers: Jason Gustafson <jason@confluent.io>, Ismael Juma <ismael@juma.me.uk>
2021-10-07 09:41:57 -07:00
Satish Duggana 923bc2e9f7
MINOR Refactored the existing CheckpointFile in core module, moved to server-common module and introduced it as SnapshotFile. (#11060)
MINOR Refactored the existing CheckpointFile in core module, moved to server-common module.

Refactored CheckpointFile to server-common module as a Java class and it is reused by LeaderCheckpointFile, OffsetCheckpointFile.
This will be used by CommittedOffsetsFile which checkpoints remote log metadata partitions with respective offsets in the default RemoteLogMetadataManager implementation.
Existing tests are available for LeaderCheckpointFile, OffsetCheckpointFile.

Reviewers: Jun Rao <junrao@gmail.com>
2021-08-30 08:43:25 -07:00
Jason Gustafson d20865ae79
KAFKA-13053; Bump kraft frame version for incompatible changes from 2.8 (#11010)
This patch bumps the default frame version for kraft records from 0 to 1. At the same time, we reset all
records versions back to 0 and we enable flexible version support for UnregisterBrokerRecord, which was
missed previously. Note that the frame version bump also affects the KIP-405 records since they are
sharing AbstractApiMessageSerde. Since these records were not part of any previous releases, this should
not cause an issue.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2021-07-09 12:18:34 -07:00
Matthias J. Sax 4d43af4a57
MINOR: fix broken JavaDoc links (#10890)
Reviewers: David Jacot <djacot@confluent.io>, Luke Chen <showuon@gmail.com>
2021-06-17 10:30:44 -07:00
dengziming 51665b9f39
KAFKA-12338; Remove unused `MetadataParser` (#10793)
`MetadataParser` is a duplication of `MetadataRecordSerde` and it's not used in any code, so we can remove it. It did, however, have some useful validations which have been moved into `MetadataRecordSerde`.

Reviewers: Jason Gustafson <jason@confluent.io>
2021-06-07 10:52:16 -07:00
Colin Patrick McCabe ccec9b0c0d
KAFKA-12864: Move KafkaEventQueue into server-common. #10787 (#10787)
Since KafkaEventQueue is a generic data structure not specific to metadata, move it
into the server-common module.

Reviewers: Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>
2021-06-02 16:10:59 -07:00
David Arthur 72d108274c
KAFKA-12620 Allocate producer ids on the controller (#10504)
Introduce new AllocateProducerIds RPC and IBP 3.0-IV0 as part of KIP-730.

This change adds a new AllocateProducerIds RPC which is used by the broker to request a block of 
producer IDs from the controller. The new IBP added will determine if the broker should talk directly to 
ZooKeeper (IBP < 3.0) or it if should use the new RPC to talk to the controller (IBP >= 3.0).

Per-broker property overrides for ClusterTests were also added (in order to test mixed IBPs in a cluster)

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2021-05-21 15:58:49 -04:00
Satish Duggana 7ef3879429
KAFKA-12758 Added `server-common` module to have server side common classes. (#10638)
Added server-common module to have server side common classes. Moved ApiMessageAndVersion, RecordSerde, AbstractApiMessageSerde, and BytesApiMessageSerde to server-common module.

Reivewers:  Kowshik Prakasam <kprakasam@confluent.io>, Jun Rao <junrao@gmail.com>
2021-05-11 09:58:28 -07:00