-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix incorrectly added functions. #4317
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
Fix incorrectly added functions. #4317
Conversation
f3a85b1
to
3e9f48d
Compare
Thank you for your PR. While testing it, I noticed there is test failure in Also , please run |
a4cb5dd
to
a80f0a7
Compare
I'll fix it |
This is a problem related to Spring retry.
In this code, the chunk class is being used as the key value in the retryContextCache. At the point where the error occurs, the item of class chunk has changed. Because this changes the hash code, it goes inside the if conditional, unlike before. That's why the error occurs in the 4th assertEquals method of testWriteRetryOnTwoExceptions(). This is because it throws a RetryException, which is not the expected error. How would you suggest fixing it, exclude the item from the hash code and equals? Or would it be better to modify the test code? |
a80f0a7
to
736eb9e
Compare
Thank you for tracing the issue down to Spring Retry! In Spring Batch, failed items are retried without any modification (it does not make sense to change an item before retrying it). So if the test changes the items before retrying them, then the test is incorrect and should be fixed. Do not hesitate to adapt it as needed. Let me know if you need help on this. Thank you! |
Thank you for your review. I'll try to modify the test code according to your idea. |
Done. |
7e81eba
to
e694e89
Compare
The test is actually correct. Your changes of the test makes it inconsistent with the test name. This is actually deeper than I thought. The issue is not with Spring Retry. The issue is with Spring Batch, which is using the So we are in a case where the The correct way to fix this issue is by using items in the retry context, not the At first, I thought this is related to the item buffering feature, but it is not (the test in question is still failing with or without buffering after adding equals/hashcode to For your PR, I took the commit that adds equals/hashcode, but I omitted the commit that changes the test (because the test is correct as explained previously). Thank you for your contribution! |
Rebased and merged as 30e8766. |
Correct that hashcode and equals were added in the chunk iterator class instead of in the chunk class.
This PR is related to #4314