Skip to content

fix(traffic-split): binding upstream via upstream_id is invalid#3842

Merged
spacewander merged 3 commits into
apache:masterfrom
Firstsawyou:tf-up
Mar 17, 2021
Merged

fix(traffic-split): binding upstream via upstream_id is invalid#3842
spacewander merged 3 commits into
apache:masterfrom
Firstsawyou:tf-up

Conversation

@Firstsawyou

@Firstsawyou Firstsawyou commented Mar 16, 2021

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

fix #3740
Related issues: #3787

Because the current traffic-split plug-in supports upstream_id to refer to the upstream by rewriting the value of ctx.matched_route.value.upstream_id. However, when the upstream_id is used by the route and the plugin at the same time, the rewriting of ctx will cause the upstream_id on the original cached route to be lost.
Therefore, this PR creates a temporary variable of ctx.upstream_id to cache the upstream_id configured in the plug-in, avoiding the modification of ctx.matched_route.value.upstream_id.

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

Comment thread apisix/init.lua Outdated
Comment thread apisix/init.lua Outdated
@Firstsawyou
Firstsawyou requested a review from spacewander March 17, 2021 08:49
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.

bug: the traffic-split plugin is invalid to bind upstream via upstream_id

3 participants