-
Notifications
You must be signed in to change notification settings - Fork 915
deprecate default.topic.configuration #446
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
some comments.
might want to fix the CI failures in this same PR too
@@ -1613,6 +1541,21 @@ rd_kafka_conf_t *common_conf_setup (rd_kafka_type_t ktype, | |||
PyDict_DelItemString(confdict, "plugin.library.paths"); | |||
} | |||
|
|||
if ((vo = PyDict_GetItemString(confdict, "default.topic.config"))) { | |||
PyErr_Warn(PyExc_DeprecationWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment out this warning until we hit 1.0
|
||
if ((PyDict_Update(confdict, vo) == -1)) { | ||
PyErr_SetString(PyExc_TypeError, | ||
"unable to process default.topic.config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
process is vague, and you shouldn't raise an exception here since PyDict_Update() already did, see the py docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack, read the docs(thats how I found PyDict_Update), but failed to consider the fact that it will raise the exception for me
"default.topic.config has being deprecated, " | ||
"set default topic configuration values in the global dict"); | ||
|
||
if ((PyDict_Update(confdict, vo) == -1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip outer parens
tests/test_misc.py
Outdated
timeout = time.time() + 5000 | ||
while not seen_delivery_cb: | ||
if time.time() > timeout: | ||
if os.environ.get("on_ci") == 'CI': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment name is "CI", so:
if "CI" in os.environ:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
tests/test_misc.py
Outdated
seen_delivery_cb = True | ||
assert err.code() == confluent_kafka.KafkaError._MSG_TIMED_OUT | ||
|
||
p = confluent_kafka.Producer({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add all three test-cases we discussed:
{"message.timeout.ms":60000, "default.topic.config": {"message.timeout.ms":1000}}
-> should take ~1s{"message.timeout.ms":1000}
-> should take ~1s{"default.topic.config": {"message.timeout.ms":1000}}
-> should take ~1s
CI build shows as failing here, but passing in the travis console since the .travis changes have been made. Either way ready for another review @edenhill |
tests/test_misc.py
Outdated
|
||
def test_topic_config_update(): | ||
confs = [{"message.timeout.ms": 600000, "default.topic.config": {"message.timeout.ms": 1000}}, | ||
{"message.timeout.ms": 1000}, {"default.topic.config": {"message.timeout.ms": 1000}}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two should be on separate lines to avoid confusion (I was confused!)
tests/test_misc.py
Outdated
seen_delivery_cb = True | ||
assert err.code() == confluent_kafka.KafkaError._MSG_TIMED_OUT | ||
|
||
for conf in confs[:]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the [:]
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be really explicit about the fact its all the configs not just some.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does the opposite, I'm afraid. Slicing is typically used to get a subset of something.
tests/test_misc.py
Outdated
p.poll(1) | ||
|
||
duration = time.time() - start | ||
if 1.02 >= duration <= .98: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is too tight. Since the "other" timeout is a lot higher (1 minute or 5 minutes), I think any value within 10s is okay here, which also makes it solid on CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should change all examples, tests and docs to not use default.topic.config, otherwise cut'n'paste people will keep using it.
|
||
/* | ||
* Default config (overridable by user) | ||
*/ | ||
|
||
/* Enable valid offsets in delivery reports */ | ||
rd_kafka_topic_conf_set(tconf, "produce.offset.report", "true", NULL, 0); | ||
rd_kafka_conf_set(conf, "produce.offset.report", "true", NULL, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is soon being enabled by default (1.0) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to wait? I can fix the examples in the meantime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the default.topic.config fix needs to go in v0.11.6.
..but we can do that for 1.0 |
LGTM! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments.
Also make sure to execute each of the changed files so that they are py-syntactically correct.
docs/index.rst
Outdated
@@ -110,7 +110,7 @@ https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md | |||
|
|||
The Python bindings also provide some additional configuration properties: | |||
|
|||
* ``default.topic.config``: value is a dict of client topic-level configuration | |||
* **DEPRECATED** ``default.topic.config``: value is a dict of client topic-level configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to mention that topic configuration now goes on the global config dictionary.
examples/integration_test.py
Outdated
@@ -159,7 +159,7 @@ def verify_producer(): | |||
conf = {'bootstrap.servers': bootstrap_servers, | |||
'error_cb': error_cb, | |||
'api.version.request': api_version_request, | |||
'default.topic.config': {'produce.offset.report': True}} | |||
'produce.offset.report': True} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this, it is set to true in common_conf_setup()
examples/integration_test.py
Outdated
@@ -285,7 +285,7 @@ def verify_avro(): | |||
conf = {'bootstrap.servers': bootstrap_servers, | |||
'error_cb': error_cb, | |||
'api.version.request': api_version_request, | |||
'default.topic.config': {'produce.offset.report': True}} | |||
'produce.offset.report': True} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
README.md
Outdated
'default.topic.config': { | ||
'auto.offset.reset': 'smallest' | ||
} | ||
'auto.offset.reset': 'smallest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change smallest -> earliest to be consistent
docs/index.rst
Outdated
@@ -110,7 +110,8 @@ https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md | |||
|
|||
The Python bindings also provide some additional configuration properties: | |||
|
|||
* **DEPRECATED** ``default.topic.config``: value is a dict of client topic-level configuration | |||
* **DEPRECATED**: topic configurations should be specified in the global configuration ** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the trailing double splats look wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line now reads as if "topic confiugration (not configruations!) should be specified in the global config .." is DEPRECATED.
I would use something like:
"default.topic.config: value is a dict of client topi-level configuration properties that are applied to all used topics for the instance. DEPRECATED: topic configuration should now be specified in the global top-level configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs another two bytes
docs/index.rst
Outdated
* **DEPRECATED**: topic configurations should be specified in the global configuration ** | ||
``default.topic.config``:value is a dict of client topic-level configuration | ||
properties that are applied to all used topics for the instance. | ||
* ``default.topic.config``:value is a dict of client topic-level configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add space after :
docs/index.rst
Outdated
properties that are applied to all used topics for the instance. | ||
* ``default.topic.config``:value is a dict of client topic-level configuration | ||
properties that are applied to all used topics for the instance. **DEPRECATED:** | ||
topic configuration should now be specified in the global top-level configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end sentence with period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
as outlined in 34baea6 (confluentinc#446)
No description provided.