Versions Compared

Key

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

...

Reassigning replicas is another kind of topic modification (KIP-179). By similar reasoning to example 1 it, too, should be covered by the same policy.

 

How does this KIP relate to KIP-170 proposes a TopicDeletionPolicy?

Rationalise the AlterConfigPolicy (in particular topic config changes and topic modifications)

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

 

Code Block
languagejava
linenumberstrue
/**
 * A policy that is enforced on actions affecting topics.
 */
interface TopicActionPolicy {
    /** Enumerates possible actions on topics. */
    static enum Action {
        /** The creation of a topic. */
        CREATE,
        /** The modification of a topic. */
        MODIFY,
        /** The deletion of a topic. */
        DELETE
    }
    /**
     * Represents the state of a topic either before, or as a result of, an administrative request affecting the topic.
     */
    static interface TopicState {
        /**
         * The number of partitions of the topic.
         */
        public abstract int numPartitions();
        /**
         * The replication factor of the topic.
         */
        public abstract Short replicationFactor();
        /**
         * The replica assignments of the topic.
         */
        public abstract Map<Integer, List<Integer>> replicasAssignments()
        /**
         * The topic config.
         */
        public abstract Map<String,String> configs();
    }
    /**
     * Parameters for a request to perform an {@linkplain #action} on a {@linkplain #topic}
     * @see #validate(RequestMetadata)
     */
    static interface RequestMetadata {
    /**
     * The {@linkplain Action action} being performed on the topic.
     */
    public abstract Action action();
    /**
     * The topic the {@linkplain #action() action} is being performed upon.
     */
    public abstract String topic();
    /**
     * The authenticated principal making the request, or null if the session is not authenticated.
     */
    Principal principal();
    /**
     * The state the topic has before the request.
     * <ul>
     * <li>For {@link Action#CREATE} this will be null.</li>
     * <li>For {@link Action#MODIFY} this will be the state the topic currently has (before the modification).</li>
     * <li>For {@link Action#DELETE} this will be the state of the topic which is going to be deleted.</li>
     * </ul>
     */
    public abstract TopicState preRequestState();
    /**
     * The state the topic will have after the request.
     * <ul>
     * <li>For {@link Action#CREATE} this will be the requested state of the topic to be created.</li>
     * <li>For {@link Action#MODIFY} this will be the state the topic will have after the modification.</li>
     * <li>For {@link Action#DELETE} this will be null.</li>
     * </ul>
     */
    public abstract TopicState postRequestState();
    public abstract String toString();
}
    /**
     * Validate the request parameters and throw a <code>PolicyViolationException</code> with a suitable error
     * message if the request parameters for the provided topic do not satisfy this policy.
     *
     * Clients will receive the POLICY_VIOLATION error code along with the exception's message. Note that validation
     * failure only affects the relevant topic, other topics in the request will still be processed.
     *
     * @param requestMetadata the request parameters for the provided topic.
     * @throws PolicyViolationException if the request parameters do not satisfy this policy.
     */
    void validate(RequestMetadata requestMetadata) throws PolicyViolationException;
}

 Describe 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

...