Repository navigation
Add validate_only and timeout options to admin topic calls - #1092
Merged
Merged
Conversation
Bind rd_kafka_AdminOptions_set_validate_only, _set_operation_timeout and _set_request_timeout. create_topic keeps accepting a topic config hash passed without braces.
…-validate-only-timeouts # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
50838
Binds
rd_kafka_AdminOptions_set_validate_only,rd_kafka_AdminOptions_set_operation_timeoutandrd_kafka_AdminOptions_set_request_timeout, and exposes them as keyword options:Admin#create_topic(name, partitions, rf, config = {}, validate_only: false, operation_timeout_ms: nil, request_timeout_ms: nil)Admin#create_partitions(name, count, validate_only: false, operation_timeout_ms: nil, request_timeout_ms: nil)Admin#delete_topic(name, operation_timeout_ms: nil, request_timeout_ms: nil)(librdkafka does not acceptvalidate_onlyfor DeleteTopics)nilkeeps librdkafka's defaults. A value librdkafka rejects (out of range) raisesRdkafkaError(invalid_arg) synchronously, before anything is enqueued; the handle is unregistered and the options destroyed.Braceless hash: once
create_topictakes keywords, Ruby 3 readscreate_topic("t", 1, 1, "retention.ms" => "1000")as keywords and would raiseunknown keyword: "retention.ms".create_topictherefore captures other keywords (**braceless_topic_config) and merges them intotopic_config, so that call keeps working, also next to the new options. No braceless call exists inKarafka::Admin(karafka passestopic_configas a variable) or in this repo's specs; specs cover the braceless String-key, Symbol-key and braces + braceless cases.karafka-rdkafka port: karafka#613.
Tests
validate_only(no topic / partition count unchanged; invalid config, existing topic and invalid partition count still reported), both timeouts on all three calls, out of range values, andrequest_timeout_msfailing a request to an unreachable broker in ~1 s instead of 60 s.spec/integrations/admin_validate_only_and_timeouts_spec.rb(passes locally on the plain compose broker).validate_onlyturns two specs red.spec/fixtures/bindings_signatures.jsonregenerated.Performance impact
none (admin calls only; nothing changes when no option is given)