-
Notifications
You must be signed in to change notification settings - Fork 83
BUG: Remove nullability from attribute properties #362
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
|
||
/// <summary> | ||
/// How many times to retry sending a failing Message. **Note:** default: 2 | ||
/// </summary> | ||
/// <remarks>Retrying may cause reordering unless <c>EnableIdempotence</c> is set to <c>true</c>.</remarks> | ||
public int? MaxRetries { get; set; } | ||
public int MaxRetries { get; set; } = 2; |
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.
int.MaxValue
@shrohilla I would really appreciate a bit of feedback on a bunch of PR:s. This one is a very clear bug that was reported more than 2 years ago. |
@gliljas could you please explain more details about this PR, is default value is not being reflected for all attributes or is this only for int max value is assigned to MaxRetries attribute on startup ?? |
The PR is about having nullable properties on attributes, i.e MaxMessageBytes, BatchSize, EnableIdempotence, MessageTimeoutMs, RequestTimeoutMs or MaxRetries. It's not allowed. Your code will not compile if you use any of these properties. |
@gliljas could you please share the sample code where you found there was code compilation issue with functions ?? |
Well, basically you could just try to use any of the mentioned properties yourself, and you'll see that it doesn't work. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@gliljas Thanks alot for your contribution. I'll also request you to please add 1 or 2 E2E tests with the change for both E2E and Lang E2E for testing the regression. |
That is not what the code does. The property types have changed. The end result is that the Confluent library will always be populated with the default values specified here, instead of Confluent's default values, so they have to be specified. In the case of MaxRetries, there is a difference, since Confluent specified int.MaxValue but this library specifies 2. Another option, which I used in a PR two years ago is to use nullable backingfields, which will only get a value if they're specifically set. |
I'll check the regression first. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@gliljas I would request you to add 1 End to End test case to validate the flow |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Sure thing, but any suggestion what such a test would do and assert? :) |
One way could be try to re ingest the same event using the output binding after enabling idempotency than producer will not allow to re-ingest the same event and throw the error, that error you need to read from the log -- https://github.com/Azure/azure-functions-kafka-extension/blob/dev/test/Microsoft.Azure.WebJobs.Extensions.Kafka.EndToEndTests/TestLoggerProvider.cs#L42 Please share the feedback if this proposal doesn't works out. |
@gliljas any update on this ?? |
I'll get back to it tonight. |
@gliljas any update on this ?? |
Just making sure it was noted that an e2e test was added. Testing idempotency is a bit too hidden in Kafka to be triggered from the outside, so I chose MaxMessageBytes instead. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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
@gliljas Thanks alot for your contribution we will plan this change in next release. |
As mentioned in #175, attributes can't have nullable properties. It doesn't compile. It seems you haven't tested it.
That PR used nullable backing fields and GetOrDefault to retrieve them. I think that may actually be better for the future, enabling properties to be set in different levels, but here I took the easy route.
Also note that the default RequestTimeoutMs in this library is 5000ms, whereas in the Confluent library, if not set, it's 30000ms. Since it was impossible to specify RequestTimeoutMs before this fix, this would actually mean that we're changing from 30000 to 5000 now. The documentation for Confluent's MessageSendMaxRetries claims that the default is int.MaxValue, but I doubt that's the truth. confluentinc/confluent-kafka-dotnet#1858
Edit: It was the truth