Skip to content

Refactor onUpstreamReset in router filter.#6142

Merged
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
mpuncel:mpuncel/refactor-reset
Mar 8, 2019
Merged

Refactor onUpstreamReset in router filter.#6142
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
mpuncel:mpuncel/refactor-reset

Conversation

@mpuncel
Copy link
Copy Markdown
Contributor

@mpuncel mpuncel commented Mar 1, 2019

Previously onUpstreamReset handled 3 separate cases: per try timeout,
global timeout, and a stream reset by the upstream. In anticipation of
adding a new case for #5841, it might make things cleaner to pull it
out.

This commit extracts the functionality of the old onUpstreamReset into
separate methods, and then has onPerTryTimeout, onGlobalTimeout, and
onUpstreamReset call the helper functions with the the appropriate
arguments.

Signed-off-by: Michael Puncel mpuncel@squareup.com

Description: Refactor onUpstreamReset in the router filter from handling multiple cases (per try timeout, global timeout, upstream reset) and decompose it into helper functions called from case-specific handlers.
Risk Level: medium
Testing: unit tests
Docs Changes: N/A
Release Notes: N/A
This is a step toward #5841 which will have different handling for "soft" per try timeouts and normal per try timeout, which would make onUpstreamReset more complex than it already is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'm basically redefining what "upstream reset" means here. it used to mean a reset by the upstream, or a local reset of the upstream request (timeout). Now it only means the upstream reset it because we handle global/per try timeouts in other methods

Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks, I think this refactor makes sense

mpuncel added 4 commits March 4, 2019 07:58
Previously onUpstreamReset handled 3 separate cases: per try timeout,
global timeout, and a stream reset by the upstream. In anticipation of
adding a new case for envoyproxy#5841, it might make things cleaner to pull it
out.

This commit extracts the functionality of the old onUpstreamReset into
separate methods, and then has onPerTryTimeout, onGlobalTimeout, and
onUpstreamReset call the helper functions with the the appropriate
arguments.

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
@mpuncel mpuncel force-pushed the mpuncel/refactor-reset branch from 6269ed5 to d0a8f4e Compare March 4, 2019 13:07
@mpuncel
Copy link
Copy Markdown
Contributor Author

mpuncel commented Mar 4, 2019

rebased to resolve conflicts and pushed a new commit addressing PR feedback

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
@mpuncel mpuncel force-pushed the mpuncel/refactor-reset branch from 41da678 to 8613eb3 Compare March 7, 2019 20:39
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
lizan
lizan previously approved these changes Mar 8, 2019
snowp
snowp previously approved these changes Mar 8, 2019
Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks this is a super awesome cleanup. Very nice to see this code getting some attention! Few small comments.

/wait

mpuncel added 2 commits March 8, 2019 13:00
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
@mpuncel mpuncel dismissed stale reviews from snowp and lizan via 14c4131 March 8, 2019 18:20
@mattklein123
Copy link
Copy Markdown
Member

@mpuncel I think the issue is the trailing \ here:

COUNTER(rq_reset_after_downstream_response_started) \

I've seen this before, I think it prevents clang-format from turning back on. Can you remove that and try formatting again?

…mat fix

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thank you!

@mattklein123 mattklein123 merged commit 5e9963f into envoyproxy:master Mar 8, 2019
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.

4 participants