librdkafka icon indicating copy to clipboard operation
librdkafka copied to clipboard

Remove warning for allow.auto.create.topics with producer

Open milindl opened this issue 3 years ago • 1 comments

Also improves the documentation around this property.

This solves the following problem:

The property "allow.auto.create.topics" is supposed to be a consumer property, but we are setting it (and it is affecting the behaviour of) both the consumer and producer. It gives a warning if we change it in the producer, but works nevertheless.

(the default value for the producer is true)

One of the effects is that if a user is using their producer as an adminclient, a call to get metadata for a topic might create that topic, and if the user specifies allow.auto.create.topics, then they get a warning.

Unfortunately, we even recommend using a producer with the above setting (see INTRODUCTION.md).

A knock on effect is that both the go and python clients use a producer internally for their adminclients so the user has to either live with a call to GetMetadata creating topics, or with the warning. (ref: confluent-kafka-go/#780)

The java client only allows this property to be set on the consumer, which makes it more confusing.

milindl avatar Aug 24 '22 05:08 milindl

Hi @edenhill :

I'm stuck as to what's the best solution to the problem described above. I discussed a few different approaches with @emasab / @mhowlett and we thought this was the best way. The other approaches both won't change the property itself. All the approaches are:

  • change allow.auto.create.topics scope in librdkafka to include producer, this removes warning. we will need to change the doc also (this PR)
  • change all clients individually to use consumer rather than producer for their adminclients
  • some other approach where clients use producer by default but use consumer if this config is specified

milindl avatar Sep 12 '22 16:09 milindl

allow.auto.create.topics is used by the producer too, so I think the proper fix is to remove _RK_CONSUMER from the configuration property and update the docstring to also explain the producer behaviour (i.e., referenced topics will be auto-created).

edenhill avatar Oct 07 '22 14:10 edenhill

Thanks, it sounds good and that's what I already have done in this PR (removed _RK_CONSUMER, and added doc for the different behaviors of this for producer and consumer)

milindl avatar Oct 10 '22 05:10 milindl

Please rebase this on latest master.

Also make sure that you do not edit CONFIGURATION.md directly since it is auto-generated by make.

Move the CHANGELOG entry to the 1.9.3 Enhancements section.

edenhill avatar Nov 07 '22 11:11 edenhill

Make sure to run the style-fixer (on linux, not osx): make style-fix (or make style-fix-changed prior to committing your stuff, since that's quicker)

edenhill avatar Nov 07 '22 11:11 edenhill

Fixed whitespace issues. Sorry about that, clang-format v14.0.0 did not work as expected, had to use v10.0.0.

milindl avatar Nov 07 '22 15:11 milindl

LGTM

edenhill avatar Nov 08 '22 07:11 edenhill