Commit Graph

517 Commits

Author SHA1 Message Date
Ron Dagostino d9bb2ef596
MINOR: The new KIP-500 code should treat cluster ID as a string (#10357)
Cluster ID has traditionally been treated as a string by the Kafka protocol (for example,
AdminClient returns it as a string).  The new KIP-500 code should continue this practice.  If
we don't do this, upgrading existing clusters may be harder to do.

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Jason Gustafson <jason@confluent.io>
2021-03-19 09:56:04 -07:00
Colin Patrick McCabe f6884cc6dd
MINOR: Fix BaseHashTable sizing (#10334)
The array backing BaseHashTable is intended to be sized as a power of
two.  Due to a bug, the initial array size was calculated incorrectly
in some cases.

Also make the maximum array size the largest possible 31-bit power of
two.  Previously it was a smaller size but this was due to a typo.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jose Sancio <jsancio@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
2021-03-18 09:58:49 -07:00
dengziming 8c9bc9c640
MINOR: Add entityType for metadata record definitions (#10116)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-03-10 13:27:06 +08:00
Tom Bentley a1fb80ffe2
MINOR: Add missing log argument (#10262)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
2021-03-09 12:46:43 +08:00
Jason Gustafson 31a121c3b7
KAFKA-12403; Ensure local state deleted on `RemoveTopicRecord` received (#10252)
This patch implements additional handling logic for `RemoveTopic` records:

- Update `MetadataPartitions` to ensure addition of deleted partitions to `localRemoved` set
- Ensure topic configs are removed from `ConfigRepository`
- Propagate deleted partitions to `GroupCoordinator` so that corresponding offset commits can be removed

This patch also changes the controller topic id generation logic to use `Uuid.randomUuid` rather than `Random`.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Chia-Ping Tsai <chia7712@gmail.com>
2021-03-08 11:21:42 -08:00
Jason Gustafson 60a097ae40
HOTFIX: Controller topic deletion should be atomic (#10264)
Topic deletions should be atomic. This fixes a build error caused by merging of both https://github.com/apache/kafka/pull/10253 and https://github.com/apache/kafka/pull/10184 at about the same time. 

Reviewers: David Arthur <mumrah@gmail.com>
2021-03-04 12:19:34 -08:00
Colin Patrick McCabe eebc6f279e
MINOR: Enable topic deletion in the KIP-500 controller (#10184)
This patch enables delete topic support for the new KIP-500 controller. Also fixes the following:
- Fix a bug where feature level records were not correctly replayed.
- Fix a bug in TimelineHashMap#remove where the wrong type was being returned.

Reviewers: Jason Gustafson <jason@confluent.io>, Justine Olshan <jolshan@confluent.io>, Ron Dagostino <rdagostino@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>, Jun Rao <junrao@gmail.com>

Co-authored-by: Jason Gustafson <jason@confluent.io>
2021-03-04 11:28:20 -08:00
José Armando García Sancio 96a2b7aac4
KAFKA-12376: Apply atomic append to the log (#10253) 2021-03-04 13:55:43 -05:00
Jason Gustafson a8eda3c785
KAFKA-12367; Ensure partition epoch is propagated to `Partition` state (#10200)
This patch fixes two problem with the AlterIsr handling of the quorum controller:

- Ensure that partition epoch is updated correctly after partition change records and is
propagated to Partition

- Ensure that AlterIsr response includes partitions that were successfully updated

As part of this patch, I've renamed BrokersToIsrs.TopicPartition to
BrokersToIsrs.TopicIdPartition to avoid confusion with the TopicPartition object which is
used virtually everywhere. I've attempted to address some of the testing gaps as welll.

Reviewers: Colin P. McCabe <cmccabe@apache.org>
2021-02-25 14:17:19 -08:00
Colin Patrick McCabe 5eac5a822f
KAFKA-12276: Add the quorum controller code (#10070)
The quorum controller stores metadata in the KIP-500 metadata log, not in Apache
ZooKeeper. Each controller node is a voter in the metadata quorum. The leader of the
quorum is the active controller, which processes write requests. The followers are standby
controllers, which replay the operations written to the log. If the active controller goes away,
a standby controller can take its place.

Like the ZooKeeper-based controller, the quorum controller is based on an event queue
backed by a single-threaded executor. However, unlike the ZK-based controller, the quorum
controller can have multiple operations in flight-- it does not need to wait for one operation
to be finished before starting another. Therefore, calls into the QuorumController return
CompleteableFuture objects which are completed with either a result or an error when the
operation is done. The QuorumController will also time out operations that have been
sitting on the queue too long without being processed. In this case, the future is completed
with a TimeoutException.

The controller uses timeline data structures to store multiple "versions" of its in-memory 
state simultaneously. "Read operations" read only committed state, which is slightly older
than the most up-to-date in-memory state. "Write operations" read and write the latest
in-memory state. However, we can not return a successful result for a write operation until
its state has been committed to the log. Therefore, if a client receives an RPC response, it
knows that the requested operation has been performed, and can not be undone by a
controller failover.

Reviewers: Jun Rao <junrao@gmail.com>, Ron Dagostino <rdagostino@confluent.io>
2021-02-19 18:03:23 -08:00
Colin P. Mccabe 690f72dd69 KAFKA-12334: Add the KIP-500 metadata shell
The Kafka Metadata shell is a new command which allows users to
interactively examine the metadata stored in a KIP-500 cluster.
It can examine snapshot files that are specified via --snapshot.

The metadata tool works by replaying the log and storing the state into
in-memory nodes.  These nodes are presented in a fashion similar to
filesystem directories.

Reviewers: Jason Gustafson <jason@confluent.io>, David Arthur <mumrah@gmail.com>, Igor Soarez <soarez@apple.com>
2021-02-19 15:46:34 -08:00
David Arthur 25555b89f5
MINOR: Add BrokerMetadataListener (#10111)
This adds BrokerMetadataListener which is responsible for processing metadata records received by the broker when running in Raft mode.

This also moves some classes that were added to the wrong folder in trunk

Reviewers: Colin P. McCabe <cmccabe@apache.org>, Ron Dagostino <rdagostino@confluent.io>
2021-02-11 12:43:21 -08:00
Colin Patrick McCabe bf5e1f1cc0
MINOR: add the MetaLogListener, LocalLogManager, and Controller interface. (#10106)
Add MetaLogListener, LocalLogManager, and related classes. These
classes are used by the KIP-500 controller and broker to interface with the
Raft log.

Also add the Controller interface. The implementation will be added in a separate PR.

Reviewers: Ron Dagostino <rdagostino@confluent.io>, David Arthur <mumrah@gmail.com>
2021-02-11 08:42:59 -08:00
Colin Patrick McCabe d98df7fc4d
MINOR: Add KafkaEventQueue (#10030)
Add KafkaEventQueue, which is used by the KIP-500 controller to manage its event queue.
Compared to using an Executor, KafkaEventQueue has the following advantages:

* Events can be given "deadlines." If an event lingers in the queue beyond the deadline, it
will be completed with a timeout exception. This is useful for implementing timeouts for
controller RPCs.

* Events can be prepended to the queue as well as appended.

* Events can be given tags to make them easier to manage. This is especially useful for
rescheduling or cancelling events which were previously scheduled to execute in the future.

Reviewers: Jun Rao <junrao@gmail.com>, José Armando García Sancio <jsancio@gmail.com>
2021-02-04 14:46:57 -08:00
Jason Gustafson f58c2acf26
KAFKA-12250; Add metadata record serde for KIP-631 (#9998)
This patch adds a `RecordSerde` implementation for the metadata record format expected by KIP-631. 

Reviewers: Colin McCabe <cmccabe@apache.org>, Ismael Juma <mlists@juma.me.uk>
2021-02-03 16:16:35 -08:00
Colin Patrick McCabe 1711cfa4eb
KAFKA-12209: Add the timeline data structures for the KIP-631 controller (#9901)
Reviewers: Jun Rao <junrao@gmail.com>
2021-02-02 11:33:55 -08:00
Colin Patrick McCabe 217334b0f4
KAFKA-12183: Add the KIP-631 metadata record definitions (#9876)
Add the metadata gradle module, which will contain the metadata record
definitions, and other metadata-related broker-side code.

Add MetadataParser, MetadataParseException, etc.

Reviewers: José Armando García Sancio <jsancio@gmail.com>, Ismael Juma <ismael@juma.me.uk>, David Arthur <mumrah@gmail.com>
2021-01-14 09:58:52 -08:00