Versions Compared

Key

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

Table of Contents

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current state[One of "Under Discussion", "Accepted", "Rejected"]Construction (smile)"

Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

...

Apache Kafka is rapidly finding its place in data heavy organizations as a fault-tolerant message bus. One of the goals of Kafka is data integration, which makes it important to support many users in one Kafka system. With increasing adoption and user community, support for multi-tenancy is becoming a popular demand. There have been a few discussions on Apache Kafka’s mailing lists regarding the same, indicating importance of the feature. Namespaces will allow/ enable many functionalities that require logical grouping of topics. If you think topic as a SQL table, then namespace is a SQL database that lets you group tables together. Following are a few use cases.

  • Namespaces will allow users to create topics with same name as long as they are part of different namespaces.
  • Allow bootstrapping any new entity in a namespace with some default configs, which is set for that particular namespace, and then letting each entity override parts of that config.
  • Similar to configs, acls can be set at namespace level, which is by default inherited by underlying entities.
  • When Kafka decides to support at rest encryption, having namespaces at logs level will allow encrypting different namespaces with different keys.

Public Interfaces

Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this feature.

...

  • Binary log format

  • The network protocol and api behavior

  • Any class in the public packages under clientsConfiguration, especially client configuration

    • org/apache/kafka/common/serialization

    • org/apache/kafka/common

    • org/apache/kafka/common/errors

    • org/apache/kafka/clients/producer

    • org/apache/kafka/clients/consumer (eventually, once stable)

  • Monitoring

  • Command line tools and arguments

  • Anything else that will likely break existing users in some way when they upgrade

Proposed Changes

We are proposing following changes in the storage layout of Zookeeper entities and logs on disk.

1. Store topics within hierarchy of namespace.
/brokers/topics/topic1 => /brokers/topics/org/apache/kafka/topic1
2. Store configs of a topic with hierarchy of namespace.
/configs/topics/topic1 => /configs/topics/org/apache/kafka/topic1
3. Store logs of a topic partition within hierarchy of namespace.
/<log_dir>/topics/topic1 => /<log_dir>/topics/org/apache/kafka/topic1


Internals of Kafka can still remain the same, if the layer talking to ZK and logs know how to translate a topic name to topic and namespace. One way to do this is by reserving a keyword for separating namespace from topic name in a topic name, e.g., namespace::topic. This will avoid the need of modifying existing request and response formats to add a field for namespace.

AdminUtils and CLI tools will take an optional argument of namespace while creating topic or altering config. If namespace is not provided, a default namespace, i.e., no namespace, will be usedDescribe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior how will we phase out the older behavior?
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Rejected Alternatives

...

Following are a few alternatives that we considered.

  1. Just prepend namespace to topic names
  2. Manage namespaces separately
  3. Change the world