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

[Issue 1105][pulsaradmin] fix AutoTopicCreation for type non-partitioned #1107

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

tomjo
Copy link
Contributor

@tomjo tomjo commented Oct 20, 2023

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 type of Partitions in TopicAutoCreationConfig from int to *int

Verifying this change

  • Make sure that the change passes the CI checks.

I tested it by using it in our application as the admin code currently does not have much test code. I saw here #1085 that there are reorganization plans + setting up test scaffolding in the future.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomjo can you elaborate a bit for the use case where this change makes difference?

@tomjo
Copy link
Contributor Author

tomjo commented Oct 26, 2023

We're using a component that publishes messages to a topic with a generated name, so we want to use topic auto creation for the namespace so that these topics are automatically created. We don't need partitions for these topics so we want the default for topic auto creation to be non-partitioned. This is not possible now (see linked issue) since the Partitions int field in the struct has a default value of 0 causing it to be added to the request body of the api call, which pulsar rejects with an error. By making it a pointer, it can be nil and it is not serialized in the body allowing the api call to succeed in setting the auto topic creation policy to enabled and non-partitioned.

We're currently using topic auto creation with type partitioned and 1 partition which works but it would be nicer if the client supports what the rest api supports

@RobertIndie RobertIndie merged commit cae74c5 into apache:master Jan 9, 2024
6 checks passed
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 this pull request may close these issues.

Impossible to set AutoTopicCreation policy to non-partitioned
3 participants