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: update target in-place #480

Merged
merged 1 commit into from
Aug 27, 2021
Merged

fix: update target in-place #480

merged 1 commit into from
Aug 27, 2021

Conversation

hbagdi
Copy link
Member

@hbagdi hbagdi commented Aug 27, 2021

Targets in Kong were immutable. They were changed to be mutable a few
months ago but we can't break compatibility.

If target's weight was changed, it resulted in the following:

  • diff is detected, an update is issued
  • update operations are translated into delete then create, the ID
    changes
  • the update is then reflected into go-memdb, because the ID is new,
    state package emits an error that it can't update an entity that it
    didn't previously have

This patch ensures that ID across update remains the same.

The tests for this is here: Kong/go-kong#85

Targets in Kong were immutable. They were changed to be mutable a few
months ago but we can't break compatibility.

If target's weight was changed, it resulted in the following:
- diff is detected, an update is issued
- update operations are translated into delete then create, the ID
changes
- the update is then reflected into go-memdb, because the ID is new,
state package emits an error that it can't update an entity that it
didn't previously have

This patch ensures that ID across update remains the same.

The tests for this is here: Kong/go-kong#85
@hbagdi hbagdi requested a review from a team as a code owner August 27, 2021 19:21
@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2021

Codecov Report

Merging #480 (1bfde5f) into main (74f9e54) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #480   +/-   ##
=======================================
  Coverage   50.44%   50.44%           
=======================================
  Files          72       72           
  Lines        7835     7835           
=======================================
  Hits         3952     3952           
  Misses       3534     3534           
  Partials      349      349           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74f9e54...1bfde5f. Read the comment docs.

@rainest rainest merged commit df01a9e into main Aug 27, 2021
@rainest rainest deleted the fix/in-place-target-update branch August 27, 2021 19:36
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.

3 participants