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

terraform/module: fix reference collection skipping #698

Merged
merged 3 commits into from
Nov 8, 2021

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Nov 8, 2021

This is a typo copy paste bug which was introduced early with the introduction of these operations in #485

Attached test exhibits the behaviour.

This is blocker for #700 where we rely on reference origins & targets to always be parsed.

@radeksimko radeksimko added the bug Something isn't working label Nov 8, 2021
@radeksimko radeksimko marked this pull request as ready for review November 8, 2021 11:26
@radeksimko radeksimko requested a review from a team November 8, 2021 11:27
Copy link
Member

@dbanck dbanck left a comment

Choose a reason for hiding this comment

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

LGTM (as far as I can tell)

Interesting behavior of txn.Insert.

It may be worth evaluating if we want to add tests for the other module operations at some point later.

@radeksimko
Copy link
Member Author

@dbanck

Interesting behavior of txn.Insert.

If you're pointing out the data race, then that was caused by modifying the "live" record as opposed to making copy when updating, which doesn't have much to do with Insert itself, but rather the underlying data structures. Generally we store pointers in memdb, which means that if you ask for the same record twice, returned record will point to the same place in memory - which makes sense as we don't want to be making copy every time a record is read.

If you're pointing out the Insert method itself then it behaves more like "upsert" in some databases, which may be a little confusing, I admit. Unfortunately memdb API doesn't have a dedicated Update method (yet), but there are some TODOs in the codebase for that.

It may be worth evaluating if we want to add tests for the other module operations at some point later.

Yes, indeed - I think we should. I'm more wondering if there's any way we could refactor the logic such that it negates the need for all these constants and mappings between functions and operation names - I think that in itself just leaves too much room for error.

@radeksimko radeksimko merged commit 029b032 into main Nov 8, 2021
@radeksimko radeksimko deleted the b-fix-ref-collection branch November 8, 2021 16:41
@github-actions
Copy link

github-actions bot commented Dec 9, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants