-
Notifications
You must be signed in to change notification settings - Fork 845
Return current parent max retry count for parent proxy #9620
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
why wouldn't this assert apply now with the new changes? seems like increment doesn't have to change now that you check attempts - 1 before you increment
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 is a great question. The check before the increment ensures that
attempts - 1 < the global parent_max_retries. The problem with this assert is that the argument passed inconfigured_connect_attempts_max_retriesmay not be the global parent max retry, but the max retry count for the current parent. Currently, the argument is set to the the output ofs->configured_connect_attempts_max_retries(), which is returning:txn_conf->connect_attempts_max_retriesIn the second case, the assert can fail as after the increment, it went over the max for the current parent(which should be allowed as we switch to the next parent).
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.
but doesn't this line
auto cur_parent_max_attempts = ((cur_tries + ppca - 1) / ppca) * ppca;take into account the max retries for the parent but also in relation to the total? even when we hit the max retries for the current parent, don't your new changes inconfigured_connect_attempts_max_retries()account for the next parent. each increment should be protected. im trying to find the edge case when this assert fails, could you provide an exampleUh oh!
There was an error while loading. Please reload this page.
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.
The assert can be triggered if parent_connect_attempts > (connect_attempts_max_retries + 1). If you can find checking logic in the config code that enforces this, it would be safe to restore the assert.
This was the original version of increment():
This was CurrentInfo::configured_connect_attempts_max_retries():
Even though this code was verified in Yahoo prod, and this sort of pointer arithmetic is how inheritance is implemented in C++, this code was rejected in review. I never would have put in the assert if I thought it would require adding a parameter to increment().
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.
configured_connect_attempts_max_retries()normally would be increment to the next multiple ofppca(accounts for the next parent), except for the case where the attempt/(retry + 1) is already a multiple of ppca(current parent hits max retries), in which case the calculation basically returns the same attempt/retry count as before.The above logic make sense when we call
maximize()with theconfigured_connect_attempts_max_retries()to disable further retries, since we already hit the max retries for the current parent, we are not setting it to anything larger.However, it will fail the assert in
increment()with theconfigured_connect_attempts_max_retries(), sincen = configured_connect_attempts_max_retries(n).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.
Got it, I misunderstood when the actual attempts_max_retries was being called