Skip to content
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(router): fix incorrectly calculated priorities in traditional_compat #10615

Merged
merged 6 commits into from
May 5, 2023

Conversation

hanshuebner
Copy link
Contributor

@hanshuebner hanshuebner commented Apr 5, 2023

Summary

When prefix and regex routes were mixed or prefixes of different lengths were specified in one route, traditional_compat assigned the highest priority of all paths to the route for all paths, causing unexpected routing matches that were incompatible with the traditional router.

With this fix, each multi-path route is split into multiple routes with separate priorities.

Checklist

  • The Pull Request has tests
  • There's an entry in the CHANGELOG
  • There is a user-facing docs PR

Issue reference

KAG-727
KAG-1446

@hanshuebner hanshuebner requested a review from chronolaw April 5, 2023 06:38
@hanshuebner hanshuebner requested a review from dndx April 5, 2023 06:38
hanshuebner added a commit to Kong/docs.konghq.com that referenced this pull request Apr 5, 2023
This PR updates the documentation to reflect the change in
Kong/kong#10615, which makes
traditional_compat mode behave like the traditional router
with respect to priorities of routes having multiple paths.
@hanshuebner hanshuebner marked this pull request as draft April 5, 2023 07:31
@pull-request-size pull-request-size bot added size/L and removed size/XL labels Apr 5, 2023
@hanshuebner hanshuebner marked this pull request as ready for review April 5, 2023 12:41
@hanshuebner hanshuebner force-pushed the fix/kag-727-traditional-compat branch from 57eb136 to 28e2640 Compare April 5, 2023 12:41
CHANGELOG.md Outdated Show resolved Hide resolved
@hbagdi hbagdi requested a review from samugi April 6, 2023 18:33
@hanshuebner hanshuebner force-pushed the fix/kag-727-traditional-compat branch from dd6b078 to a7b6d07 Compare April 11, 2023 08:22
Guaris pushed a commit to Kong/docs.konghq.com that referenced this pull request Apr 11, 2023
This PR updates the documentation to reflect the change in
Kong/kong#10615, which makes
traditional_compat mode behave like the traditional router
with respect to priorities of routes having multiple paths.
hanshuebner added a commit to Kong/docs.konghq.com that referenced this pull request Apr 17, 2023
)"

This reverts commit 7149a59.

This documentation update will have to wait until
Kong/kong#10615 is merged.
acgoldsmith pushed a commit to Kong/docs.konghq.com that referenced this pull request Apr 17, 2023
)" (#5442)

This reverts commit 7149a59.

This documentation update will have to wait until
Kong/kong#10615 is merged.
kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Show resolved Hide resolved
kong/router/compat.lua Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/atc.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
@kikito kikito added this to the 3.3.0 milestone Apr 25, 2023
kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
Copy link
Contributor

@flrgh flrgh left a comment

Choose a reason for hiding this comment

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

Nicely done! I left a few small suggestions, and I'd like to know your thoughts about the table copy comment that I raised.

@hanshuebner hanshuebner force-pushed the fix/kag-727-traditional-compat branch from 1b0140a to 10717c6 Compare May 4, 2023 10:04
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

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

Some early comments.

kong/router/compat.lua Outdated Show resolved Hide resolved
kong/router/compat.lua Outdated Show resolved Hide resolved
When prefix and regex routes were mixed or prefixes of different
lengths were specified in one route, traditional_compat assigned
the highest priority of all paths to the route for all paths,
causing unexpected routing matches that were incompatible with
the traditional router.

With this fix, each multi-path route is split into multiple
routes with separate priorities.

KAG-727
@hanshuebner hanshuebner force-pushed the fix/kag-727-traditional-compat branch from faf9e8a to 56cabca Compare May 5, 2023 09:24
@hanshuebner
Copy link
Contributor Author

@bungle can I get a final review and approval, please?

Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

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

LGTM

@hanshuebner hanshuebner merged commit 9beff64 into master May 5, 2023
@hanshuebner hanshuebner deleted the fix/kag-727-traditional-compat branch May 5, 2023 12:59
team-gateway-bot pushed a commit that referenced this pull request May 5, 2023
…pat (#10615)

* fix(router): fix incorrectly calculated priorities in traditional_compat

When prefix and regex routes were mixed or prefixes of different
lengths were specified in one route, traditional_compat assigned
the highest priority of all paths to the route for all paths,
causing unexpected routing matches that were incompatible with
the traditional router.

With this fix, each multi-path route is split into multiple
routes with separate priorities.

KAG-727

* address review comments

* use uuidv5 to create stable split route ids

* improve naming

* refactor for call-site clarity

* some loop refactoring

(cherry picked from commit 9beff64)
chronolaw added a commit that referenced this pull request May 6, 2023
hanshuebner pushed a commit that referenced this pull request May 6, 2023
* fix a mistake introduced by #10615

* adjust order of PRs

* remove a comma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants