Impossible to set AutoTopicCreation policy to non-partitioned
tomjo opened this issue · 0 comments
Expected behavior
Client.Namespaces().SetTopicAutoCreation() allows setting a TopicAutoCreation allowed policy on the namespace with default topic type non-partitioned.
Actual behavior
SetTopicAutoCreation has a parameter utils.TopicAutoCreationConfig, this struct has an int field Partitions (defaultNumPartitions) which cannot be nil. When trying to SetTopicAutoCreation with config (Allow=true,Type="non-partitioned",Partitions=0) the API call will fail with:
{"reason":"Invalid configuration for autoTopicCreationOverride. the detail is [defaultNumPartitions] is not allowed to be set when the type is non-partition."}
This happens with any value for Partitions. In the pulsar admin rest-api the defaultNumPartitions field is optional, it should either be made optional as well in TopicAutoCreationConfig or the library should not include the field when Type="non-partitioned".
With the rest API I can do:
curl --data '{"allowAutoTopicCreation":true,"topicType":"non-partitioned"}' --header "Content-Type: application/json" --header "Accept: application/json" $APIHOST/admin/v2/namespaces/$tenant/$namespace/autoTopicCreation
Steps to reproduce
Call Client.Namespaces().SetTopicAutoCreation() with a TopicAutoCreation with Allow=true and Type="non-partitioned"
System configuration
Pulsar version: 2.11.2