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
Retry when recording an EventSerie results in an AlreadyExist error #114237
Conversation
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Dec 1 09:40:53 UTC 2022. |
/assign @yliaog |
// Event is emitted twice in a very short period of time. | ||
if isEventSeries { | ||
return nil, 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.
This change LGTM. Is it possible add some simple unit test for it?
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 added one in the latest update PTAL
When attempting to record a new Event and a new Serie on the apiserver at the same time, the patch of the Serie might happen before the Event is actually created. In that case, we handle the error and try to create the Event. But the Event might be created during that period of time and it is treated as an error today. So in order to handle that scenario, we need to retry when a Create call for a Serie results in an AlreadyExist error. Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
312ddc4
to
2f83117
Compare
isomorphicEvent, | ||
}, | ||
expectedRecordedEvent: isomorphicEvent, | ||
}, |
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.
awesome - great tests
/lgtm Thanks! |
LGTM label has been added. Git tree hash: 3e739f22bae4f2df056cf47c71a651c91efce743
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgrisonnet, wojtek-t The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When attempting to record a new Event and a new Serie on the apiserver
at the same time, the patch of the Serie might happen before the Event
is actually created. In that case, we handle the error and try to create
the Event. But the Event might be created during that period of time and
it is treated as an error today. So in order to handle that scenario, we
need to retry when a Create call for a Serie results in an AlreadyExist
error.
Special notes for your reviewer:
This issue was highlighted when fixing a data race with a similar scenario and writing a test for it in: #114236.
The test testing this particular scenario was written in the PR above and we can't add it here since it requires the bug fix from the other PR. Also, this would need to go in before the other PR since the test fails without it.
Does this PR introduce a user-facing change?
/cc @wojtek-t