Skip to content

Allow update of retention.ms during topic modification via NewTopic #1482

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

Closed
anycz opened this issue May 11, 2020 · 4 comments
Closed

Allow update of retention.ms during topic modification via NewTopic #1482

anycz opened this issue May 11, 2020 · 4 comments
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: enhancement
Milestone

Comments

@anycz
Copy link

anycz commented May 11, 2020

Affects Version(s): 2.3.7.RELEASE

I'm trying to modify topic configuration after the creation of the topic (mainly retention.ms in my case, but why not other properties).

When creating a NewTopic, configuration is set correctly at creation by KafkaAdmin.addTopics. When increasing the partitions in a NewTopic, after creation, they are updated automatically by KafkaAdmin.modifyTopics.

The idea would be to update KafkaAdmin.modifyTopics to also modify retention.ms (or possibly others in NewTopics.configs).

@garyrussell
Copy link
Contributor

garyrussell commented May 11, 2020

If your broker is 2.3 or later, you can do this today with

try (AdminClient client = AdminClient.create(kafkaAdmin.getConfig()) {
    ...
    client.incrementalAlterConfigs(configs, options).all().get(10, TimeUnit.SECONDS);
}

I am not convinced that we should do this unconditionally each time an application starts but I suppose we could consider adding a describeConfigs call and comparing them to the current config.

Contributions are welcome.

@garyrussell garyrussell added this to the Backlog milestone May 11, 2020
@anycz
Copy link
Author

anycz commented May 11, 2020

Thanks for the answer.

Nothing pressing on this point on my side, I just thought it would be a nice addition to spring-kafka in the long run. I had already gone with a new class based that basically does what you're proposing (new class based on KafkaAdmin that read the current configuration and call incrementalAlterConfigs).

It is in kotlin and I simplified edge cases a lot though (it assumes that fatalIfBrokerNotAvailable is always true / doesn't allow calls to initialize after startup / only handles retention.ms and not all possibilities in NewTopic.configs).

Sadly, I probably won't have time to contribute on this point, especially with the edge cases to think about on whether we should take special care when updating some of the configs (like what is done on re-partitioning)

@garyrussell garyrussell added the ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. label May 5, 2022
garyrussell added a commit that referenced this issue Jun 7, 2022
garyrussell pushed a commit that referenced this issue Jun 7, 2022
Resolves #1482

Renamed modifyTopics to createMissingParitions

Typo

Added method to detect mismatches in topic-config
Added method to adjust mismatches in topic-config

Added test for mismatch adjustment

Refactor

Added more testvalues
garyrussell added a commit that referenced this issue Jun 7, 2022
garyrussell pushed a commit that referenced this issue Jun 7, 2022
Resolves #1482

Renamed modifyTopics to createMissingParitions

Typo

Added method to detect mismatches in topic-config
Added method to adjust mismatches in topic-config

Added test for mismatch adjustment

Refactor

Added more testvalues
garyrussell added a commit that referenced this issue Jun 7, 2022
@wilkinsona
Copy link
Member

@garyrussell Should this be moved into the 2.8.7 milestone?

@garyrussell garyrussell modified the milestones: Backlog, 2.8.7 Jul 12, 2022
@garyrussell
Copy link
Contributor

@wilkinsona Done; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: enhancement
Projects
None yet
3 participants