Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to set AutoTopicCreation policy to non-partitioned #1105

Closed
tomjo opened this issue Oct 19, 2023 · 0 comments · Fixed by #1107
Closed

Impossible to set AutoTopicCreation policy to non-partitioned #1105

tomjo opened this issue Oct 19, 2023 · 0 comments · Fixed by #1107

Comments

@tomjo
Copy link
Contributor

tomjo commented Oct 19, 2023

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

RobertIndie pushed a commit that referenced this issue Jan 9, 2024
…ned (#1107)

Fixes #1105

### Motivation

To allow setting the AutoTopicCreation policy to non-partitioned it is required to not send the partitions parameter, by making Partitions a pointer instead of an int this is possible.

### Modifications

Change the type of Partitions in TopicAutoCreationConfig from int to *int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant