Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

ISSUE-12629: PIP 110: Topic metadata #3228

Closed
sijie opened this issue Nov 4, 2021 · 0 comments
Closed

ISSUE-12629: PIP 110: Topic metadata #3228

sijie opened this issue Nov 4, 2021 · 0 comments

Comments

@sijie
Copy link
Member

sijie commented Nov 4, 2021

Original Issue: apache#12629


Motivation

The original discussion mail :
https://lists.apache.org/thread/m9dkhq1fs6stsdwh78h84fsl5hs5v67f

Introduce the ability to store metadata about topics.

This would be very useful as with metadata you could add labels and other
pieces of information that would allow defining the purpose of a topic,
custom application-level properties.
This feature will allow application-level diagnostic tools and maintenance
tools to not need external databases to store such metadata.

Imagine that we could add a simple key value map (String keys and String
values) to the topic.
These metadata could be set during topic creation and also updated.

API Changes

We need to add a map type field called metadata to the below methods signature:

  • PersistentTopics#createPartitionedTopic
    PersistentTopics#createPartitionedTopic(AsyncResponse asyncResponse, String tenant, String namespace,String encodedTopic,int numPartitions,boolean createLocalTopicOnly, Map<String, String> metadata);  
    
  • PersistentTopics#createNonPartitionedTopic
    PersistentTopics#createNonPartitionedTopic(String tenant, String namespace, String encodedTopic, boolean authoritative, Map<String, String> metadata); 
    

Implementation

  • For PartitionedTopic
    We will put these metadata to the PartitionedTopicMetadata, serialized to store in configurationMetadataStore, like partitioned-topic partitions.

    public class PartitionedTopicMetadata {
    
     /* Number of partitions for the topic */
     public int partitions;
     
     /* Topic metadata */
     public Map<String, String> metadata;
    
  • For NonPartitionedTopic
    We will store the metadata to ML(ManagedLedger) which already supports storing custom properties.

    ManagedLedger#setProperties(Map<String, String> properties) 
    

Compatibility

The proposal will not introduce any compatibility issues.

Tests Plan

Unit tests & integration tests

@sijie sijie added the PIP label Nov 4, 2021
@sijie sijie changed the title ISSUE-12629: PIP : Topic metadata ISSUE-12629: PIP 110: Topic metadata Nov 6, 2021
@sijie sijie closed this as completed Jan 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant