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

kafkamdm: make kafka version configurable #446

Closed
wants to merge 1 commit into from

Conversation

D3luxee
Copy link
Contributor

@D3luxee D3luxee commented Oct 30, 2020

This PR will fix #444

This implementation will add kafkaVersion as option to the kafkamdm route. If no version got specified carbon-relay-ng will print a warning and use sarama.DefaultVersion.

This means that users can now specify the kafka version but if they don't do it carbon-relay-ng will act as in the current implementation.

ParseKafkaVersion will return the same default value on error as sarama.NewConfig() would:
https://github.com/Shopify/sarama/blob/v1.23.0/utils.go#L196
https://github.com/Shopify/sarama/blob/v1.23.0/config.go#L439

We might discuss if the message regarding invalid version should be a warn or info.

@Dieterbe
Copy link
Contributor

nice. looks good. you have tested this, i presume?

@D3luxee
Copy link
Contributor Author

D3luxee commented Nov 2, 2020

Hi, i did not test against a kafka cluster but i checked if the config gets applied and what happens if i do not configure the version or configure a invalid version.

Invalid version or unconfigured = [WARNING] kafkaMdm "kafkaMdm": failed to parse kafka version fallback to default version. invalid version
If a correct version was configured no warning was printed and it should be set in the sarama producer config.

The warning might be misleading due to the sarama error message "invalid version" maybe i should adjust it / remove the sarama error message.

@@ -218,6 +218,7 @@ topic | Y | string | N/A |
codec | Y | string | N/A | which compression to use. possible values: none, gzip, snappy
partitionBy | Y | string | N/A | which fields to shard by. possible values are: byOrg, bySeries, bySeriesWithTags
schemasFile | Y | string | N/A |
kafkaVersion | N | string | "" | Kafka version in semver format. All brokers must be this version or newer. (fallback to oldest stable version 1.0.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

go.mod pins sarama to v1.23.0
That version's ParseKafkaVersion function returns V0_8_2_0 if no version could be parsed

@@ -96,11 +95,19 @@ func NewKafkaMdm(key string, matcher matcher.Matcher, topic, codec, schemasFile,
log.Fatalf("kafkaMdm %q: failed to initialize partitioner. %s", r.key, err)
}

kfkVersion, err := sarama.ParseKafkaVersion(kafkaVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

defaulting to an empty string and showing an error if the user doesn't specify a version, seems messy.
Why don't we default to sarama.MinVersion.String() ?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Georg Doser seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@D3luxee D3luxee closed this Jun 16, 2022
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.

Configurable kafka version for kafkamdm route
3 participants